Fix over-eager matching for YouTube embeds
This commit is contained in:
parent
53a9c58dd4
commit
2ad10129fa
1 changed files with 5 additions and 1 deletions
|
@ -619,7 +619,11 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
|
|||
}
|
||||
|
||||
if (trigger.match_embeds && msg.data.embeds && msg.data.embeds.length) {
|
||||
const str = JSON.stringify(msg.data.embeds[0]);
|
||||
const copiedEmbed = JSON.parse(JSON.stringify(msg.data.embeds[0]));
|
||||
if (copiedEmbed.type === "video") {
|
||||
copiedEmbed.description = ""; // The description is not rendered, hence it doesn't need to be matched
|
||||
}
|
||||
const str = JSON.stringify(copiedEmbed);
|
||||
const matchResult = await matchFn(str);
|
||||
if (matchResult) {
|
||||
return { type: "embed", str, userId: msg.user_id, messageInfo, matchedValue: matchResult };
|
||||
|
|
Loading…
Add table
Reference in a new issue