From b96eab194bb621634a85feca41b117c7971d60c5 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:45:52 +1100 Subject: [PATCH] Retire the `Bot Tech` role (#92) * Discontinue Bot Tech role * Remove autoresponses for Monster --- src/commands/dev.ts | 2 +- src/commands/mp.ts | 14 +++++++------- src/commands/suggest.ts | 4 ++-- src/config.json | 1 - src/helpers/MessageTool.ts | 1 + src/interfaces.d.ts | 1 - 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/commands/dev.ts b/src/commands/dev.ts index a00837c..4417f43 100644 --- a/src/commands/dev.ts +++ b/src/commands/dev.ts @@ -9,7 +9,7 @@ import util from 'node:util'; import fs from 'node:fs'; export default class Developer { static run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>) { - if (!client.config.whitelist.includes(interaction.user.id)) return MessageTool.youNeedRole(interaction, 'bottech'); + if (!client.config.whitelist.includes(interaction.member.id)) return MessageTool.isWhitelisted(interaction); ({ eval: async()=>{ fs; diff --git a/src/commands/mp.ts b/src/commands/mp.ts index 70de466..c372fb5 100644 --- a/src/commands/mp.ts +++ b/src/commands/mp.ts @@ -118,7 +118,7 @@ export default class MP { }, maintenance: async()=>{ if (client.config.dcServer.id === interaction.guildId) { - if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmod'); + if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmod'); } const reason = interaction.options.getString('reason'); @@ -133,7 +133,7 @@ export default class MP { }, start: async()=>{ if (client.config.dcServer.id === interaction.guildId) { - if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmod'); + if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmod'); } const map_names = interaction.options.getString('map_names', true).split('|'); if (map_names.length > 10) return interaction.reply('You can only have up to 10 maps in a poll!'); @@ -150,7 +150,7 @@ export default class MP { }, end: async()=>{ if (client.config.dcServer.id === interaction.guildId) { - if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmod'); + if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmod'); } const msg_id = interaction.options.getString('message_id', true); const stripUrl = msg_id.replace(/https:\/\/discord.com\/channels\/\d+\/\d+\/(\d+)/, '$1'); @@ -172,14 +172,14 @@ export default class MP { }, maps: async()=>{ if (client.config.dcServer.id === interaction.guildId) { - if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmod'); + if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmod) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmod'); } const suggestionPool = await (interaction.guild.channels.cache.get(client.config.dcServer.channels.mpmod_chat) as Discord.TextChannel).messages.fetch(MAP_POOL_HOOKMSG); interaction.reply({embeds: [suggestionPool.embeds[0]]}); }, // Server management group create_server: async()=>{ if (client.config.dcServer.id === interaction.guildId) { - if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmanager'); + if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmanager'); } const dedicatedServerStatsURL = interaction.options.getString('dss-url'); if (!dedicatedServerStatsURL) { @@ -201,7 +201,7 @@ export default class MP { }, remove_server: async()=>{ if (client.config.dcServer.id === interaction.guildId) { - if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmanager'); + if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmanager'); } try { Logger.console('log', logPrefix, `Removing "${choiceSelector}" from database`) @@ -214,7 +214,7 @@ export default class MP { }, visibility_toggle: async()=>{ if (client.config.dcServer.id === interaction.guildId) { - if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'mpmanager'); + if (!interaction.member.roles.cache.has(client.config.dcServer.roles.mpmanager) && !client.config.whitelist.includes(interaction.member.id)) return MessageTool.youNeedRole(interaction, 'mpmanager'); } const toggleFlag = interaction.options.getBoolean('is_active'); Logger.console('log', logPrefix, `Toggling isActive flag for "${choiceSelector}" to ${toggleFlag}`); diff --git a/src/commands/suggest.ts b/src/commands/suggest.ts index 20f45b5..3944b54 100644 --- a/src/commands/suggest.ts +++ b/src/commands/suggest.ts @@ -14,7 +14,7 @@ export default class Suggest { }, delete: async()=>{ if (client.config.dcServer.id === interaction.guildId) { - if (!interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'bottech'); + if (!client.config.whitelist.includes(interaction.member.id)) return MessageTool.isWhitelisted(interaction); } const sugg = await this.deleteSuggestion(client, idVal); if (sugg) return interaction.reply(`Suggestion \`#${idVal}\` has been deleted.`); @@ -22,7 +22,7 @@ export default class Suggest { }, update: async()=>{ if (client.config.dcServer.id === interaction.guildId) { - if (!interaction.member.roles.cache.has(client.config.dcServer.roles.bottech)) return MessageTool.youNeedRole(interaction, 'bottech'); + if (!client.config.whitelist.includes(interaction.member.id)) return MessageTool.isWhitelisted(interaction); } const status = interaction.options.getString('status', true); await this.updateSuggestion(client, idVal, status as 'Accepted'|'Rejected'); diff --git a/src/config.json b/src/config.json index dc0976c..af50d1b 100644 --- a/src/config.json +++ b/src/config.json @@ -61,7 +61,6 @@ ], "roles": { "admin": "468842789053136897", - "bottech": "1011341005389307925", "dcmod": "468841295150972929", "mpmanager": "1028735939813585029", "mpmod": "572151330710487041", diff --git a/src/helpers/MessageTool.ts b/src/helpers/MessageTool.ts index f46f428..55c2f89 100644 --- a/src/helpers/MessageTool.ts +++ b/src/helpers/MessageTool.ts @@ -14,4 +14,5 @@ export default class MessageTool { public static isStaff =(guildMember:Discord.GuildMember)=>config.dcServer.staffRoles.map((x:string)=>config.dcServer.roles[x]).some((x:string)=>guildMember.roles.cache.has(x)); public static youNeedRole =(interaction:Discord.CommandInteraction, role:keyof typeof config.dcServer.roles)=>interaction.reply(`You do not have ${this.formatMention(config.dcServer.roles[role], 'role')} role to use this command.`); public static isModerator =(guildMember:Discord.GuildMember)=>config.dcServer.staffRoles.filter((x:string)=>/^admin|^dcmod/.test(x)).map((x:string)=>config.dcServer.roles[x]).some((x:string)=>guildMember.roles.cache.has(x)); + public static isWhitelisted =(interaction:Discord.CommandInteraction)=>interaction.reply('You are not on whitelist!') } diff --git a/src/interfaces.d.ts b/src/interfaces.d.ts index 45210e6..64425de 100644 --- a/src/interfaces.d.ts +++ b/src/interfaces.d.ts @@ -136,7 +136,6 @@ export interface Config { staffRoles: string[], roles: { admin: string, - bottech: string, dcmod: string, mpmanager: string, mpmod: string,