diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-17 20:03:05 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-17 20:03:05 -0400 |
commit | e1c613829950a534d9f45c00a033b83575be3b3c (patch) | |
tree | 2de1e5231217211ae4087c46cc74dc46c584507a /src/commands/config | |
parent | 0e87bbd3940d89defcb04926587b35c8f4d1947f (diff) | |
download | tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.gz tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.bz2 tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.zip |
remove global client variable
Diffstat (limited to 'src/commands/config')
-rw-r--r-- | src/commands/config/_customAutomodPhrases.ts | 2 | ||||
-rw-r--r-- | src/commands/config/blacklist.ts | 8 | ||||
-rw-r--r-- | src/commands/config/config.ts | 10 | ||||
-rw-r--r-- | src/commands/config/disable.ts | 8 | ||||
-rw-r--r-- | src/commands/config/features.ts | 2 |
5 files changed, 13 insertions, 17 deletions
diff --git a/src/commands/config/_customAutomodPhrases.ts b/src/commands/config/_customAutomodPhrases.ts index d60688c..0b571e5 100644 --- a/src/commands/config/_customAutomodPhrases.ts +++ b/src/commands/config/_customAutomodPhrases.ts @@ -1,4 +1,4 @@ -// import { BushCommand, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; +// import { BushCommand, clientSendAndPermCheck, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; // import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js'; // export default class CustomAutomodPhrasesCommand extends BushCommand { diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index 80acd0b..6768a1c 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -6,8 +6,6 @@ import { clientSendAndPermCheck, emojis, format, - getGlobal, - setGlobal, type ArgType, type CommandMessage, type SlashMessage @@ -83,10 +81,10 @@ export default class BlacklistCommand extends BushCommand { if (!global) assert(message.inGuild()); const blacklistedUsers = global - ? getGlobal('blacklistedUsers') + ? this.client.utils.getGlobal('blacklistedUsers') : (await message.guild!.getSetting('blacklistedChannels')) ?? []; const blacklistedChannels = global - ? getGlobal('blacklistedChannels') + ? this.client.utils.getGlobal('blacklistedChannels') : (await message.guild!.getSetting('blacklistedUsers')) ?? []; if (action === 'toggle') { action = blacklistedUsers.includes(targetID) || blacklistedChannels.includes(targetID) ? 'unblacklist' : 'blacklist'; @@ -100,7 +98,7 @@ export default class BlacklistCommand extends BushCommand { const key = target instanceof User ? 'blacklistedUsers' : 'blacklistedChannels'; const success = await (global - ? setGlobal(key, newValue) + ? this.client.utils.setGlobal(key, newValue) : message.guild!.setSetting(key, newValue, message.member as GuildMember) ).catch(() => false); diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index f0db467..66e10b6 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -6,9 +6,7 @@ import { emojis, GuildNoArraySetting, guildSettingsObj, - inspectAndRedact, oxford, - prefix, settingsArr, type ArgType, type CommandMessage, @@ -284,7 +282,7 @@ export default class ConfigCommand extends BushCommand { }); collector.on('collect', async (interaction: MessageComponentInteraction) => { - if (interaction.user.id === message.author.id || client.config.owners.includes(interaction.user.id)) { + if (interaction.user.id === message.author.id || this.client.config.owners.includes(interaction.user.id)) { assert(message.inGuild()); switch (interaction.customId) { @@ -346,7 +344,7 @@ export default class ConfigCommand extends BushCommand { const func = ((): ((v: string | any) => string) => { switch (type.replace('-array', '') as BaseSettingTypes) { case 'string': - return (v) => inspectAndRedact(v); + return (v) => this.client.utils.inspectAndRedact(v); case 'channel': return (v) => `<#${v}>`; case 'role': @@ -354,7 +352,7 @@ export default class ConfigCommand extends BushCommand { case 'user': return (v) => `<@${v}>`; case 'custom': - return inspectAndRedact; + return this.client.utils.inspectAndRedact; default: return (v) => v; } @@ -377,7 +375,7 @@ export default class ConfigCommand extends BushCommand { ); settingsEmbed.setFooter({ - text: `Run "${prefix(message)}${message.util.parsed?.alias ?? 'config'} ${ + text: `Run "${this.client.utils.prefix(message)}${message.util.parsed?.alias ?? 'config'} ${ message.util.isSlash ? snakeCase(setting) : setting } ${guildSettingsObj[setting].type.includes('-array') ? 'add/remove' : 'set'} <value>" to set this setting.` }); diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index 4f52b7c..e9866d5 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -5,8 +5,6 @@ import { BushCommand, clientSendAndPermCheck, emojis, - getGlobal, - setGlobal, type ArgType, type CommandMessage, type SlashMessage @@ -81,12 +79,14 @@ export default class DisableCommand extends BushCommand { if (DisableCommand.blacklistedCommands.includes(commandID)) return message.util.send(`${emojis.error} the ${commandID} command cannot be disabled.`); - const disabledCommands = global ? getGlobal('disabledCommands') : await message.guild.getSetting('disabledCommands'); + const disabledCommands = global + ? this.client.utils.getGlobal('disabledCommands') + : await message.guild.getSetting('disabledCommands'); if (action === 'toggle') action = disabledCommands.includes(commandID) ? 'disable' : 'enable'; const newValue = addOrRemoveFromArray(action === 'disable' ? 'add' : 'remove', disabledCommands, commandID); const success = global - ? await setGlobal('disabledCommands', newValue).catch(() => false) + ? await this.client.utils.setGlobal('disabledCommands', newValue).catch(() => false) : await message.guild.setSetting('disabledCommands', newValue, message.member!).catch(() => false); if (!success) return await message.util.reply({ diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index e88f4b7..affcde3 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -51,7 +51,7 @@ export default class FeaturesCommand extends BushCommand { }); collector.on('collect', async (interaction: SelectMenuInteraction) => { - if (interaction.user.id === message.author.id || client.config.owners.includes(interaction.user.id)) { + if (interaction.user.id === message.author.id || this.client.config.owners.includes(interaction.user.id)) { assert(message.inGuild()); const [selected]: GuildFeatures[] = interaction.values as GuildFeatures[]; |