From a1737f44e1643108a809b539cafdb0f8316e85ce Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:01:52 +1100 Subject: [PATCH 1/2] Discontinue Bot Tech role --- 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 43c93ee..3ad5b03 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, From 29437ef5d7dc98202d10919fab60254eb5682ec0 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:26:48 +1100 Subject: [PATCH 2/2] Remove autoresponses for Monster --- src/events/messageCreate.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index b4c7eb8..832ec45 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -93,11 +93,6 @@ export default class MessageCreate { user: 'nawdic', img: 'https://c.tenor.com/JSj9ie_MD9kAAAAC/kopfsch%C3%BCtteln-an-kopf-fassen-oh-no.gif', title: '*Nawdic has done an oopsie*', - }, - { - user: 'monster', - img: 'https://media.tenor.com/ZIzIjb_wvEoAAAAC/face-palm.gif', - title: '*Monster has broken something*', } ]; let dontMention = [ @@ -105,11 +100,6 @@ export default class MessageCreate { user_id: '309373272594579456', message: 'Please don\'t tag Daggerwin, read rule 14 in <#468846117405196289>', type: undefined - }, - { - user_id: '215497515934416896', - message: 'Please don\'t tag Monster unless it\'s important!', - type: Discord.MessageType.Default } ]