diff options
Diffstat (limited to 'src/commands/config')
-rw-r--r-- | src/commands/config/autoPublishChannel.ts | 4 | ||||
-rw-r--r-- | src/commands/config/blacklist.ts | 16 | ||||
-rw-r--r-- | src/commands/config/disable.ts | 16 | ||||
-rw-r--r-- | src/commands/config/muteRole.ts | 2 | ||||
-rw-r--r-- | src/commands/config/prefix.ts | 8 | ||||
-rw-r--r-- | src/commands/config/punishmentFooter.ts | 8 | ||||
-rw-r--r-- | src/commands/config/welcomeChannel.ts | 8 |
7 files changed, 28 insertions, 34 deletions
diff --git a/src/commands/config/autoPublishChannel.ts b/src/commands/config/autoPublishChannel.ts index a2692e2..8fa987b 100644 --- a/src/commands/config/autoPublishChannel.ts +++ b/src/commands/config/autoPublishChannel.ts @@ -40,14 +40,14 @@ export default class AutoPublishChannelCommand extends BushCommand { public async exec(message: BushMessage, { channel }: { channel: Channel }): Promise<unknown> { const autoPublishChannels = await message.guild.getSetting('autoPublishChannels'); - const newValue = this.client.util.addOrRemoveFromArray( + const newValue = util.addOrRemoveFromArray( autoPublishChannels.includes(channel.id) ? 'remove' : 'add', autoPublishChannels, channel.id ); await message.guild.setSetting('autoPublishChannels', newValue); return await message.util.reply({ - content: `${this.client.util.emojis.success} Successfully ${ + content: `${util.emojis.success} Successfully ${ autoPublishChannels.includes(channel.id) ? 'disabled' : 'enabled' } auto publishing in <#${channel.id}>.`, allowedMentions: AllowedMentions.none() diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index 5696c40..33bff35 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -72,7 +72,7 @@ export default class BlacklistCommand extends BushCommand { ? (await Argument.cast('channel', this.client.commandHandler.resolver, message as BushMessage, args.target)) ?? (await Argument.cast('user', this.client.commandHandler.resolver, message as BushMessage, args.target)) : args.target; - if (!target) return await message.util.reply(`${this.client.util.emojis.error} Choose a valid channel or user.`); + if (!target) return await message.util.reply(`${util.emojis.error} Choose a valid channel or user.`); const targetID = target.id; if (global) { @@ -81,7 +81,7 @@ export default class BlacklistCommand extends BushCommand { const blacklistedChannels = (await Global.findByPk(this.client.config.environment)).blacklistedChannels; action = blacklistedUsers.includes(targetID) || blacklistedChannels.includes(targetID) ? 'unblacklist' : 'blacklist'; } - const success = await this.client.util + const success = await util .insertOrRemoveFromGlobal( action === 'blacklist' ? 'add' : 'remove', target instanceof User ? 'blacklistedUsers' : 'blacklistedChannels', @@ -90,14 +90,12 @@ export default class BlacklistCommand extends BushCommand { .catch(() => false); if (!success) return await message.util.reply({ - content: `${this.client.util.emojis.error} There was an error globally **${action}ing** ${ - target?.tag ?? target.name - }.`, + content: `${util.emojis.error} There was an error globally **${action}ing** ${target?.tag ?? target.name}.`, allowedMentions: AllowedMentions.none() }); else return await message.util.reply({ - content: `${this.client.util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name} globally.`, + content: `${util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name} globally.`, allowedMentions: AllowedMentions.none() }); // guild disable @@ -107,7 +105,7 @@ export default class BlacklistCommand extends BushCommand { if (action === 'toggle') { action = blacklistedChannels.includes(targetID) ?? blacklistedUsers.includes(targetID) ? 'unblacklist' : 'blacklist'; } - const newValue = this.client.util.addOrRemoveFromArray( + const newValue = util.addOrRemoveFromArray( action === 'blacklist' ? 'add' : 'remove', target instanceof User ? blacklistedUsers : blacklistedChannels, targetID @@ -117,12 +115,12 @@ export default class BlacklistCommand extends BushCommand { .catch(() => false); if (!success) return await message.util.reply({ - content: `${this.client.util.emojis.error} There was an error **${action}ing** ${target?.tag ?? target.name}.`, + content: `${util.emojis.error} There was an error **${action}ing** ${target?.tag ?? target.name}.`, allowedMentions: AllowedMentions.none() }); else return await message.util.reply({ - content: `${this.client.util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name}.`, + content: `${util.emojis.success} Successfully **${action}ed** ${target?.tag ?? target.name}.`, allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index 00d2561..27e7311 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -75,12 +75,12 @@ export default class DisableCommand extends BushCommand { const disabledCommands = (await Global.findByPk(this.client.config.environment)).disabledCommands; action = disabledCommands.includes(commandID) ? 'disable' : 'enable'; } - const success = await this.client.util + const success = await util .insertOrRemoveFromGlobal(action === 'disable' ? 'remove' : 'add', 'disabledCommands', commandID) .catch(() => false); if (!success) return await message.util.reply({ - content: `${this.client.util.emojis.error} There was an error globally **${action.substr( + content: `${util.emojis.error} There was an error globally **${action.substr( 0, action.length - 2 )}ing** the **${commandID}** command.`, @@ -88,7 +88,7 @@ export default class DisableCommand extends BushCommand { }); else return await message.util.reply({ - content: `${this.client.util.emojis.success} Successfully **${action.substr( + content: `${util.emojis.success} Successfully **${action.substr( 0, action.length - 2 )}ed** the **${commandID}** command globally.`, @@ -101,15 +101,11 @@ export default class DisableCommand extends BushCommand { if (action === 'toggle') { action = disabledCommands.includes(commandID) ? 'disable' : 'enable'; } - const newValue = this.client.util.addOrRemoveFromArray( - action === 'disable' ? 'remove' : 'add', - disabledCommands, - commandID - ); + const newValue = util.addOrRemoveFromArray(action === 'disable' ? 'remove' : 'add', disabledCommands, commandID); const success = await message.guild.setSetting('disabledCommands', newValue).catch(() => false); if (!success) return await message.util.reply({ - content: `${this.client.util.emojis.error} There was an error **${action.substr( + content: `${util.emojis.error} There was an error **${action.substr( 0, action.length - 2 )}ing** the **${commandID}** command.`, @@ -117,7 +113,7 @@ export default class DisableCommand extends BushCommand { }); else return await message.util.reply({ - content: `${this.client.util.emojis.success} Successfully **${action.substr( + content: `${util.emojis.success} Successfully **${action.substr( 0, action.length - 2 )}ed** the **${commandID}** command.`, diff --git a/src/commands/config/muteRole.ts b/src/commands/config/muteRole.ts index 9074a1d..b6e8a81 100644 --- a/src/commands/config/muteRole.ts +++ b/src/commands/config/muteRole.ts @@ -40,7 +40,7 @@ export default class MuteRoleCommand extends BushCommand { async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<void> { await message.guild.setSetting('muteRole', args.role.id); await message.util.send({ - content: `${this.client.util.emojis.success} Changed the server's mute role to <@&${args.role.id}>.`, + content: `${util.emojis.success} Changed the server's mute role to <@&${args.role.id}>.`, allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/config/prefix.ts b/src/commands/config/prefix.ts index 380442b..26ae5c4 100644 --- a/src/commands/config/prefix.ts +++ b/src/commands/config/prefix.ts @@ -41,14 +41,14 @@ export default class PrefixCommand extends BushCommand { await message.guild.setSetting('prefix', args.prefix ?? this.client.config.prefix); if (args.prefix) { return await message.util.send({ - content: `${this.client.util.emojis.success} changed the server's prefix ${ - oldPrefix ? `from \`${oldPrefix}\`` : '' - } to \`${args.prefix}\`.`, + content: `${util.emojis.success} changed the server's prefix ${oldPrefix ? `from \`${oldPrefix}\`` : ''} to \`${ + args.prefix + }\`.`, allowedMentions: AllowedMentions.none() }); } else { return await message.util.send({ - content: `${this.client.util.emojis.success} reset the server's prefix to \`${this.client.config.prefix}\`.`, + content: `${util.emojis.success} reset the server's prefix to \`${this.client.config.prefix}\`.`, allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/config/punishmentFooter.ts b/src/commands/config/punishmentFooter.ts index 6b2759a..eeac6c1 100644 --- a/src/commands/config/punishmentFooter.ts +++ b/src/commands/config/punishmentFooter.ts @@ -42,11 +42,11 @@ export default class PunishmentFooterCommand extends BushCommand { await message.guild.setSetting('punishmentEnding', args.ending || null); if (args.ending) return await message.util.send({ - content: `${ - this.client.util.emojis.success - } Changed the server's punishment footer to \n\`\`\`${Util.cleanCodeBlockContent(args.ending)}\`\`\`.`, + content: `${util.emojis.success} Changed the server's punishment footer to \n\`\`\`${Util.cleanCodeBlockContent( + args.ending + )}\`\`\`.`, allowedMentions: AllowedMentions.none() }); - else return await message.util.send(`${this.client.util.emojis.success} Removed he server's punishment footer.`); + else return await message.util.send(`${util.emojis.success} Removed he server's punishment footer.`); } } diff --git a/src/commands/config/welcomeChannel.ts b/src/commands/config/welcomeChannel.ts index 488a0a9..3db9e74 100644 --- a/src/commands/config/welcomeChannel.ts +++ b/src/commands/config/welcomeChannel.ts @@ -41,12 +41,12 @@ export default class WelcomeChannelCommand extends BushCommand { await message.guild.setSetting('welcomeChannel', args.channel.id ?? undefined); if (args.channel) { return await message.util.send( - `${this.client.util.emojis.success} changed the server's welcome channel ${ - oldChannel ? `from <#${oldChannel}>` : '' - } to <#${args.channel.id}>.` + `${util.emojis.success} changed the server's welcome channel ${oldChannel ? `from <#${oldChannel}>` : ''} to <#${ + args.channel.id + }>.` ); } else { - return await message.util.send(`${this.client.util.emojis.success} removed the server's welcome channel.`); + return await message.util.send(`${util.emojis.success} removed the server's welcome channel.`); } } } |