Fix starboard and spam plugins not detecting animated emoji
This commit is contained in:
parent
5b800bb443
commit
dced441d09
2 changed files with 7 additions and 5 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) || [];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue