From 97dd56ccdab091ba65b6e25efd172b0464b191d5 Mon Sep 17 00:00:00 2001 From: ! Sleepy <109904491+eepyfemboi@users.noreply.github.com> Date: Tue, 14 May 2024 17:17:19 -0700 Subject: [PATCH] MoreUserTags: Add chat moderator tag (#2424) Co-authored-by: Vendicated --- src/plugins/moreUserTags/index.tsx | 42 ++++++++++-------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/src/plugins/moreUserTags/index.tsx b/src/plugins/moreUserTags/index.tsx index df47e545..1257b452 100644 --- a/src/plugins/moreUserTags/index.tsx +++ b/src/plugins/moreUserTags/index.tsx @@ -50,6 +50,7 @@ interface TagSettings { MODERATOR_STAFF: TagSetting, MODERATOR: TagSetting, VOICE_MODERATOR: TagSetting, + TRIAL_MODERATOR: TagSetting, [k: string]: TagSetting; } @@ -93,6 +94,11 @@ const tags: Tag[] = [ displayName: "VC Mod", description: "Can manage voice chats", permissions: ["MOVE_MEMBERS", "MUTE_MEMBERS", "DEAFEN_MEMBERS"] + }, { + name: "CHAT_MODERATOR", + displayName: "Chat Mod", + description: "Can timeout people", + permissions: ["MODERATE_MEMBERS"] } ]; const defaultSettings = Object.fromEntries( @@ -263,34 +269,14 @@ export default definePlugin({ ], start() { - if (settings.store.tagSettings) return; - // @ts-ignore - if (!settings.store.visibility_WEBHOOK) settings.store.tagSettings = defaultSettings; - else { - const newSettings = { ...defaultSettings }; - Object.entries(Vencord.PlainSettings.plugins.MoreUserTags).forEach(([name, value]) => { - const [setting, tag] = name.split("_"); - if (setting === "visibility") { - switch (value) { - case "always": - // its the default - break; - case "chat": - newSettings[tag].showInNotChat = false; - break; - case "not-chat": - newSettings[tag].showInChat = false; - break; - case "never": - newSettings[tag].showInChat = false; - newSettings[tag].showInNotChat = false; - break; - } - } - settings.store.tagSettings = newSettings; - delete Vencord.Settings.plugins.MoreUserTags[name]; - }); - } + settings.store.tagSettings ??= defaultSettings; + + // newly added field might be missing from old users + settings.store.tagSettings.CHAT_MODERATOR ??= { + text: "Chat Mod", + showInChat: true, + showInNotChat: true + }; }, getPermissions(user: User, channel: Channel): string[] {