From 11c08a1a8697f70f5cfc3942f14ded78393c894b Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Thu, 27 Apr 2023 09:24:15 +0200 Subject: [PATCH] Update ShowBadgesInChat.plugin.js --- Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js b/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js index 426a4da1a3..a59a16684b 100644 --- a/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js +++ b/Plugins/ShowBadgesInChat/ShowBadgesInChat.plugin.js @@ -2,7 +2,7 @@ * @name ShowBadgesInChat * @author DevilBro * @authorId 278543574059057154 - * @version 1.9.8 + * @version 1.9.9 * @description Displays Badges (Nitro, Hypesquad, etc...) in the Chat/MemberList/DMList * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -204,6 +204,10 @@ module.exports = (_ => { userCopy.premium_guild_since = data.premium_guild_since; loadedUsers[id] = BDFDB.ObjectUtils.extract(userCopy, "flags", "premium_since", "premium_guild_since"); loadedUsers[id].date = (new Date()).getTime(); + if (data.badges) for (let badge of data.badges) { + let userFlag = BDFDB.DiscordConstants.UserFlags[(userBadgeFlagNameMap[badge.id] || badge.id || "").toUpperCase()]; + if (userFlag && (loadedUsers[id].flags | userFlag) != loadedUsers[id].flags) loadedUsers[id].flags += userFlag; + } BDFDB.TimeUtils.clear(cacheTimeout); cacheTimeout = BDFDB.TimeUtils.timeout(_ => BDFDB.DataUtils.save(loadedUsers, this, "badgeCache"), 5000);