From ed59b7f1827ab93573b079144c3eeaa01ce40492 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Tue, 26 Oct 2021 20:07:19 -0400 Subject: clean up, bug fixes --- src/commands/_fake-command/ironmoon.ts | 4 +- src/commands/admin/channelPermissions.ts | 80 +++++++++++++----- src/commands/admin/roleAll.ts | 32 ++++++-- src/commands/config/blacklist.ts | 11 +-- src/commands/config/config.ts | 10 ++- src/commands/config/customAutomodPhrases.ts | 4 +- src/commands/config/disable.ts | 4 +- src/commands/config/features.ts | 4 +- src/commands/config/levelRoles.ts | 2 +- src/commands/config/log.ts | 7 +- src/commands/dev/__template.ts | 5 +- src/commands/dev/eval.ts | 8 +- src/commands/dev/reload.ts | 4 +- src/commands/dev/say.ts | 6 +- src/commands/dev/servers.ts | 4 +- src/commands/dev/sh.ts | 4 +- src/commands/dev/superUser.ts | 4 +- src/commands/dev/test.ts | 4 +- src/commands/fun/coinflip.ts | 7 +- src/commands/fun/dice.ts | 4 +- src/commands/fun/eightBall.ts | 4 +- src/commands/fun/minesweeper.ts | 4 +- src/commands/info/avatar.ts | 6 +- src/commands/info/botInfo.ts | 10 +-- src/commands/info/color.ts | 7 +- src/commands/info/guildInfo.ts | 11 +-- src/commands/info/icon.ts | 6 +- src/commands/info/links.ts | 4 +- src/commands/info/ping.ts | 6 +- src/commands/info/pronouns.ts | 8 +- src/commands/info/snowflake.ts | 4 +- src/commands/info/userInfo.ts | 8 +- src/commands/leveling/leaderboard.ts | 4 +- src/commands/leveling/level.ts | 4 +- src/commands/leveling/setLevel.ts | 7 +- src/commands/leveling/setXp.ts | 7 +- src/commands/moderation/_lockdown.ts | 4 +- src/commands/moderation/ban.ts | 10 +-- src/commands/moderation/evidence.ts | 4 +- src/commands/moderation/hideCase.ts | 9 +-- src/commands/moderation/kick.ts | 4 +- src/commands/moderation/modlog.ts | 4 +- src/commands/moderation/mute.ts | 10 ++- src/commands/moderation/purge.ts | 19 +++-- src/commands/moderation/removeReactionEmoji.ts | 4 +- src/commands/moderation/role.ts | 4 +- src/commands/moderation/slowmode.ts | 4 +- src/commands/moderation/unban.ts | 7 +- src/commands/moderation/unmute.ts | 4 +- src/commands/moderation/warn.ts | 4 +- src/commands/moulberry-bush/capePerms.ts | 4 +- src/commands/moulberry-bush/capes.ts | 54 ++++++------- src/commands/moulberry-bush/giveawayPing.ts | 4 +- src/commands/moulberry-bush/moulHammer.ts | 6 +- src/commands/moulberry-bush/report.ts | 17 ++-- src/commands/moulberry-bush/rule.ts | 6 +- src/commands/moulberry-bush/serverStatus.ts | 8 +- src/commands/utilities/activity.ts | 5 +- src/commands/utilities/calculator.ts | 4 +- src/commands/utilities/decode.ts | 4 +- src/commands/utilities/hash.ts | 4 +- src/commands/utilities/price.ts | 94 +++++++++++----------- src/commands/utilities/steal.ts | 4 +- src/commands/utilities/suicide.ts | 4 +- src/commands/utilities/uuid.ts | 13 ++- src/commands/utilities/viewRaw.ts | 8 +- src/commands/utilities/whoHasRole.ts | 6 +- src/commands/utilities/wolframAlpha.ts | 13 +-- src/context-menu-commands/message/viewRaw.ts | 2 +- src/lib/common/AutoMod.ts | 2 +- src/lib/common/ButtonPaginator.ts | 2 +- src/lib/extensions/discord-akairo/BushClient.ts | 6 +- .../extensions/discord-akairo/BushClientUtil.ts | 2 +- src/lib/extensions/discord-akairo/BushCommand.ts | 10 ++- src/lib/utils/BushLogger.ts | 12 +-- src/listeners/client/interactionCreate.ts | 2 +- src/listeners/client/ready.ts | 2 +- src/listeners/commands/commandBlocked.ts | 4 +- src/listeners/commands/commandCooldown.ts | 2 +- src/listeners/commands/commandError.ts | 4 +- .../commands/commandMissingPermissions.ts | 6 +- src/listeners/commands/messageBlocked.ts | 2 +- src/listeners/commands/slashBlocked.ts | 2 +- src/listeners/commands/slashCommandError.ts | 2 +- src/listeners/commands/slashMissingPermissions.ts | 4 +- src/listeners/commands/slashNotFound.ts | 2 +- src/listeners/commands/slashStarted.ts | 2 +- src/listeners/custom/bushBan.ts | 4 +- src/listeners/custom/bushKick.ts | 4 +- src/listeners/custom/bushMute.ts | 4 +- src/listeners/custom/bushPunishRole.ts | 4 +- src/listeners/custom/bushPunishRoleRemove.ts | 4 +- src/listeners/custom/bushPurge.ts | 2 +- src/listeners/custom/bushUnban.ts | 4 +- src/listeners/custom/bushUnmute.ts | 4 +- src/listeners/custom/bushUpdateModlog.ts | 4 +- src/listeners/custom/bushUpdateSettings.ts | 4 +- src/listeners/custom/bushWarn.ts | 4 +- src/listeners/guild/guildCreate.ts | 2 +- src/listeners/guild/guildMemberAdd.ts | 6 +- src/listeners/guild/guildMemberRemove.ts | 6 +- src/listeners/guild/syncUnban.ts | 2 +- src/listeners/message/autoPublisher.ts | 2 +- src/listeners/message/automodCreate.ts | 2 +- src/listeners/message/automodUpdate.ts | 2 +- src/listeners/message/blacklistedFile.ts | 2 +- src/listeners/message/boosterMessage.ts | 2 +- src/listeners/message/directMessage.ts | 2 +- src/listeners/message/level.ts | 2 +- src/listeners/other/consoleListener.ts | 2 +- src/listeners/other/exit.ts | 2 +- src/listeners/other/promiseRejection.ts | 2 +- src/listeners/other/uncaughtException.ts | 2 +- src/listeners/other/warning.ts | 2 +- src/tasks/cpuUsage.ts | 2 +- src/tasks/removeExpiredPunishements.ts | 2 +- src/tasks/updateCache.ts | 8 +- src/tasks/updateStats.ts | 2 +- src/tasks/updateSuperUsers.ts | 2 +- 119 files changed, 429 insertions(+), 396 deletions(-) (limited to 'src') diff --git a/src/commands/_fake-command/ironmoon.ts b/src/commands/_fake-command/ironmoon.ts index d7e737f..612db85 100644 --- a/src/commands/_fake-command/ironmoon.ts +++ b/src/commands/_fake-command/ironmoon.ts @@ -4,7 +4,7 @@ export default class IronmoonCommand extends BushCommand { public constructor() { super('ironmoon', { category: 'fake-commands', - description: { content: '', examples: '', usage: '' }, + description: { content: '', examples: [''], usage: [''] }, pseudo: true, clientPermissions: [], userPermissions: [] @@ -16,7 +16,7 @@ export default class IronmoonCommand extends BushCommand { else return false; } - public override async exec(message: BushMessage | BushSlashMessage): Promise { + public override async exec(message: BushMessage | BushSlashMessage) { return await message.util.reply('Your message included the word ironmoon.'); } } diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index bae1133..dc35c87 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -1,5 +1,5 @@ -import { BushCommand, BushMessage, ButtonPaginator } from '@lib'; -import { GuildMember, MessageEmbed, Role } from 'discord.js'; +import { BushCommand, BushMessage, BushSlashMessage, ButtonPaginator } from '@lib'; +import { GuildMember, MessageEmbed, PermissionString, Role } from 'discord.js'; export default class ChannelPermissionsCommand extends BushCommand { public constructor() { @@ -8,9 +8,9 @@ export default class ChannelPermissionsCommand extends BushCommand { category: 'admin', typing: true, description: { - content: 'Use to mass change the channel ', - usage: 'ChannelPerms ', - examples: ['ChannelPerms 783794633129197589 read_messages deny'] + content: 'Use to mass change the channel permissions.', + usage: ['channel-perms '], + examples: ['channel-perms 783794633129197589 read_messages deny'] }, args: [ { @@ -18,7 +18,7 @@ export default class ChannelPermissionsCommand extends BushCommand { customType: util.arg.union('member', 'member'), prompt: { start: 'What user/role would you like to change?', - retry: 'Invalid response. What user/role would you like to change?' + retry: '{error} Choose a valid user/role to change.' } }, { @@ -44,39 +44,79 @@ export default class ChannelPermissionsCommand extends BushCommand { ], clientPermissions: (m) => util.clientSendAndPermCheck(m, ['MANAGE_CHANNELS']), userPermissions: ['ADMINISTRATOR'], - channel: 'guild' + channel: 'guild', + slash: true, + slashOptions: [ + { + name: 'target', + description: 'What user/role would you like to change?', + type: 'MENTIONABLE', + required: true + }, + { + name: 'permission', + description: 'What permission would you like to change?', + type: 'STRING', + required: true + }, + { + name: 'state', + description: 'What should that permission be set to?', + type: 'STRING', + choices: [ + { + name: 'Enabled', + value: 'true' + }, + { + name: 'Disabled', + value: 'false' + }, + { + name: 'Neutral', + value: 'neutral' + } + ], + required: true + } + ] }); } public override async exec( - message: BushMessage, - { - target, - permission, - state - }: { + message: BushMessage | BushSlashMessage, + args: { target: Role | GuildMember; - permission: string; + permission: PermissionString | string; state: 'true' | 'false' | 'neutral'; } - ): Promise { + ) { + if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`); + if (!message.member!.permissions.has('ADMINISTRATOR') && !message.member!.user.isOwner()) + return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`); + if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); + + const permission: PermissionString = message.util.isSlashMessage(message) + ? await util.arg.cast('permission', message, args.permission) + : args.permission; + if (!permission) return await message.util.reply(`${util.emojis.error} Invalid permission.`); const failedChannels = []; - for (const channel of message.guild!.channels.cache.values()) { + for (const [, channel] of message.guild!.channels.cache) { try { if (channel.isThread()) return; if (channel.permissionsLocked) return; - const permissionState = state === 'true' ? true : state === 'false' ? false : null; + const permissionState = args.state === 'true' ? true : args.state === 'false' ? false : null; await channel.permissionOverwrites.create( - target.id, + args.target.id, { [permission]: permissionState }, { reason: 'Changing overwrites for mass channel perms command' } ); } catch (e) { - client.console.debug(e.stack); + void client.console.error('channelPermissions', e.stack); failedChannels.push(channel); } } - const failure = failedChannels.map((e) => `<#${e.id}>`).join(' '); + const failure = failedChannels.map((c) => `<#${c.id}>`).join(' '); if (failure.length > 2000) { const paginate: MessageEmbed[] = []; for (let i = 0; i < failure.length; i += 4000) { diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts index 73369fc..1e67874 100644 --- a/src/commands/admin/roleAll.ts +++ b/src/commands/admin/roleAll.ts @@ -1,4 +1,4 @@ -import { AllowedMentions, BushCommand, BushMessage } from '@lib'; +import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { GuildMember, Role } from 'discord.js'; export default class RoleAllCommand extends BushCommand { @@ -8,8 +8,8 @@ export default class RoleAllCommand extends BushCommand { category: 'admin', description: { content: 'Give a role to every member on the server.', - usage: 'roleAll [another role]... [--bots]', - examples: ['roleAll 783794633129197589 --bots'] + usage: ['role-all [--bots]'], + examples: ['role-all 783794633129197589 --bots'] }, args: [ { @@ -30,14 +30,30 @@ export default class RoleAllCommand extends BushCommand { channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m, ['MANAGE_ROLES']), userPermissions: ['ADMINISTRATOR'], - typing: true + typing: true, + slash: true, + slashOptions: [ + { + name: 'role', + description: 'What role would you like to give to every member on the server?', + type: 'ROLE', + required: true + }, + { + name: 'bots', + description: 'Would you like to also give roles to bots?', + type: 'BOOLEAN', + required: false + } + ] }); } - public override async exec(message: BushMessage, args: { role: Role; bot?: boolean }): Promise { + public override async exec(message: BushMessage | BushSlashMessage, args: { role: Role; bots: boolean }) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`); if (!message.member!.permissions.has('ADMINISTRATOR') && !message.member!.user.isOwner()) return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`); + if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); if (args.role.comparePositionTo(message.guild.me!.roles.highest) >= 0 && !args.role) { return await message.util.reply(`${util.emojis.error} I cannot assign a role higher or equal to my highest role.`); @@ -47,7 +63,7 @@ export default class RoleAllCommand extends BushCommand { members = members.filter((member: GuildMember) => { try { - if (member.user.bot && !args.bot) return false; + if (member.user.bot && !args.bots) return false; if (member.roles.cache.has(args.role.id)) return false; } catch { return false; @@ -66,7 +82,7 @@ export default class RoleAllCommand extends BushCommand { if (!failed.length) { await message.util.reply({ content: `${util.emojis.success} Finished adding <@&${args.role.id}> to **${members.size}** member${ - members.size ? 's' : '' + members.size > 1 ? 's' : '' }.`, allowedMentions: AllowedMentions.none() }); @@ -74,7 +90,7 @@ export default class RoleAllCommand extends BushCommand { const array = [...members.values()]; await message.util.reply({ content: `${util.emojis.warn} Finished adding <@&${args.role.id}> to **${members.size - failed.length}** member${ - members.size - failed.length ? 's' : '' + members.size - failed.length > 1 ? 's' : '' }! Failed members:\n${failed.map((_, index) => `<@${array[index].id}>`).join(' ')}`, allowedMentions: AllowedMentions.none() }); diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index ef0c94e..d6d7c18 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -9,7 +9,7 @@ export default class BlacklistCommand extends BushCommand { category: 'config', description: { content: 'A command to blacklist users and channels.', - usage: 'blacklist|unblacklist ', + usage: ['blacklist|unblacklist '], examples: ['blacklist @user', 'unblacklist #channel'] }, args: [ @@ -18,8 +18,7 @@ export default class BlacklistCommand extends BushCommand { customType: Argument.union('channel', 'user'), prompt: { start: 'What channel or user that you would like to blacklist/unblacklist?', - retry: '{error} Pick a valid command.', - optional: false + retry: '{error} Pick a valid user or channel.' } }, { @@ -56,7 +55,7 @@ export default class BlacklistCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, args: { action: 'blacklist' | 'unblacklist'; target: Channel | User | string; global: boolean } - ): Promise { + ) { let action: 'blacklist' | 'unblacklist' | 'toggle' = args.action ?? (message?.util?.parsed?.alias as 'blacklist' | 'unblacklist') ?? 'toggle'; const global = args.global && message.author.isOwner(); @@ -92,9 +91,7 @@ export default class BlacklistCommand extends BushCommand { }); else return await message.util.reply({ - content: `${util.emojis.success} Successfully **${action}ed** ${util.format.bold( - target?.tag ?? target.name - )} globally.`, + content: `${util.emojis.success} Successfully ${action}ed ${util.format.bold(target?.tag ?? target.name)} globally.`, allowedMentions: AllowedMentions.none() }); // guild disable diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 0fdd615..0ca8ef8 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -24,9 +24,11 @@ export default class SettingsCommand extends BushCommand { category: 'config', description: { content: 'Configure server settings.', - usage: `settings (${settingsArr.map((s) => `\`${s}\``).join(', ')}) (${['view', 'set', 'add', 'remove'].map( - (s) => `\`${s}\`` - )})`, + usage: [ + `settings (${settingsArr.map((s) => `\`${s}\``).join(', ')}) (${['view', 'set', 'add', 'remove'].map( + (s) => `\`${s}\`` + )})` + ], examples: ['settings', 'config prefix set -'] }, slash: true, @@ -181,7 +183,7 @@ export default class SettingsCommand extends BushCommand { subcommand?: Action; value: string | Channel | Role; } - ): Promise { + ) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`); if (!message.member?.permissions.has('MANAGE_GUILD') && !message.member?.user.isOwner()) return await message.util.reply( diff --git a/src/commands/config/customAutomodPhrases.ts b/src/commands/config/customAutomodPhrases.ts index 51e219a..e02d52b 100644 --- a/src/commands/config/customAutomodPhrases.ts +++ b/src/commands/config/customAutomodPhrases.ts @@ -7,7 +7,7 @@ // category: 'config', // description: { // content: 'Configure additional phrases to be used for automod.', -// usage: 'custom-automod-phrases [optionalArg]', +// usage: ['custom-automod-phrases [optionalArg]'], // examples: ['custom-automod-phrases 1 2'] // }, // args: [ @@ -57,7 +57,7 @@ // public override async exec( // message: BushMessage | BushSlashMessage, // args: { required_argument: string; optional_argument: string } -// ): Promise { +// ) { // return await message.util.reply(`${util.emojis.error} Do not use the template command.`); // args; // } diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index bca1207..2e3ce74 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -7,7 +7,7 @@ export default class DisableCommand extends BushCommand { category: 'config', description: { content: 'A command to disable and enable commands.', - usage: 'disable|enable ', + usage: ['disable|enable '], examples: ['enable ban', 'disable kick'] }, args: [ @@ -62,7 +62,7 @@ export default class DisableCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, args: { action: 'enable' | 'disable'; command: BushCommand | string; global: boolean } - ): Promise { + ) { let action = (args.action ?? message?.util?.parsed?.alias ?? 'toggle') as 'disable' | 'enable' | 'toggle'; const global = args.global && message.author.isOwner(); const commandID = (args.command as BushCommand).id; diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index 3c3075c..8285845 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -8,7 +8,7 @@ export default class FeaturesCommand extends BushCommand { category: 'config', description: { content: 'Toggle features the server.', - usage: 'features', + usage: ['features'], examples: ['features'] }, slash: true, @@ -18,7 +18,7 @@ export default class FeaturesCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage): Promise { + public override async exec(message: BushMessage | BushSlashMessage) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`); const featureEmbed = new MessageEmbed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default); diff --git a/src/commands/config/levelRoles.ts b/src/commands/config/levelRoles.ts index ee5f255..c8f0bf3 100644 --- a/src/commands/config/levelRoles.ts +++ b/src/commands/config/levelRoles.ts @@ -58,7 +58,7 @@ // public override async exec( // message: BushMessage | BushSlashMessage, // args: { required_argument: string; optional_argument: string } -// ): Promise { +// ) { // return await message.util.reply(`${util.emojis.error} Do not use the template command.`); // args; // } diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts index 363620a..c364a35 100644 --- a/src/commands/config/log.ts +++ b/src/commands/config/log.ts @@ -9,7 +9,7 @@ export default class LogCommand extends BushCommand { category: 'config', description: { content: 'Set or remove a log channel.', - usage: 'log [channel]', + usage: ['log [channel]'], examples: ['log automod #automod-logs'] }, slash: true, @@ -60,10 +60,7 @@ export default class LogCommand extends BushCommand { return { log_type, channel }; } - public override async exec( - message: BushMessage | BushSlashMessage, - args: { log_type: GuildLogType; channel: TextChannel } - ): Promise { + public override async exec(message: BushMessage | BushSlashMessage, args: { log_type: GuildLogType; channel: TextChannel }) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`); const currentLogs = await message.guild.getSetting('logChannels'); const oldChannel = currentLogs[args.log_type] ?? undefined; diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts index b9d9114..0d25766 100644 --- a/src/commands/dev/__template.ts +++ b/src/commands/dev/__template.ts @@ -7,7 +7,7 @@ export default class TemplateCommand extends BushCommand { category: 'template', description: { content: 'Command description.', - usage: 'template [optionalArg]', + usage: ['template [optionalArg]'], examples: ['template 1 2'] }, args: [ @@ -53,11 +53,10 @@ export default class TemplateCommand extends BushCommand { userPermissions: [] }); } - public override async exec( message: BushMessage | BushSlashMessage, args: { required_argument: string; optional_argument: string } - ): Promise { + ) { return await message.util.reply(`${util.emojis.error} Do not use the template command.`); args; } diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 46fe889..5bb99e7 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -11,7 +11,7 @@ export default class EvalCommand extends BushCommand { category: 'dev', description: { content: 'Evaluate code.', - usage: 'eval [--depth #] [--sudo] [--silent] [--delete] [--proto] [--hidden] [--ts]', + usage: ['eval [--depth #] [--sudo] [--silent] [--delete] [--proto] [--hidden] [--ts]'], examples: ['eval message.channel.delete()'] }, args: [ @@ -64,7 +64,7 @@ export default class EvalCommand extends BushCommand { show_proto: boolean; show_methods: boolean; } - ): Promise { + ) { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); if (message.util.isSlashMessage(message)) { @@ -161,9 +161,9 @@ export default class EvalCommand extends BushCommand { } else { try { await message.author.send({ embeds: [embed] }); - if (!args.deleteMSG) await message.react(emojis.successFull); + if (!args.deleteMSG) await (message as BushMessage).react(emojis.successFull); } catch { - if (!args.deleteMSG) await message.react(emojis.errorFull); + if (!args.deleteMSG) await (message as BushMessage).react(emojis.errorFull); } } if (args.deleteMSG && (message as BushMessage).deletable) await (message as BushMessage).delete(); diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index 43b8ab6..a95106f 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -7,7 +7,7 @@ export default class ReloadCommand extends BushCommand { category: 'dev', description: { content: 'Reloads the bot', - usage: 'reload', + usage: ['reload'], examples: ['reload'] }, // args: [ @@ -33,7 +33,7 @@ export default class ReloadCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage /* { fast }: { fast: boolean } */): Promise { + public override async exec(message: BushMessage | BushSlashMessage /* { fast }: { fast: boolean } */) { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts index f1695f8..947f3c2 100644 --- a/src/commands/dev/say.ts +++ b/src/commands/dev/say.ts @@ -8,7 +8,7 @@ export default class SayCommand extends BushCommand { category: 'dev', description: { content: 'A command make the bot say something.', - usage: 'say ', + usage: ['say '], examples: ['say hello'] }, args: [ @@ -27,7 +27,7 @@ export default class SayCommand extends BushCommand { }); } - public override async exec(message: BushMessage, args: { content: string }): Promise { + public override async exec(message: BushMessage, args: { content: string }) { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); @@ -35,7 +35,7 @@ export default class SayCommand extends BushCommand { await message.util.send({ content: args.content, allowedMentions: AllowedMentions.none() }).catch(() => null); } - public override async execSlash(message: AkairoMessage, args: { content: string }): Promise { + public override async execSlash(message: AkairoMessage, args: { content: string }) { if (!client.config.owners.includes(message.author.id)) { return await message.interaction.reply({ content: `${util.emojis.error} Only my developers can run this command.`, diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index 5097695..e26d2c7 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -8,7 +8,7 @@ export default class ServersCommand extends BushCommand { category: 'dev', description: { content: 'Displays all the severs the bot is in', - usage: 'servers', + usage: ['servers'], examples: ['servers'] }, clientPermissions: (m) => util.clientSendAndPermCheck(m), @@ -17,7 +17,7 @@ export default class ServersCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage): Promise { + public override async exec(message: BushMessage | BushSlashMessage) { const guilds = [...client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).values()]; const chunkedGuilds: Guild[][] = util.chunk(guilds, 10); const embeds: MessageEmbedOptions[] = chunkedGuilds.map((chunk) => { diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index 3fca2b2..11cd28d 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -19,7 +19,7 @@ export default class ShCommand extends BushCommand { category: 'dev', description: { content: 'Run shell commands.', - usage: 'sh ', + usage: ['sh '], examples: ['sh git pull'] }, args: [ @@ -39,7 +39,7 @@ export default class ShCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage, { command }: { command: string }): Promise { + public override async exec(message: BushMessage | BushSlashMessage, { command }: { command: string }) { if (!client.config.owners.includes(message.author.id)) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); const input = clean(command); diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts index fcdec53..147a6c4 100644 --- a/src/commands/dev/superUser.ts +++ b/src/commands/dev/superUser.ts @@ -9,7 +9,7 @@ export default class SuperUserCommand extends BushCommand { category: 'dev', description: { content: 'A command to manage superusers.', - usage: 'superuser ', + usage: ['superuser '], examples: ['superuser add IRONM00N'] }, clientPermissions: (m) => util.clientSendAndPermCheck(m), @@ -44,7 +44,7 @@ export default class SuperUserCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { action, user }: { action: 'add' | 'remove'; user: User } - ): Promise { + ) { if (!message.author.isOwner()) return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 2ab266d..e3aa20d 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -15,7 +15,7 @@ export default class TestCommand extends BushCommand { category: 'dev', description: { content: 'A command to stuff.', - usage: 'test [feature]', + usage: ['test [feature]'], examples: ['test lots of buttons', 'test buttons'] }, args: [ @@ -36,7 +36,7 @@ export default class TestCommand extends BushCommand { }); } - public override async exec(message: BushMessage, args: { feature: string }): Promise { + public override async exec(message: BushMessage, args: { feature: string }) { const responses = [ 'Yes master.', 'Test it your self bitch, I am hungry.', diff --git a/src/commands/fun/coinflip.ts b/src/commands/fun/coinflip.ts index 42e7167..2d1f70c 100644 --- a/src/commands/fun/coinflip.ts +++ b/src/commands/fun/coinflip.ts @@ -7,15 +7,16 @@ export default class CoinFlipCommand extends BushCommand { category: 'fun', description: { content: 'Flip a virtual coin.', - usage: 'coinflip', + usage: ['coinflip'], examples: ['coinflip'] }, clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: [] + userPermissions: [], + slash: true }); } - public override async exec(message: BushMessage | BushSlashMessage): Promise { + public override async exec(message: BushMessage | BushSlashMessage) { const random = Math.random(); let result: string; const fall = message.author.id === '322862723090219008' ? 0.1 : 0.001; //dw about it diff --git a/src/commands/fun/dice.ts b/src/commands/fun/dice.ts index 9f18657..5058617 100644 --- a/src/commands/fun/dice.ts +++ b/src/commands/fun/dice.ts @@ -7,7 +7,7 @@ export default class EightBallCommand extends BushCommand { category: 'fun', description: { content: 'Roll virtual dice.', - usage: 'dice', + usage: ['dice'], examples: ['dice'] }, clientPermissions: (m) => util.clientSendAndPermCheck(m), @@ -16,7 +16,7 @@ export default class EightBallCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage): Promise { + public override async exec(message: BushMessage | BushSlashMessage) { const responses = ['1', '2', '3', '4', '5', '6']; const answer = responses[Math.floor(Math.random() * responses.length)]; return await message.util.reply(`You rolled a **${answer}**.`); diff --git a/src/commands/fun/eightBall.ts b/src/commands/fun/eightBall.ts index 4e79beb..e96e006 100644 --- a/src/commands/fun/eightBall.ts +++ b/src/commands/fun/eightBall.ts @@ -7,7 +7,7 @@ export default class EightBallCommand extends BushCommand { category: 'fun', description: { content: 'Ask questions for a randomly generated response.', - usage: '8Ball ', + usage: ['8Ball '], examples: ['8Ball does anyone love me?'] }, args: [ @@ -35,7 +35,7 @@ export default class EightBallCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage): Promise { + public override async exec(message: BushMessage | BushSlashMessage) { const responses = [ 'It is certain', 'Without a doubt', diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts index b45dcda..c9b0a8c 100644 --- a/src/commands/fun/minesweeper.ts +++ b/src/commands/fun/minesweeper.ts @@ -8,7 +8,7 @@ export default class MinesweeperCommand extends BushCommand { category: 'fun', description: { content: 'minesweeper command.', - usage: 'minesweeper [--spaces] [--revealFirstCell]', + usage: ['minesweeper [--spaces] [--revealFirstCell]'], examples: ['minesweeper 10 10 2'] }, args: [ @@ -66,7 +66,7 @@ export default class MinesweeperCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, args: { rows: number; columns: number; mines: number; spaces: boolean; reveal_first_cell: boolean } - ): Promise { + ) { const minesweeper = new Minesweeper({ rows: args.rows ?? 9, columns: args.columns ?? 9, diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts index 40debf0..44e1556 100644 --- a/src/commands/info/avatar.ts +++ b/src/commands/info/avatar.ts @@ -8,8 +8,8 @@ export default class AvatarCommand extends BushCommand { category: 'info', description: { content: "A command to get a user's avatar", - usage: 'avatar [user]', - examples: 'avatar' + usage: ['avatar [user]'], + examples: ['avatar', 'av IRONM00N'] }, args: [ { @@ -36,7 +36,7 @@ export default class AvatarCommand extends BushCommand { }); } - override async exec(message: BushMessage | BushSlashMessage, args: { user: GuildMember | User }): Promise { + override async exec(message: BushMessage | BushSlashMessage, args: { user: GuildMember | User }) { const params: { size: 2048; format: 'png'; dynamic: true } = { size: 2048, format: 'png', dynamic: true }; const defaultAvatar = `https://cdn.discordapp.com/embed/avatars/${Math.ceil(Math.random() * 6) - 1}.png`; diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index ffb785c..a072224 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -5,13 +5,13 @@ import prettyBytes from 'pretty-bytes'; export default class BotInfoCommand extends BushCommand { public constructor() { - super('botinfo', { - aliases: ['botinfo', 'stats'], + super('botInfo', { + aliases: ['bot-info', 'stats'], category: 'info', description: { content: 'Shows information about the bot', - usage: 'botinfo', - examples: ['botinfo'] + usage: ['bot-info'], + examples: ['bot-info'] }, slash: true, clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true), @@ -19,7 +19,7 @@ export default class BotInfoCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage): Promise { + public override async exec(message: BushMessage | BushSlashMessage) { enum Platform { aix = 'AIX', android = 'Android', diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index 958aadd..021f319 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -16,7 +16,7 @@ export default class ColorCommand extends BushCommand { category: 'info', description: { content: 'Find the color of a hex code, user, or role.', - usage: 'color ', + usage: ['color '], examples: ['color #0000FF'] }, args: [ @@ -40,10 +40,7 @@ export default class ColorCommand extends BushCommand { return color.substr(4, color.length - 5); } - public override async exec( - message: BushMessage | BushSlashMessage, - args: { color: string | BushRole | BushGuildMember } - ): Promise { + public override async exec(message: BushMessage | BushSlashMessage, args: { color: string | BushRole | BushGuildMember }) { const color = typeof args.color === 'string' ? tinycolor(args.color) diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index 2945050..3a592e9 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -4,12 +4,12 @@ import { BaseGuildVoiceChannel, Guild, GuildPreview, MessageEmbed, Snowflake, Va export default class GuildInfoCommand extends BushCommand { public constructor() { super('guildInfo', { - aliases: ['guildinfo', 'serverinfo', 'guild', 'server', 'g'], + aliases: ['guild-info', 'serverinfo', 'guild', 'server', 'g'], category: 'info', description: { content: 'Get info about a server.', - usage: 'guildinfo [guild]', - examples: ['guildinfo 516977525906341928'] + usage: ['guild-info [guild]'], + examples: ['guild-info 516977525906341928'] }, args: [ { @@ -36,10 +36,7 @@ export default class GuildInfoCommand extends BushCommand { }); } - public override async exec( - message: BushMessage | BushSlashMessage, - args: { guild: Guild | Snowflake | GuildPreview } - ): Promise { + public override async exec(message: BushMessage | BushSlashMessage, args: { guild: Guild | Snowflake | GuildPreview }) { if (!args?.guild && !message.guild) { return await message.util.reply( `${util.emojis.error} You must either provide an server to provide info about or run this command in a server.` diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index 08538d7..0eb7bfc 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -8,8 +8,8 @@ export default class IconCommand extends BushCommand { category: 'info', description: { content: "A command to get the server's icon", - usage: 'icon', - examples: 'icon' + usage: ['icon'], + examples: ['icon'] }, clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true), userPermissions: [], @@ -18,7 +18,7 @@ export default class IconCommand extends BushCommand { }); } - override async exec(message: BushMessage | BushSlashMessage): Promise { + override async exec(message: BushMessage | BushSlashMessage) { const embed = new MessageEmbed() .setTimestamp() .setColor(util.colors.default) diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts index 754b22b..7b52fef 100644 --- a/src/commands/info/links.ts +++ b/src/commands/info/links.ts @@ -9,7 +9,7 @@ export default class LinksCommand extends BushCommand { category: 'info', description: { content: 'Sends bot links', - usage: 'links', + usage: ['links'], examples: ['links'] }, clientPermissions: (m) => util.clientSendAndPermCheck(m), @@ -18,7 +18,7 @@ export default class LinksCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage): Promise { + public override async exec(message: BushMessage | BushSlashMessage) { if (client.config.isDevelopment) return await message.util.reply(`${util.emojis.error} The dev bot cannot be invited.`); const ButtonRow = new MessageActionRow().addComponents( new MessageButton({ diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 82db2ff..8d05307 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -8,7 +8,7 @@ export default class PingCommand extends BushCommand { category: 'info', description: { content: 'Gets the latency of the bot', - usage: 'ping', + usage: ['ping'], examples: ['ping'] }, slash: true, @@ -17,7 +17,7 @@ export default class PingCommand extends BushCommand { }); } - public override async exec(message: BushMessage): Promise { + public override async exec(message: BushMessage) { const sentMessage = (await message.util.send('Pong!')) as Message; const timestamp: number = message.editedTimestamp ? message.editedTimestamp : message.createdTimestamp; const botLatency = `${'```'}\n ${Math.round(sentMessage.createdTimestamp - timestamp)}ms ${'```'}`; @@ -35,7 +35,7 @@ export default class PingCommand extends BushCommand { }); } - public override async execSlash(message: BushSlashMessage): Promise { + public override async execSlash(message: BushSlashMessage) { const timestamp1 = message.interaction.createdTimestamp; await message.interaction.reply('Pong!'); const timestamp2 = await message.interaction.fetchReply().then((m) => (m as Message).createdTimestamp); diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index cd66530..132b719 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -7,9 +7,9 @@ export default class PronounsCommand extends BushCommand { aliases: ['pronouns', 'pronoun'], category: 'info', description: { - usage: 'pronouns ', - examples: ['pronouns IRONM00N'], - content: 'Finds the pronouns of a user using https://pronoundb.org.' + content: 'Finds the pronouns of a user using https://pronoundb.org.', + usage: ['pronouns '], + examples: ['pronouns IRONM00N'] }, args: [ { @@ -35,7 +35,7 @@ export default class PronounsCommand extends BushCommand { slash: true }); } - override async exec(message: BushMessage | BushSlashMessage, args: { user?: User }): Promise { + override async exec(message: BushMessage | BushSlashMessage, args: { user?: User }) { const user = args.user ?? message.author; const author = user.id === message.author.id; diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index b203d94..2b75b30 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -24,7 +24,7 @@ export default class SnowflakeCommand extends BushCommand { category: 'info', description: { content: 'Provides information about the specified Snowflake.', - usage: 'snowflake ', + usage: ['snowflake '], examples: ['snowflake 322862723090219008'] }, args: [ @@ -51,7 +51,7 @@ export default class SnowflakeCommand extends BushCommand { ] }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { snowflake: Snowflake }): Promise { + public override async exec(message: BushMessage | BushSlashMessage, args: { snowflake: Snowflake }) { const snowflake = `${args.snowflake}` as Snowflake; const snowflakeEmbed = new MessageEmbed().setTitle('Unknown :snowflake:').setColor(util.colors.default); diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 17be687..b3c8a67 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -8,9 +8,9 @@ export default class UserInfoCommand extends BushCommand { aliases: ['user-info', 'user', 'u'], category: 'info', description: { - usage: 'user-info [user]', - examples: ['user-info 322862723090219008'], - content: 'Gives information about a specified user.' + content: 'Gives information about a specified user.', + usage: ['user-info [user]'], + examples: ['user-info 322862723090219008'] }, args: [ { @@ -37,7 +37,7 @@ export default class UserInfoCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { user: BushUser | Snowflake }): Promise { + public override async exec(message: BushMessage | BushSlashMessage, args: { user: BushUser | Snowflake }) { const user = args?.user === undefined || args?.user === null ? message.author diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index 3f7fac8..61d3769 100644 --- a/src/commands/leveling/leaderboard.ts +++ b/src/commands/leveling/leaderboard.ts @@ -8,7 +8,7 @@ export default class LeaderboardCommand extends BushCommand { category: 'leveling', description: { content: 'Allows you to see the users with the highest levels in the server.', - usage: 'leaderboard [page]', + usage: ['leaderboard [page]'], examples: ['leaderboard 5'] }, args: [ @@ -37,7 +37,7 @@ export default class LeaderboardCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { page: number }): Promise { + public override async exec(message: BushMessage | BushSlashMessage, args: { page: number }) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`); if (!(await message.guild.hasFeature('leveling'))) return await message.util.reply( diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts index 219aab1..faaf201 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -21,7 +21,7 @@ export default class LevelCommand extends BushCommand { category: 'leveling', description: { content: 'Shows the level of a user', - usage: 'level [user]', + usage: ['level [user]'], examples: ['level', 'level @Tyman'] }, args: [ @@ -50,7 +50,7 @@ export default class LevelCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { user?: BushUser }): Promise { + public override async exec(message: BushMessage | BushSlashMessage, args: { user?: BushUser }) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`); if (!(await message.guild.hasFeature('leveling'))) return await message.util.reply( diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts index d3ee162..e085a8e 100644 --- a/src/commands/leveling/setLevel.ts +++ b/src/commands/leveling/setLevel.ts @@ -8,7 +8,7 @@ export default class SetLevelCommand extends BushCommand { category: 'leveling', description: { content: 'Sets the level of a user', - usage: 'set-level ', + usage: ['set-level '], examples: ['set-level @Moulberry 69'] //nice }, args: [ @@ -50,10 +50,7 @@ export default class SetLevelCommand extends BushCommand { }); } - public override async exec( - message: BushMessage | BushSlashMessage, - { user, level }: { user: User; level: number } - ): Promise { + public override async exec(message: BushMessage | BushSlashMessage, { user, level }: { user: User; level: number }) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a guild.`); if (!user.id) throw new Error('user.id is null'); diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts index a140bfc..4bcaff6 100644 --- a/src/commands/leveling/setXp.ts +++ b/src/commands/leveling/setXp.ts @@ -8,7 +8,7 @@ export default class SetXpCommand extends BushCommand { category: 'leveling', description: { content: 'Sets the xp of a user', - usage: 'set-xp ', + usage: ['set-xp '], examples: ['set-xp @Moulberry 69k'] //nice }, args: [ @@ -53,10 +53,7 @@ export default class SetXpCommand extends BushCommand { }); } - public override async exec( - message: BushMessage | BushSlashMessage, - { user, xp }: { user: User; xp: number } - ): Promise { + public override async exec(message: BushMessage | BushSlashMessage, { user, xp }: { user: User; xp: number }) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a guild.`); if (!user.id) throw new Error('user.id is null'); diff --git a/src/commands/moderation/_lockdown.ts b/src/commands/moderation/_lockdown.ts index 0086ff6..34d5698 100644 --- a/src/commands/moderation/_lockdown.ts +++ b/src/commands/moderation/_lockdown.ts @@ -7,7 +7,7 @@ export default class LockdownCommand extends BushCommand { category: 'moderation', description: { content: 'Allows you to lockdown a channel or all configured channels..', - usage: 'lockdown [--all]', + usage: ['lockdown [--all]'], examples: ['lockdown', 'lockdown --all'] }, args: [ @@ -33,7 +33,7 @@ export default class LockdownCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { all: boolean }): Promise { + public override async exec(message: BushMessage | BushSlashMessage, args: { all: boolean }) { return await message.util.reply('Unfortunately my developer is too lazy to implement this command.'); if (!args.all) { if (!['GUILD_TEXT', 'GUILD_NEWS'].includes(message.channel!.type)) diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index a267b78..5569069 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -8,7 +8,7 @@ export default class BanCommand extends BushCommand { category: 'moderation', description: { content: 'Ban a member from the server.', - usage: 'ban [--delete ]', + usage: ['ban [--delete]'], examples: ['ban ironm00n 1 day commands in #general --delete 7'] }, args: [ @@ -83,12 +83,12 @@ export default class BanCommand extends BushCommand { message: BushMessage | BushSlashMessage, args: { user: User | Snowflake; - reason?: { duration: number | null; contentWithoutTime: string }; - days?: number; + reason: { duration: number | null; contentWithoutTime: string } | null; + days: number | null; force: boolean; } - ): Promise { - if (typeof args.reason === 'object') args.reason.duration ??= 0; + ) { + if (args.reason && typeof args.reason === 'object') args.reason.duration ??= 0; args.days ??= 0; if (!message.guild) return message.util.reply(`${util.emojis.error} This command cannot be used in dms.`); diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts index a681bc1..0a297de 100644 --- a/src/commands/moderation/evidence.ts +++ b/src/commands/moderation/evidence.ts @@ -8,7 +8,7 @@ export default class EvidenceCommand extends BushCommand { category: 'moderation', description: { content: 'Add evidence to a modlog case.', - usage: 'evidence ', + usage: ['evidence '], examples: ['evidence '] }, slash: true, @@ -60,7 +60,7 @@ export default class EvidenceCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { case_id: caseID, evidence }: { case_id: string; evidence?: string } - ): Promise { + ) { const entry = await ModLog.findByPk(caseID); if (!entry || entry.pseudo) return message.util.send(`${util.emojis.error} Invalid modlog entry.`); if (entry.guild !== message.guild!.id) diff --git a/src/commands/moderation/hideCase.ts b/src/commands/moderation/hideCase.ts index 981a8bc..a873784 100644 --- a/src/commands/moderation/hideCase.ts +++ b/src/commands/moderation/hideCase.ts @@ -7,8 +7,8 @@ export default class HideCaseCommand extends BushCommand { category: 'moderation', description: { content: 'Hide a particular modlog case from the modlog command unless the `--hidden` flag is specified', - usage: 'hideCase ', - examples: ['hideCase 9210b1ea-91f5-4ea2-801b-02b394469c77'] + usage: ['hide-case '], + examples: ['hide-case 9210b1ea-91f5-4ea2-801b-02b394469c77'] }, args: [ { @@ -35,10 +35,7 @@ export default class HideCaseCommand extends BushCommand { }); } - public override async exec( - message: BushMessage | BushSlashMessage, - { case_id: caseID }: { case_id: string } - ): Promise { + public override async exec(message: BushMessage | BushSlashMessage, { case_id: caseID }: { case_id: string }) { const entry = await ModLog.findByPk(caseID); if (!entry || entry.pseudo) return message.util.send(`${util.emojis.error} Invalid entry.`); if (entry.guild !== message.guild!.id) diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index d4edb07..34c1b76 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -7,7 +7,7 @@ export default class KickCommand extends BushCommand { category: 'moderation', description: { content: 'Kick a user.', - usage: 'kick ', + usage: ['kick '], examples: ['kick @user bad'] }, args: [ @@ -58,7 +58,7 @@ export default class KickCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason?: string; force: boolean } - ): Promise { + ) { const member = await message.guild!.members.fetch(user.id); if (!member) diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 6840f4e..2bd0f5a 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -8,7 +8,7 @@ export default class ModlogCommand extends BushCommand { category: 'moderation', description: { content: "View a user's modlogs, or view a specific case.", - usage: 'modlogs [--hidden]', + usage: ['modlogs [--hidden]'], examples: ['modlogs @Tyman'] }, args: [ @@ -62,7 +62,7 @@ export default class ModlogCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { search, hidden }: { search: BushUser | string; hidden: boolean } - ): Promise { + ) { const foundUser = search instanceof User ? search : await util.resolveUserAsync(search); if (foundUser) { const logs = await ModLog.findAll({ diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 897e95a..844809b 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -7,7 +7,7 @@ export default class MuteCommand extends BushCommand { category: 'moderation', description: { content: 'Mute a user.', - usage: 'mute [reason] [duration]', + usage: ['mute [reason] [duration]'], examples: ['mute ironm00n 1 day commands in #general'] }, args: [ @@ -29,7 +29,11 @@ export default class MuteCommand extends BushCommand { optional: true } }, - { id: 'force', flag: '--force', match: 'flag' } + { + id: 'force', + flag: '--force', + match: 'flag' + } ], slash: true, slashOptions: [ @@ -55,7 +59,7 @@ export default class MuteCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, args: { user: BushUser; reason?: { duration: number | null; contentWithoutTime: string } | string; force: boolean } - ): Promise { + ) { const reason: { duration: number | null; contentWithoutTime: string } = args.reason ? typeof args.reason === 'string' ? await util.arg.cast('contentWithDuration', message, args.reason) diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts index 472665c..e5fea8e 100644 --- a/src/commands/moderation/purge.ts +++ b/src/commands/moderation/purge.ts @@ -8,8 +8,8 @@ export default class PurgeCommand extends BushCommand { category: 'moderation', description: { content: 'A command to mass delete messages.', - usage: 'purge ', - examples: ['Purge 20'] + usage: ['purge '], + examples: ['purge 20'] }, args: [ { @@ -25,11 +25,20 @@ export default class PurgeCommand extends BushCommand { match: 'flag', flag: '--bot' }, - { id: 'user', match: 'option', flag: '--user' } + { + id: 'user', + match: 'option', + flag: '--user' + } ], slash: true, slashOptions: [ - { name: 'amount', description: 'How many messages would you like to purge?', type: 'INTEGER', required: true }, + { + name: 'amount', + description: 'How many messages would you like to purge?', + type: 'INTEGER', + required: true + }, { name: 'bot', description: 'Would you like to only delete messages that are from bots?', @@ -43,7 +52,7 @@ export default class PurgeCommand extends BushCommand { }); } - public override async exec(message: BushMessage, args: { amount: number; bot: boolean }): Promise { + public override async exec(message: BushMessage, args: { amount: number; bot: boolean }) { if (message.channel.type === 'DM') return message.util.reply(`${util.emojis.error} You cannot run this command in dms.`); if (args.amount > 100 || args.amount < 1) return message.util.reply(`${util.emojis.error} `); diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts index 63e20bd..3e14aa2 100644 --- a/src/commands/moderation/removeReactionEmoji.ts +++ b/src/commands/moderation/removeReactionEmoji.ts @@ -8,7 +8,7 @@ export default class RemoveReactionEmojiCommand extends BushCommand { category: 'moderation', description: { content: 'Deleted all the reactions of a certain emoji from a message.', - usage: 'remove-reaction-emoji ', + usage: ['remove-reaction-emoji '], examples: ['remove-reaction-emoji 791413052347252786 <:omegaclown:782630946435366942>'] }, args: [ @@ -39,7 +39,7 @@ export default class RemoveReactionEmojiCommand extends BushCommand { public override async exec( message: BushMessage, { messageToRemoveFrom, emoji }: { messageToRemoveFrom: BushMessage; emoji: Emoji | Snowflake } - ): Promise { + ) { const id = !['string'].includes(typeof emoji); const emojiID = !id ? `${emoji}` : (emoji as Emoji).id; const success = await messageToRemoveFrom.reactions.cache diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index d6a85af..a0d6518 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -8,7 +8,7 @@ export default class RoleCommand extends BushCommand { category: 'moderation', description: { content: "Manages users' roles.", - usage: 'role [duration]', + usage: ['role [duration]'], examples: ['role add spammer nogiveaways 7days', 'ra tyman muted', 'rr tyman staff'] }, slash: true, @@ -95,7 +95,7 @@ export default class RoleCommand extends BushCommand { role, duration }: { action: 'add' | 'remove'; user: BushGuildMember; role: BushRole; duration?: number | null } - ): Promise { + ) { if (duration === null) duration = 0; if ( !message.member!.permissions.has('MANAGE_ROLES') && diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 75d795c..4192ecf 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -9,7 +9,7 @@ export default class SlowModeCommand extends BushCommand { category: 'moderation', description: { content: 'A command to set the slowmode of a channel.', - usage: 'slowmode ', + usage: ['slowmode '], examples: ['slowmode 3'] }, args: [ @@ -56,7 +56,7 @@ export default class SlowModeCommand extends BushCommand { length: number | 'off' | 'none' | 'disable'; channel: TextChannel | ThreadChannel | BushTextChannel | BushNewsChannel | BushThreadChannel | NewsChannel; } - ): Promise { + ) { if (message.channel!.type === 'DM') return await message.util.reply(`${util.emojis.error} This command cannot be run in dms.`); if (!channel) channel = message.channel as any; diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index 9d52dd2..3d61e82 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -7,7 +7,7 @@ export default class UnbanCommand extends BushCommand { category: 'moderation', description: { content: 'Unban a member from the server.', - usage: 'unban [--delete ]', + usage: ['unban [--delete]'], examples: ['unban 322862723090219008 I changed my mind, commands are allowed in #general'] }, args: [ @@ -50,10 +50,7 @@ export default class UnbanCommand extends BushCommand { userPermissions: ['BAN_MEMBERS'] }); } - public override async exec( - message: BushMessage | BushSlashMessage, - { user, reason }: { user: BushUser; reason?: string } - ): Promise { + public override async exec(message: BushMessage | BushSlashMessage, { user, reason }: { user: BushUser; reason?: string }) { const responseCode = await message.guild!.bushUnban({ user, moderator: message.author, diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index 3b4f5bd..ca7861c 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -7,7 +7,7 @@ export default class UnmuteCommand extends BushCommand { category: 'moderation', description: { content: 'unmute a user.', - usage: 'unmute [reason]', + usage: ['unmute [reason]'], examples: ['unmute 322862723090219008 1 day commands in #general'] }, args: [ @@ -59,7 +59,7 @@ export default class UnmuteCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason?: string; force: boolean } - ): Promise { + ) { const error = util.emojis.error; const member = message.guild!.members.cache.get(user.id) as BushGuildMember; diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index c510929..d326806 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -7,7 +7,7 @@ export default class WarnCommand extends BushCommand { category: 'moderation', description: { content: 'Warn a user.', - usage: 'warn [reason]', + usage: ['warn [reason]'], examples: ['warn @Tyman being cool'] }, args: [ @@ -58,7 +58,7 @@ export default class WarnCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason: string; force: boolean } - ):