discord: accept animated avatars in matcher

Discord avatarId can contain underscores when the image is animated (it
has prefix a_ when that happens).

Fixes #14594

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2022-01-17 19:26:02 +01:00
committed by GitHub
parent f859ec9dc8
commit 4410e173e3

View File

@@ -233,8 +233,10 @@ public class DiscordPlugin extends Plugin
return;
}
CharMatcher matcher = CharMatcher.anyOf("abcdef0123456789");
if (!matcher.matchesAllOf(event.getUserId()) || !matcher.matchesAllOf(event.getAvatarId()))
final CharMatcher matcher = CharMatcher.anyOf("abcdef0123456789");
// animated avatars contain a_ as prefix so we need to get rid of that first to check against matcher
if (!matcher.matchesAllOf(event.getUserId()) || !matcher.matchesAllOf(event.getAvatarId().replace("a_", "")))
{
// userid is actually a snowflake, but the matcher is sufficient
return;