MoreUserTags: Add chat moderator tag (#2424)

Co-authored-by: Vendicated <vendicated@riseup.net>
main
! Sleepy 6 months ago committed by GitHub
parent 81d3f5df1a
commit 97dd56ccda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -50,6 +50,7 @@ interface TagSettings {
MODERATOR_STAFF: TagSetting, MODERATOR_STAFF: TagSetting,
MODERATOR: TagSetting, MODERATOR: TagSetting,
VOICE_MODERATOR: TagSetting, VOICE_MODERATOR: TagSetting,
TRIAL_MODERATOR: TagSetting,
[k: string]: TagSetting; [k: string]: TagSetting;
} }
@ -93,6 +94,11 @@ const tags: Tag[] = [
displayName: "VC Mod", displayName: "VC Mod",
description: "Can manage voice chats", description: "Can manage voice chats",
permissions: ["MOVE_MEMBERS", "MUTE_MEMBERS", "DEAFEN_MEMBERS"] permissions: ["MOVE_MEMBERS", "MUTE_MEMBERS", "DEAFEN_MEMBERS"]
}, {
name: "CHAT_MODERATOR",
displayName: "Chat Mod",
description: "Can timeout people",
permissions: ["MODERATE_MEMBERS"]
} }
]; ];
const defaultSettings = Object.fromEntries( const defaultSettings = Object.fromEntries(
@ -263,34 +269,14 @@ export default definePlugin({
], ],
start() { start() {
if (settings.store.tagSettings) return; settings.store.tagSettings ??= defaultSettings;
// @ts-ignore
if (!settings.store.visibility_WEBHOOK) settings.store.tagSettings = defaultSettings; // newly added field might be missing from old users
else { settings.store.tagSettings.CHAT_MODERATOR ??= {
const newSettings = { ...defaultSettings }; text: "Chat Mod",
Object.entries(Vencord.PlainSettings.plugins.MoreUserTags).forEach(([name, value]) => { showInChat: true,
const [setting, tag] = name.split("_"); showInNotChat: true
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];
});
}
}, },
getPermissions(user: User, channel: Channel): string[] { getPermissions(user: User, channel: Channel): string[] {

Loading…
Cancel
Save