Update ShowBadgesInChat.plugin.js
This commit is contained in:
parent
6364e769fb
commit
11c08a1a86
|
@ -2,7 +2,7 @@
|
||||||
* @name ShowBadgesInChat
|
* @name ShowBadgesInChat
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.9.8
|
* @version 1.9.9
|
||||||
* @description Displays Badges (Nitro, Hypesquad, etc...) in the Chat/MemberList/DMList
|
* @description Displays Badges (Nitro, Hypesquad, etc...) in the Chat/MemberList/DMList
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -204,6 +204,10 @@ module.exports = (_ => {
|
||||||
userCopy.premium_guild_since = data.premium_guild_since;
|
userCopy.premium_guild_since = data.premium_guild_since;
|
||||||
loadedUsers[id] = BDFDB.ObjectUtils.extract(userCopy, "flags", "premium_since", "premium_guild_since");
|
loadedUsers[id] = BDFDB.ObjectUtils.extract(userCopy, "flags", "premium_since", "premium_guild_since");
|
||||||
loadedUsers[id].date = (new Date()).getTime();
|
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);
|
BDFDB.TimeUtils.clear(cacheTimeout);
|
||||||
cacheTimeout = BDFDB.TimeUtils.timeout(_ => BDFDB.DataUtils.save(loadedUsers, this, "badgeCache"), 5000);
|
cacheTimeout = BDFDB.TimeUtils.timeout(_ => BDFDB.DataUtils.save(loadedUsers, this, "badgeCache"), 5000);
|
||||||
|
|
Loading…
Reference in New Issue