3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-14 21:31:50 +00:00

Fix starboard and spam plugins not detecting animated emoji

This commit is contained in:
Dragory 2019-01-06 12:30:52 +02:00
parent 5b800bb443
commit dced441d09
2 changed files with 7 additions and 5 deletions

View file

@ -99,9 +99,11 @@ export class StarboardPlugin extends ZeppelinPlugin {
}
emoji = allEmojis[0];
if (emoji.match(customEmojiRegex)) {
const customEmojiMatch = emoji.match(customEmojiRegex);
if (customEmojiMatch) {
// <:name:id> to name:id, as Eris puts them in the message reactions object
emoji = emoji.substr(2, emoji.length - 1);
emoji = `${customEmojiMatch[1]}:${customEmojiMatch[2]}`;
}
} while (emoji == null);

View file

@ -168,10 +168,10 @@ export function getInviteCodesInString(str: string): string[] {
}
export const unicodeEmojiRegex = emojiRegex();
export const customEmojiRegex = /<:(?:.*?):(\d+)>/;
export const anyEmojiRegex = new RegExp(`(?:(?:${unicodeEmojiRegex.source})|(?:${customEmojiRegex.source}))`);
export const customEmojiRegex = /<a?:(.*?):(\d+)>/;
const matchAllEmojiRegex = new RegExp(`(${unicodeEmojiRegex.source})|(${customEmojiRegex.source})`, "g");
const matchAllEmojiRegex = new RegExp(anyEmojiRegex.source, "g");
export function getEmojiInString(str: string): string[] {
return str.match(matchAllEmojiRegex) || [];
}