diff options
Diffstat (limited to 'src/commands')
68 files changed, 354 insertions, 303 deletions
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<unknown> { + 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 <role_id> <perm> <state>', - examples: ['ChannelPerms 783794633129197589 read_messages deny'] + content: 'Use to mass change the channel permissions.', + usage: ['channel-perms <role_id> <perm> <state>'], + 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<unknown> { + ) { + 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 <role> [another role]... [--bots]', - examples: ['roleAll 783794633129197589 --bots'] + usage: ['role-all <role> [--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<unknown> { + 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 <user|channel>', + usage: ['blacklist|unblacklist <user|channel>'], 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<unknown> { + ) { 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<unknown> { + ) { 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 <requiredArg> [optionalArg]', +// usage: ['custom-automod-phrases <requiredArg> [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<unknown> { +// ) { // 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 <command>', + usage: ['disable|enable <command>'], 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<unknown> { + ) { 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<unknown> { + 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<unknown> { +// ) { // 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 <logType> [channel]', + usage: ['log <logType> [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<unknown> { + 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 <requiredArg> [optionalArg]', + usage: ['template <requiredArg> [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<unknown> { + ) { 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 <code> [--depth #] [--sudo] [--silent] [--delete] [--proto] [--hidden] [--ts]', + usage: ['eval <code> [--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<unknown> { + ) { 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<unknown> { + 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 <message>', + usage: ['say <message>'], examples: ['say hello'] }, args: [ @@ -27,7 +27,7 @@ export default class SayCommand extends BushCommand { }); } - public override async exec(message: BushMessage, args: { content: string }): Promise<unknown> { + 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<unknown> { + 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<unknown> { + 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 <command>', + usage: ['sh <command>'], 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<unknown> { + 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 <add/remove> <user>', + usage: ['superuser <add/remove> <user>'], 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<unknown> { + ) { 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<unknown> { + 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<void> { + 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<unknown> { + 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 <question>', + usage: ['8Ball <question>'], 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<void> { + 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 <rows> <columns> <mines> [--spaces] [--revealFirstCell]', + usage: ['minesweeper <rows> <columns> <mines> [--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<unknown> { + ) { 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<void> { + 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<void> { + 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 <color|role|user>', + usage: ['color <color|role|user>'], 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<unknown> { + 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<unknown> { + 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<void> { + 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<unknown> { + 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<void> { + 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<void> { + 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 <user>', - 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 <user>'], + 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<unknown> { + 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 <snowflake>', + usage: ['snowflake <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<unknown> { + 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<unknown> { + 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<unknown> { + 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<unknown> { + 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 <user> <level>', + usage: ['set-level <user> <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<unknown> { + 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 <user> <xp>', + usage: ['set-xp <user> <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<unknown> { + 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<unknown> { + 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 <member> <reason> [--delete ]', + usage: ['ban <member> <reason> [--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<unknown> { - 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 <case_id> <evidence>', + usage: ['evidence <case_id> <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<unknown> { + ) { 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 <case_id>', - examples: ['hideCase 9210b1ea-91f5-4ea2-801b-02b394469c77'] + usage: ['hide-case <case_id>'], + 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<unknown> { + 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 <member> <reason>', + usage: ['kick <member> <reason>'], 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<unknown> { + ) { 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 <search> [--hidden]', + usage: ['modlogs <search> [--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<unknown> { + ) { 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 <member> [reason] [duration]', + usage: ['mute <member> [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<unknown> { + ) { 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 <amount>', - examples: ['Purge 20'] + usage: ['purge <amount>'], + 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<unknown> { + 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 <message> <emoji>', + usage: ['remove-reaction-emoji <message> <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<unknown> { + ) { 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 <add|remove> <user> <role> [duration]', + usage: ['role <add|remove> <user> <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<unknown> { + ) { 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 <length>', + usage: ['slowmode <length>'], 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<unknown> { + ) { 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 <member> <reason> [--delete ]', + usage: ['unban <member> <reason> [--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<unknown> { + 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 <member> [reason]', + usage: ['unmute <member> [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<unknown> { + ) { 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 <member> [reason]', + usage: ['warn <member> [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 } - ): Promise<unknown> { + ) { const member = message.guild!.members.cache.get(user.id) as BushGuildMember; if (!member) return message.util.reply(`${util.emojis.error} I cannot warn users that are not in the server.`); const useForce = force && message.author.isOwner(); diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts index 4b7a3eb..ddd975d 100644 --- a/src/commands/moulberry-bush/capePerms.ts +++ b/src/commands/moulberry-bush/capePerms.ts @@ -9,7 +9,7 @@ export default class CapePermissionsCommand extends BushCommand { category: "Moulberry's Bush", description: { content: 'A command to see what capes someone has access to.', - usage: 'cape-perms <user>', + usage: ['cape-perms <user>'], examples: ['cape-perms IRONM00N'] }, args: [ @@ -38,7 +38,7 @@ export default class CapePermissionsCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { ign: string }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { ign: string }) { interface CapePerms { success: boolean; perms: User[]; diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index 96b4685..d5d8531 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -2,31 +2,6 @@ import { BushCommand, BushMessage, ButtonPaginator, DeleteButton } from '@lib'; import { MessageEmbedOptions } from 'discord.js'; import got from 'got'; -export interface GithubFile { - path: string; - mode: string; - type: string; - sha: string; - size: number; - url: string; -} - -export interface GithubBlob { - encoding: string; - content: string; - sha: string; - node_id: string; - url: string; - size: number; -} - -export interface GithubTreeApi { - sha: string; - url: string; - tree: GithubFile[]; - truncated: boolean; -} - export default class CapesCommand extends BushCommand { public constructor() { super('capes', { @@ -34,7 +9,7 @@ export default class CapesCommand extends BushCommand { category: "Moulberry's Bush", description: { content: 'A command to see what a cape looks like.', - usage: 'cape [cape]', + usage: ['cape [cape]'], examples: ['capes', 'cape space'] }, args: [ @@ -63,7 +38,7 @@ export default class CapesCommand extends BushCommand { }); } - public override async exec(message: BushMessage, args: { cape: string | null }): Promise<void> { + public override async exec(message: BushMessage, args: { cape: string | null }) { const { tree: neuFileTree }: GithubTreeApi = await got .get('https://api.github.com/repos/Moulberry/NotEnoughUpdates/git/trees/master?recursive=1') .json(); @@ -132,3 +107,28 @@ export default class CapesCommand extends BushCommand { }; } } + +export interface GithubFile { + path: string; + mode: string; + type: string; + sha: string; + size: number; + url: string; +} + +export interface GithubBlob { + encoding: string; + content: string; + sha: string; + node_id: string; + url: string; + size: number; +} + +export interface GithubTreeApi { + sha: string; + url: string; + tree: GithubFile[]; + truncated: boolean; +} diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts index d6005b0..7aa3001 100644 --- a/src/commands/moulberry-bush/giveawayPing.ts +++ b/src/commands/moulberry-bush/giveawayPing.ts @@ -7,7 +7,7 @@ export default class GiveawayPingCommand extends BushCommand { category: "Moulberry's Bush", description: { content: 'Pings the giveaway role.', - usage: 'giveaway-ping', + usage: ['giveaway-ping'], examples: ['giveaway-ping'] }, clientPermissions: (m) => util.clientSendAndPermCheck(m, ['MANAGE_MESSAGES'], true), @@ -23,7 +23,7 @@ export default class GiveawayPingCommand extends BushCommand { }); } - public override async exec(message: BushMessage): Promise<unknown> { + public override async exec(message: BushMessage) { if (!message.member!.permissions.has('MANAGE_GUILD') && !message.member!.user.isOwner()) await message.util.reply(`${util.emojis.error} You are missing the **MANAGE_GUILD** permission.`); diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts index 26841cb..5f1c11a 100644 --- a/src/commands/moulberry-bush/moulHammer.ts +++ b/src/commands/moulberry-bush/moulHammer.ts @@ -8,8 +8,8 @@ export default class MoulHammerCommand extends BushCommand { category: "Moulberry's Bush", description: { content: 'A command to moul hammer members.', - usage: 'moulHammer <user>', - examples: ['moulHammer @IRONM00N'] + usage: ['moul-hammer <user>'], + examples: ['moul-hammer @IRONM00N'] }, args: [ { @@ -27,7 +27,7 @@ export default class MoulHammerCommand extends BushCommand { }); } - public override async exec(message: BushMessage, { user }: { user: User }): Promise<void> { + public override async exec(message: BushMessage, { user }: { user: User }) { await message.delete(); const embed = new MessageEmbed() .setTitle('L') diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 24aa4aa..ae6d8c7 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -8,9 +8,9 @@ export default class ReportCommand extends BushCommand { aliases: ['report'], category: "Moulberry's Bush", description: { - content: 'A command to report a user..', - usage: 'report <user> <reason/evidence>', - examples: ['report IRONM00N'] + content: 'A command to report a user.', + usage: ['report <user> <reason/evidence>'], + examples: ['report IRONM00N commands in #general'] }, args: [ { @@ -27,8 +27,8 @@ export default class ReportCommand extends BushCommand { type: 'string', match: 'rest', prompt: { - start: 'What evidence do you have?', - retry: `{error} Provide what did they do wrong.`, + start: 'What did the user do wrong?', + retry: `{error} Provide evidence.`, optional: true } } @@ -37,7 +37,7 @@ export default class ReportCommand extends BushCommand { slashOptions: [ { name: 'user', - description: 'The user you would like to report.', + description: 'Who would you like to report?', type: 'USER', required: true }, @@ -54,10 +54,7 @@ export default class ReportCommand extends BushCommand { }); } - public override async exec( - message: BushMessage, - { member, evidence }: { member: GuildMember; evidence: string } - ): Promise<unknown> { + public override async exec(message: BushMessage, { member, evidence }: { member: GuildMember; evidence: string }) { if (!message.guild || !(await message.guild.hasFeature('reporting'))) return await message.util.reply( `${util.emojis.error} This command can only be used in servers where reporting is enabled.` diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 909ea92..42745bb 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -58,7 +58,7 @@ export default class RuleCommand extends BushCommand { category: "Moulberry's Bush", description: { content: 'A command to state a rule.', - usage: 'rule <rule> [user]', + usage: ['rule <rule> [user]'], examples: ['rule 1 IRONM00N', 'rule 2', 'rules'] }, args: [ @@ -104,7 +104,7 @@ export default class RuleCommand extends BushCommand { }); } - public override async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }): Promise<unknown> { + public override async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }) { const rulesEmbed = new MessageEmbed() .setColor('#ef3929') .setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true }) ?? undefined) @@ -126,7 +126,7 @@ export default class RuleCommand extends BushCommand { await message.delete().catch(() => {}); } return; - async function respond(): Promise<unknown> { + async function respond() { if (!user) { return ( // If the original message was a reply -> imitate it diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index 6c3664e..f656e4c 100644 --- a/src/commands/moulberry-bush/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -8,9 +8,9 @@ export default class ServerStatusCommand extends BushCommand { aliases: ['server-status', 'ss'], category: "Moulberry's Bush", description: { - usage: 'serverstatus', - examples: ['serverstatus', 'ss'], - content: "Gives the status of moulberry's server" + content: "Gives the status of moulberry's server", + usage: ['server-status'], + examples: ['server-status', 'ss'] }, clientPermissions: (m) => util.clientSendAndPermCheck(m, ['EMBED_LINKS'], true), userPermissions: [], @@ -18,7 +18,7 @@ export default class ServerStatusCommand extends BushCommand { }); } - public override async exec(message: BushMessage): Promise<void> { + public override async exec(message: BushMessage) { const msgEmbed: MessageEmbed = new MessageEmbed() .setTitle('Server status') .setDescription(`Checking server:\n${util.emojis.loading}`) diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts index 4066934..a2ca3e2 100644 --- a/src/commands/utilities/activity.ts +++ b/src/commands/utilities/activity.ts @@ -105,10 +105,7 @@ export default class YouTubeCommand extends BushCommand { }); } - public override async exec( - message: BushMessage | BushSlashMessage, - args: { channel: VoiceChannel; activity: string } - ): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { channel: VoiceChannel; activity: string }) { const channel = typeof args.channel === 'string' ? message.guild?.channels.cache.get(args.channel) : args.channel; if (!channel || channel.type !== 'GUILD_VOICE') return await message.util.reply(`${util.emojis.error} Choose a valid voice channel`); diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index 743e9b2..861a356 100644 --- a/src/commands/utilities/calculator.ts +++ b/src/commands/utilities/calculator.ts @@ -9,7 +9,7 @@ export default class CalculatorCommand extends BushCommand { category: 'utilities', description: { content: 'Calculates math expressions.', - usage: 'calculator <expression>', + usage: ['calculator <expression>'], examples: ['calculator 9+10'] }, args: [ @@ -37,7 +37,7 @@ export default class CalculatorCommand extends BushCommand { userPermissions: [] }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }) { const decodedEmbed = new MessageEmbed().addField( '📥 Input', await util.inspectCleanRedactCodeblock(args.expression, 'mma') diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts index c497183..6812d91 100644 --- a/src/commands/utilities/decode.ts +++ b/src/commands/utilities/decode.ts @@ -12,7 +12,7 @@ export default class DecodeCommand extends BushCommand { category: 'utilities', description: { content: 'Decode / encode.', - usage: 'decode <from> <to> <data>', + usage: ['decode <from> <to> <data>'], examples: ['decode base64 ascii TmVyZApJbWFnaW5lIGRlY29kaW5nIHRoaXMgbG1hbw=='] }, args: [ @@ -73,7 +73,7 @@ export default class DecodeCommand extends BushCommand { public override async exec( message: BushMessage | AkairoMessage, { from, to, data }: { from: BufferEncoding; to: BufferEncoding; data: string } - ): Promise<unknown> { + ) { const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias ?? 'decoded'); const decodedEmbed = new MessageEmbed() .setTitle(`${encodeOrDecode} Information`) diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts index a8fdee1..646ed28 100644 --- a/src/commands/utilities/hash.ts +++ b/src/commands/utilities/hash.ts @@ -9,7 +9,7 @@ export default class HashCommand extends BushCommand { category: 'utilities', description: { content: 'Gets the file hash of the given discord link', - usage: 'hash <file url>', + usage: ['hash <fileUrl>'], examples: ['hash https://cdn.discordapp.com/emojis/782630946435366942.png?v=1'] //nice }, args: [ @@ -27,7 +27,7 @@ export default class HashCommand extends BushCommand { }); } - public override async exec(message: BushMessage, { url }: { url: string }): Promise<void> { + public override async exec(message: BushMessage, { url }: { url: string }) { try { const req = await got.get(url); const rawHash = crypto.createHash('md5'); diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index 059533b..a232e56 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -3,58 +3,15 @@ import { MessageEmbed } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; -interface Summary { - amount: number; - pricePerUnit: number; - orders: number; -} - -interface Bazaar { - success: boolean; - lastUpdated: number; - products: { - [key: string]: { - product_id: string; - sell_summary: Summary[]; - buy_summary: Summary[]; - quick_status: { - productId: string; - sellPrice: number; - sellVolume: number; - sellMovingWeek: number; - sellOrders: number; - buyPrice: number; - buyVolume: number; - buyMovingWeek: number; - buyOrders: number; - }; - }; - }; -} - -interface LowestBIN { - [key: string]: number; -} - -interface AuctionAverages { - [key: string]: { - price?: number; - count?: number; - sales?: number; - clean_price?: number; - clean_sales?: number; - }; -} - export default class PriceCommand extends BushCommand { public constructor() { super('price', { aliases: ['price'], category: 'utilities', description: { - usage: 'price <item id>', - examples: ['price ASPECT_OF_THE_END'], - content: 'Finds the price information of an item.' + content: 'Finds the price information of an item.', + usage: ['price <item id>'], + examples: ['price ASPECT_OF_THE_END'] }, args: [ { @@ -94,7 +51,7 @@ export default class PriceCommand extends BushCommand { }); } - public override async exec(message: BushMessage, { item, strict }: { item: string; strict: boolean }): Promise<unknown> { + public override async exec(message: BushMessage, { item, strict }: { item: string; strict: boolean }) { if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); const errors = new Array<string>(); @@ -189,3 +146,46 @@ export default class PriceCommand extends BushCommand { } } } + +interface Summary { + amount: number; + pricePerUnit: number; + orders: number; +} + +interface Bazaar { + success: boolean; + lastUpdated: number; + products: { + [key: string]: { + product_id: string; + sell_summary: Summary[]; + buy_summary: Summary[]; + quick_status: { + productId: string; + sellPrice: number; + sellVolume: number; + sellMovingWeek: number; + sellOrders: number; + buyPrice: number; + buyVolume: number; + buyMovingWeek: number; + buyOrders: number; + }; + }; + }; +} + +interface LowestBIN { + [key: string]: number; +} + +interface AuctionAverages { + [key: string]: { + price?: number; + count?: number; + sales?: number; + clean_price?: number; + clean_sales?: number; + }; +} diff --git a/src/commands/utilities/steal.ts b/src/commands/utilities/steal.ts index 767534e..b92a2da 100644 --- a/src/commands/utilities/steal.ts +++ b/src/commands/utilities/steal.ts @@ -8,7 +8,7 @@ export default class StealCommand extends BushCommand { category: 'utilities', description: { content: 'Steal an emoji from another server and add it to your own.', - usage: 'steal <emoji/emoji id/url> [name]', + usage: ['steal <emoji/emojiId/url> [name]'], examples: ['steal <:omegaclown:782630946435366942> ironm00n'] }, args: [ @@ -34,7 +34,7 @@ export default class StealCommand extends BushCommand { public override async exec( message: BushMessage, args?: { emojiOrName?: { name: string; id: Snowflake } | Snowflake | URL | string; name2: string } - ): Promise<unknown> { + ) { if ((!args || !args.emojiOrName) && !message.attachments.size) return await message.util.reply(`${util.emojis.error} You must provide an emoji to steal.`); diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts index 31bdca0..3709e37 100644 --- a/src/commands/utilities/suicide.ts +++ b/src/commands/utilities/suicide.ts @@ -8,7 +8,7 @@ export default class TemplateCommand extends BushCommand { category: 'utilities', description: { content: 'Mental Health Resources. Credit to https://github.com/dexbiobot/Zeppelin.', - usage: 'suicide', + usage: ['suicide'], examples: ['suicide'] }, slash: true, @@ -18,7 +18,7 @@ export default class TemplateCommand extends BushCommand { }); } - public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage) { // stolen from https://github.com/dexbiobot/Zeppelin const suicideEmbed = new MessageEmbed() .setTitle('Mental Health Resources') diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts index 823d1ff..56566d4 100644 --- a/src/commands/utilities/uuid.ts +++ b/src/commands/utilities/uuid.ts @@ -7,7 +7,7 @@ export default class UuidCommand extends BushCommand { category: 'utilities', description: { content: "Find someone's minecraft uuid", - usage: 'uuid <ign>', + usage: ['uuid <ign>'], examples: ['uuid ironm00n'] }, args: [ @@ -21,12 +21,21 @@ export default class UuidCommand extends BushCommand { } } ], + slash: true, + slashOptions: [ + { + name: 'ign', + description: 'What ign would you like to find the uuid of?', + type: 'STRING', + required: false + } + ], clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: [] }); } - public override async exec(message: BushMessage, { ign }: { ign: { match: any[]; matches: any[] } }): Promise<unknown> { + public override async exec(message: BushMessage, { ign }: { ign: { match: any[]; matches: any[] } }) { if (!ign) return await message.util.reply(`${util.emojis.error} Please enter a valid ign.`); const readableIGN = ign.match[0]; try { diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index 60529c5..3667d40 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -7,9 +7,9 @@ export default class ViewRawCommand extends BushCommand { aliases: ['view-raw', 'vr'], category: 'utilities', description: { - usage: 'viewraw <message id> <channel>', - examples: ['viewraw 322862723090219008'], - content: 'Shows raw information about a message.' + content: 'Shows raw information about a message.', + usage: ['viewraw <message id> <channel>'], + examples: ['viewraw 322862723090219008'] }, args: [ { @@ -77,7 +77,7 @@ export default class ViewRawCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, args: { message: Snowflake; channel: TextChannel | NewsChannel | DMChannel; json?: boolean; js: boolean } - ): Promise<unknown> { + ) { if (!args.channel) args.channel = (message.channel as TextChannel | NewsChannel | DMChannel)!; const newMessage = await args.channel.messages.fetch(`${args.message}` as Snowflake).catch(() => null); if (!newMessage) diff --git a/src/commands/utilities/whoHasRole.ts b/src/commands/utilities/whoHasRole.ts index be27c7c..ce7a70e 100644 --- a/src/commands/utilities/whoHasRole.ts +++ b/src/commands/utilities/whoHasRole.ts @@ -8,8 +8,8 @@ export default class WhoHasRoleCommand extends BushCommand { category: 'utilities', description: { content: 'Allows you to view what users have a certain role.', - usage: 'template <requiredArg> [optionalArg]', - examples: ['template 1 2'] + usage: ['who-has-role <role>'], + examples: ['who-has-role admin'] }, args: [ { @@ -37,7 +37,7 @@ export default class WhoHasRoleCommand extends BushCommand { typing: true }); } - public override async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { role: Role }) { if (message.util.isSlash) await (message.interaction as CommandInteraction).deferReply(); const roleMembers = args.role.members.map((member) => `${member.user} (${Util.escapeMarkdown(member.user.tag)})`); diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index 426a0c7..ea055e8 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -9,11 +9,15 @@ export default class WolframAlphaCommand extends BushCommand { category: 'utilities', description: { content: 'Queries Wolfram|Alpha for a result.', - usage: 'wolfram-alpha <expression>', + usage: ['wolfram-alpha <expression>'], examples: ['wolfram-alpha what is the population of france'] }, args: [ - { id: 'image', match: 'flag', flag: '--image' }, + { + id: 'image', + match: 'flag', + flag: '--image' + }, { id: 'expression', type: 'string', @@ -44,10 +48,7 @@ export default class WolframAlphaCommand extends BushCommand { userPermissions: [] }); } - public override async exec( - message: BushMessage | BushSlashMessage, - args: { expression: string; image: boolean } - ): Promise<unknown> { + public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string; image: boolean }) { if (message.util.isSlashMessage(message)) await message.interaction.deferReply(); args.image && void message.util.reply({ content: `${util.emojis.loading} Loading...`, embeds: [] }); |