Update RemoveBlockedMessages.plugin.js
This commit is contained in:
parent
51feb20806
commit
33ba5b2cdb
|
@ -5,12 +5,12 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "RemoveBlockedMessages",
|
||||
"author": "DevilBro",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.9",
|
||||
"description": "Completely removes blocked messages."
|
||||
},
|
||||
"changeLog": {
|
||||
"fixed": {
|
||||
"Hide Users": "Also hides user icons in the voice channel overview",
|
||||
"Hide Users": "Also hides user icons in the voice channel overview & in the autocomplete menu",
|
||||
"Role Group Count": "Fixes role group count for hidden banned users"
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,9 @@ module.exports = (_ => {
|
|||
this.patchedModules = {
|
||||
before: {
|
||||
ChannelMembers: "render",
|
||||
PrivateChannelRecipients: "default",
|
||||
VoiceUsers: "render",
|
||||
PrivateChannel: "render",
|
||||
PrivateChannelCallParticipants: "render",
|
||||
ChannelCall: "render",
|
||||
UserSummaryItem: "render"
|
||||
|
@ -69,6 +71,8 @@ module.exports = (_ => {
|
|||
VoiceUser: "render"
|
||||
}
|
||||
};
|
||||
|
||||
this.patchPriority = 10;
|
||||
}
|
||||
|
||||
onStart() {
|
||||
|
@ -96,6 +100,10 @@ module.exports = (_ => {
|
|||
}
|
||||
}});
|
||||
|
||||
if (BDFDB.LibraryModules.AutocompleteOptions && BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS) BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS.MENTIONS, "queryResults", {after: e => {
|
||||
if (settings.removeUsers) e.returnValue.users = e.returnValue.users.filter(n => !n.user || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.user.id));
|
||||
}});
|
||||
|
||||
this.forceUpdateAll();
|
||||
}
|
||||
|
||||
|
@ -146,7 +154,7 @@ module.exports = (_ => {
|
|||
let messages = messagesIns.props.messages;
|
||||
messagesIns.props.messages = new BDFDB.DiscordObjects.Messages(messages);
|
||||
for (let key in messages) messagesIns.props.messages[key] = messages[key];
|
||||
messagesIns.props.messages._array = [].concat(messagesIns.props.messages._array.filter(n => n.author && !BDFDB.LibraryModules.FriendUtils.isBlocked(n.author.id)));
|
||||
messagesIns.props.messages._array = [].concat(messagesIns.props.messages._array.filter(n => !n.author || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.author.id)));
|
||||
if (messagesIns.props.oldestUnreadMessageId && messagesIns.props.messages._array.every(n => n.id != messagesIns.props.oldestUnreadMessageId)) messagesIns.props.oldestUnreadMessageId = null;
|
||||
}
|
||||
}
|
||||
|
@ -181,6 +189,10 @@ module.exports = (_ => {
|
|||
}
|
||||
}
|
||||
|
||||
processPrivateChannelRecipients (e) {
|
||||
if (settings.removeUsers && e.instance.props.channel && e.instance.props.channel.isGroupDM()) e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.FriendUtils.isBlocked(id))}));
|
||||
}
|
||||
|
||||
processMemberListItem (e) {
|
||||
if (settings.removeUsers && e.instance.props.user && BDFDB.LibraryModules.FriendUtils.isBlocked(e.instance.props.user.id)) return null;
|
||||
}
|
||||
|
@ -193,6 +205,10 @@ module.exports = (_ => {
|
|||
if (settings.removeUsers && e.instance.props.user && BDFDB.LibraryModules.FriendUtils.isBlocked(e.instance.props.user.id)) return null;
|
||||
}
|
||||
|
||||
processPrivateChannel (e) {
|
||||
if (settings.removeUsers && e.instance.props.channel && e.instance.props.channel.isGroupDM()) e.instance.props.channel = new BDFDB.DiscordObjects.Channel(Object.assign({}, e.instance.props.channel, {rawRecipients: e.instance.props.channel.rawRecipients.filter(n => !n || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.id)), recipients: e.instance.props.channel.recipients.filter(id => !id || !BDFDB.LibraryModules.FriendUtils.isBlocked(id))}));
|
||||
}
|
||||
|
||||
processPrivateChannelCallParticipants (e) {
|
||||
if (settings.removeUsers && BDFDB.ArrayUtils.is(e.instance.props.participants)) e.instance.props.participants = [].concat(e.instance.props.participants).filter(n => !n.user || !BDFDB.LibraryModules.FriendUtils.isBlocked(n.user.id));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue