3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Fix over-eager matching for YouTube embeds

This commit is contained in:
Dragory 2020-05-22 23:44:21 +03:00
parent 53a9c58dd4
commit 2ad10129fa
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -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 };