From 4410e173e32f3cb992790dd0cc78cc6147236ed5 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Mon, 17 Jan 2022 19:26:02 +0100 Subject: [PATCH] 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 --- .../net/runelite/client/plugins/discord/DiscordPlugin.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java index a4bb4c7d1e..031ba10941 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java @@ -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;