From 1882e5ffe3f20e3f30f5166926fd49d6e0bc1baa Mon Sep 17 00:00:00 2001 From: klemek Date: Mon, 11 Jan 2021 22:03:19 +0100 Subject: [PATCH] fixed custom emoji in composition scan --- src/scanners/composition_scanner.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/scanners/composition_scanner.py b/src/scanners/composition_scanner.py index 75efbc7..3e40c55 100644 --- a/src/scanners/composition_scanner.py +++ b/src/scanners/composition_scanner.py @@ -55,12 +55,12 @@ class CompositionScanner(Scanner): emotes_found = emojis.regex.findall(message.content) without_emote = message.content for name in emotes_found: - if name not in compo.emotes: - if name not in emojis.unicode_list: - continue - compo.emotes[name] += 1 - i = without_emote.index(name) - without_emote = without_emote[:i] + without_emote[i + len(name) :] + if name in emojis.unicode_list or re.match( + r"(|:[\w\\-\~]+:)", name + ): + compo.emotes[name] += 1 + i = without_emote.index(name) + without_emote = without_emote[:i] + without_emote[i + len(name) :] if len(message.content.strip()) > 0 and len(without_emote.strip()) == 0: compo.emote_only += 1 if len(emotes_found) > 0: