From 1340f023a3c7f5e16e9fc476c7198a6afaa2f475 Mon Sep 17 00:00:00 2001 From: Luca Zeuch Date: Fri, 14 Jul 2023 18:21:29 +0200 Subject: [PATCH] feat(MessageLogger): add option to ignore channels and guilds (#1420) --- src/plugins/messageLogger/index.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index 2041f70f..162db544 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -152,14 +152,24 @@ export default definePlugin({ type: OptionType.STRING, description: "Comma-separated list of user IDs to ignore", default: "" - } + }, + ignoreChannels: { + type: OptionType.STRING, + description: "Comma-separated list of channel IDs to ignore", + default: "" + }, + ignoreGuilds: { + type: OptionType.STRING, + description: "Comma-separated list of guild IDs to ignore", + default: "" + }, }, handleDelete(cache: any, data: { ids: string[], id: string; mlDeleted?: boolean; }, isBulk: boolean) { try { if (cache == null || (!isBulk && !cache.has(data.id))) return cache; - const { ignoreBots, ignoreSelf, ignoreUsers } = Settings.plugins.MessageLogger; + const { ignoreBots, ignoreSelf, ignoreUsers, ignoreChannels, ignoreGuilds } = Settings.plugins.MessageLogger; const myId = UserStore.getCurrentUser().id; function mutate(id: string) { @@ -171,7 +181,9 @@ export default definePlugin({ (msg.flags & EPHEMERAL) === EPHEMERAL || ignoreBots && msg.author?.bot || ignoreSelf && msg.author?.id === myId || - ignoreUsers.includes(msg.author?.id); + ignoreUsers.includes(msg.author?.id) || + ignoreChannels.includes(msg.channel_id) || + ignoreGuilds.includes(msg.guild_id); if (shouldIgnore) { cache = cache.remove(id);