Skip to content

Commit

Permalink
discord: accept animated avatars in matcher
Browse files Browse the repository at this point in the history
Discord avatarId can contain underscores when the image is animated (it
has prefix a_ when that happens).

Fixes runelite#14594

Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam authored Jan 17, 2022
1 parent f859ec9 commit 4410e17
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,10 @@ public void onDiscordUserInfo(final DiscordUserInfo event)
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;
Expand Down

0 comments on commit 4410e17

Please sign in to comment.