Update RemoveBlockedMessages.plugin.js

This commit is contained in:
Mirco Wittrien 2021-02-09 18:56:44 +01:00
parent 96a4446c50
commit e510033f7b
1 changed files with 23 additions and 24 deletions

View File

@ -14,12 +14,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "RemoveBlockedMessages", "name": "RemoveBlockedMessages",
"author": "DevilBro", "author": "DevilBro",
"version": "1.2.2", "version": "1.2.3",
"description": "Completely removes blocked messages" "description": "Completely removes blocked messages"
}, },
"changeLog": { "changeLog": {
"fixed": { "fixed": {
"Update Reactions": "Fixed issue where reaction sometimes wouldn't show up at all" "Update Reactions": "Fixed issue where reaction sometimes wouldn't show up at all, really now"
} }
} }
}; };
@ -275,9 +275,9 @@ module.exports = (_ => {
reaction.props.count = cachedReactions[reaction.props.message.id][emojiId].reactions.length; reaction.props.count = cachedReactions[reaction.props.message.id][emojiId].reactions.length;
if (reaction.props.count < 1) e.returnvalue.props.children[0][i] = null; if (reaction.props.count < 1) e.returnvalue.props.children[0][i] = null;
} }
else { else BDFDB.LibraryModules.ReactionUtils.getReactions(reaction.props.message.channel_id, reaction.props.message.id, reaction.props.emoji).then(reactions => {
if (!reactions || !reactions.length) return;
let someBlocked = false; let someBlocked = false;
BDFDB.LibraryModules.ReactionUtils.getReactions(reaction.props.message.channel_id, reaction.props.message.id, reaction.props.emoji).then(reactions => {
let filteredReactions = reactions.filter(n => { let filteredReactions = reactions.filter(n => {
let isBlocked = n && BDFDB.LibraryModules.FriendUtils.isBlocked(n.id); let isBlocked = n && BDFDB.LibraryModules.FriendUtils.isBlocked(n.id);
someBlocked = someBlocked || isBlocked; someBlocked = someBlocked || isBlocked;
@ -299,7 +299,6 @@ module.exports = (_ => {
}; };
}); });
} }
}
if (!e.returnvalue.props.children[0].filter(n => n).length) return null; if (!e.returnvalue.props.children[0].filter(n => n).length) return null;
} }
} }