diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-26 20:07:19 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-26 20:07:19 -0400 |
commit | ed59b7f1827ab93573b079144c3eeaa01ce40492 (patch) | |
tree | 7ceac6d61a8a25586ab9bbaf7acfbade91c97132 /src | |
parent | c0a81b014a56e4d44c826f78391a930361aab122 (diff) | |
download | tanzanite-ed59b7f1827ab93573b079144c3eeaa01ce40492.tar.gz tanzanite-ed59b7f1827ab93573b079144c3eeaa01ce40492.tar.bz2 tanzanite-ed59b7f1827ab93573b079144c3eeaa01ce40492.zip |
clean up, bug fixes
Diffstat (limited to 'src')
119 files changed, 429 insertions, 396 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: [] }); diff --git a/src/context-menu-commands/message/viewRaw.ts b/src/context-menu-commands/message/viewRaw.ts index 15d7582..24dfb97 100644 --- a/src/context-menu-commands/message/viewRaw.ts +++ b/src/context-menu-commands/message/viewRaw.ts @@ -12,7 +12,7 @@ export default class ViewRawContextMenuCommand extends ContextMenuCommand { }); } - public override async exec(interaction: ContextMenuInteraction): Promise<unknown> { + public override async exec(interaction: ContextMenuInteraction) { await interaction.deferReply({ ephemeral: true }); const embed = await ViewRawCommand.getRawData(interaction.options.getMessage('message') as BushMessage, { json: false, diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts index adc629a..38c488b 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -15,7 +15,7 @@ export class AutoMod { void this.handle(); } - private async handle(): Promise<void> { + private async handle() { if (this.message.channel.type === 'DM' || !this.message.guild) return; if (!(await this.message.guild.hasFeature('automod'))) return; diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index 6d4c49a..da595d5 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -31,7 +31,7 @@ export class ButtonPaginator { text: string | null = null, deleteOnExit = true, startOn = 1 - ): Promise<void> { + ) { // no need to paginate if there is only one page if (embeds.length === 1) return DeleteButton.send(message, { embeds: embeds }); diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 6133dba..32f43be 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -296,7 +296,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re } // Initialize everything - async #init(): Promise<void> { + async #init() { this.commandHandler.useListenerHandler(this.listenerHandler); this.commandHandler.useInhibitorHandler(this.inhibitorHandler); this.commandHandler.ignorePermissions = this.config.owners; @@ -344,7 +344,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re this.stats.commandsUsed = await UpdateStatsTask.init(); } - public async dbPreInit(): Promise<void> { + public async dbPreInit() { try { await this.db.authenticate(); Global.initModel(this.db); @@ -369,7 +369,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re /** * Starts the bot */ - public async start(): Promise<void> { + public async start() { eventsIntercept.patch(this); //@ts-expect-error: no typings this.intercept('ready', async (arg, done) => { diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index a833c75..32081ed 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -510,7 +510,7 @@ export class BushClientUtil extends ClientUtil { /** * Wait an amount in seconds. */ - public async sleep(s: number): Promise<unknown> { + public async sleep(s: number) { return new Promise((resolve) => setTimeout(resolve, s * 1000)); } diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 22d4aae..e3066aa 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -148,8 +148,8 @@ export interface BushCommandOptions extends Omit<CommandOptions, 'userPermission restrictedGuilds?: Snowflake[]; description: { content: string; - usage: string | string[]; - examples: string | string[]; + usage: string[]; + examples: string[]; }; args?: BushArgumentOptions[] & CustomBushArgumentOptions[]; category: string; @@ -168,6 +168,12 @@ export class BushCommand extends Command { public declare handler: BushCommandHandler; + public declare description: { + content: string; + usage: string[]; + examples: string[]; + }; + /** The command's options */ public options: BushCommandOptions; diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index f00c19c..2aaba5b 100644 --- a/src/lib/utils/BushLogger.ts +++ b/src/lib/utils/BushLogger.ts @@ -62,7 +62,7 @@ export class BushLogger { } /** Sends a message to the log channel */ - public static async channelLog(message: BushSendMessageType): Promise<void> { + public static async channelLog(message: BushSendMessageType) { const channel = await util.getConfigChannel('log'); await channel.send(message).catch(() => {}); } @@ -100,7 +100,7 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public static async verbose(header: string, content: any, sendChannel = false, depth = 0): Promise<void> { + public static async verbose(header: string, content: any, sendChannel = false, depth = 0) { if (!client.config.logging.verbose) return; const newContent = this.#inspectContent(content, depth, true); console.info( @@ -121,7 +121,7 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public static async info(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + public static async info(header: string, content: any, sendChannel = true, depth = 0) { if (!client.config.logging.info) return; const newContent = this.#inspectContent(content, depth, true); console.info( @@ -142,7 +142,7 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public static async warn(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + public static async warn(header: string, content: any, sendChannel = true, depth = 0) { const newContent = this.#inspectContent(content, depth, true); console.warn( `${chalk.bgYellow(this.#getTimeStamp())} ${chalk.yellow(`[${header}]`)} ${this.#parseFormatting( @@ -166,7 +166,7 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public static async error(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + public static async error(header: string, content: any, sendChannel = true, depth = 0) { const newContent = this.#inspectContent(content, depth, true); console.error( `${chalk.bgRedBright(this.#getTimeStamp())} ${chalk.redBright(`[${header}]`)} ${this.#parseFormatting( @@ -190,7 +190,7 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public static async success(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + public static async success(header: string, content: any, sendChannel = true, depth = 0) { const newContent = this.#inspectContent(content, depth, true); console.log( `${chalk.bgGreen(this.#getTimeStamp())} ${chalk.greenBright(`[${header}]`)} ${this.#parseFormatting( diff --git a/src/listeners/client/interactionCreate.ts b/src/listeners/client/interactionCreate.ts index c2d12b2..be6cede 100644 --- a/src/listeners/client/interactionCreate.ts +++ b/src/listeners/client/interactionCreate.ts @@ -9,7 +9,7 @@ export default class InteractionCreateListener extends BushListener { }); } - public override async exec(...[interaction]: BushClientEvents['interactionCreate']): Promise<unknown> { + public override async exec(...[interaction]: BushClientEvents['interactionCreate']) { if (!interaction) return; void client.console.verbose( 'interactionVerbose', diff --git a/src/listeners/client/ready.ts b/src/listeners/client/ready.ts index 6f98ceb..a6188d1 100644 --- a/src/listeners/client/ready.ts +++ b/src/listeners/client/ready.ts @@ -10,7 +10,7 @@ export default class ReadyListener extends BushListener { }); } - public override async exec(): Promise<void> { + public override async exec() { process.emit('ready' as any); const tag = `<<${client.user?.tag}>>`, diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts index 8329c83..074b6d6 100644 --- a/src/listeners/commands/commandBlocked.ts +++ b/src/listeners/commands/commandBlocked.ts @@ -9,7 +9,7 @@ export default class CommandBlockedListener extends BushListener { }); } - public override async exec(...[message, command, reason]: BushCommandHandlerEvents['commandBlocked']): Promise<unknown> { + public override async exec(...[message, command, reason]: BushCommandHandlerEvents['commandBlocked']) { return await CommandBlockedListener.handleBlocked(message, command, reason); } @@ -17,7 +17,7 @@ export default class CommandBlockedListener extends BushListener { message: Message | BushMessage | BushSlashMessage, command: BushCommand | null, reason?: string - ): Promise<unknown> { + ) { const isSlash = !!command && !!message.util?.isSlash; void client.console.info( diff --git a/src/listeners/commands/commandCooldown.ts b/src/listeners/commands/commandCooldown.ts index 9a57ac0..118b676 100644 --- a/src/listeners/commands/commandCooldown.ts +++ b/src/listeners/commands/commandCooldown.ts @@ -9,7 +9,7 @@ export default class CommandCooldownListener extends BushListener { }); } - public override async exec(...[message, command, remaining]: BushCommandHandlerEvents['cooldown']): Promise<void> { + public override async exec(...[message, command, remaining]: BushCommandHandlerEvents['cooldown']) { void client.console.info( 'commandCooldown', `<<${message.author.tag}>> tried to run <<${ diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index fb1bebe..0ef4ebd 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -11,13 +11,13 @@ export default class CommandErrorListener extends BushListener { }); } - public override exec(...[error, message, command]: BushCommandHandlerEvents['error']): Promise<unknown> { + public override exec(...[error, message, command]: BushCommandHandlerEvents['error']) { return CommandErrorListener.handleError(error, message, command); } public static async handleError( ...[error, message, _command]: BushCommandHandlerEvents['error'] | BushCommandHandlerEvents['slashError'] - ): Promise<void> { + ) { const isSlash = message.util!.isSlash; const errorNum = Math.floor(Math.random() * 6969696969) + 69; // hehe funny number const channel = diff --git a/src/listeners/commands/commandMissingPermissions.ts b/src/listeners/commands/commandMissingPermissions.ts index 1917ce0..0bbf916 100644 --- a/src/listeners/commands/commandMissingPermissions.ts +++ b/src/listeners/commands/commandMissingPermissions.ts @@ -9,9 +9,7 @@ export default class CommandMissingPermissionsListener extends BushListener { }); } - public override async exec( - ...[message, command, type, missing]: BushCommandHandlerEvents['missingPermissions'] - ): Promise<unknown> { + public override async exec(...[message, command, type, missing]: BushCommandHandlerEvents['missingPermissions']) { return await CommandMissingPermissionsListener.handleMissing(message, command, type, missing); } @@ -19,7 +17,7 @@ export default class CommandMissingPermissionsListener extends BushListener { ...[message, command, type, missing]: | BushCommandHandlerEvents['missingPermissions'] | BushCommandHandlerEvents['slashMissingPermissions'] - ): Promise<unknown> { + ) { const niceMissing = (missing.includes('ADMINISTRATOR') ? (['ADMINISTRATOR'] as 'ADMINISTRATOR'[]) : missing).map( (perm) => client.consts.mappings.permissions[perm]?.name ?? missing ); diff --git a/src/listeners/commands/messageBlocked.ts b/src/listeners/commands/messageBlocked.ts index fc64802..0b1001c 100644 --- a/src/listeners/commands/messageBlocked.ts +++ b/src/listeners/commands/messageBlocked.ts @@ -8,7 +8,7 @@ export default class MessageBlockedListener extends BushListener { }); } - public override async exec(...[message, reason]: BushCommandHandlerEvents['messageBlocked']): Promise<unknown> { + public override async exec(...[message, reason]: BushCommandHandlerEvents['messageBlocked']) { const reasons = client.consts.BlockedReasons; if ([reasons.CLIENT, reasons.BOT].includes(reason)) return; // return await CommandBlockedListener.handleBlocked(message as Message, null, reason); diff --git a/src/listeners/commands/slashBlocked.ts b/src/listeners/commands/slashBlocked.ts index 851cb5e..6c94187 100644 --- a/src/listeners/commands/slashBlocked.ts +++ b/src/listeners/commands/slashBlocked.ts @@ -10,7 +10,7 @@ export default class SlashBlockedListener extends BushListener { }); } - public override async exec(...[message, command, reason]: BushCommandHandlerEvents['slashBlocked']): Promise<unknown> { + public override async exec(...[message, command, reason]: BushCommandHandlerEvents['slashBlocked']) { return await CommandBlockedListener.handleBlocked(message, command, reason); } } diff --git a/src/listeners/commands/slashCommandError.ts b/src/listeners/commands/slashCommandError.ts index 5ab195f..9b194e5 100644 --- a/src/listeners/commands/slashCommandError.ts +++ b/src/listeners/commands/slashCommandError.ts @@ -9,7 +9,7 @@ export default class SlashCommandErrorListener extends BushListener { category: 'commands' }); } - public override async exec(...[error, message, command]: BushCommandHandlerEvents['slashError']): Promise<void> { + public override async exec(...[error, message, command]: BushCommandHandlerEvents['slashError']) { return await CommandErrorListener.handleError(error, message, command); } } diff --git a/src/listeners/commands/slashMissingPermissions.ts b/src/listeners/commands/slashMissingPermissions.ts index a01b1fa..33a9363 100644 --- a/src/listeners/commands/slashMissingPermissions.ts +++ b/src/listeners/commands/slashMissingPermissions.ts @@ -10,9 +10,7 @@ export default class SlashMissingPermissionsListener extends BushListener { }); } - public override async exec( - ...[message, command, type, missing]: BushCommandHandlerEvents['slashMissingPermissions'] - ): Promise<unknown> { + public override async exec(...[message, command, type, missing]: BushCommandHandlerEvents['slashMissingPermissions']) { return await CommandMissingPermissionsListener.handleMissing(message, command, type, missing); } } diff --git a/src/listeners/commands/slashNotFound.ts b/src/listeners/commands/slashNotFound.ts index 2179c9b..c5d92bd 100644 --- a/src/listeners/commands/slashNotFound.ts +++ b/src/listeners/commands/slashNotFound.ts @@ -9,7 +9,7 @@ export default class SlashNotFoundListener extends BushListener { }); } - public override async exec(...[interaction]: BushCommandHandlerEvents['slashNotFound']): Promise<void> { + public override async exec(...[interaction]: BushCommandHandlerEvents['slashNotFound']) { void client.console.info('slashNotFound', `<<${interaction?.commandName}>> could not be found.`); } } diff --git a/src/listeners/commands/slashStarted.ts b/src/listeners/commands/slashStarted.ts index aaeecbc..e9e4028 100644 --- a/src/listeners/commands/slashStarted.ts +++ b/src/listeners/commands/slashStarted.ts @@ -8,7 +8,7 @@ export default class SlashStartedListener extends BushListener { category: 'commands' }); } - public override async exec(...[message, command]: BushCommandHandlerEvents['slashStarted']): Promise<unknown> { + public override async exec(...[message, command]: BushCommandHandlerEvents['slashStarted']) { return void client.logger.info( 'slashStarted', `The <<${command.id}>> command was used by <<${message.author.tag}>> in ${ diff --git a/src/listeners/custom/bushBan.ts b/src/listeners/custom/bushBan.ts index 09be0a0..ee5ebcf 100644 --- a/src/listeners/custom/bushBan.ts +++ b/src/listeners/custom/bushBan.ts @@ -10,9 +10,7 @@ export default class BushBanListener extends BushListener { }); } - public override async exec( - ...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BushClientEvents['bushBan'] - ): Promise<unknown> { + public override async exec(...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BushClientEvents['bushBan']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/custom/bushKick.ts b/src/listeners/custom/bushKick.ts index 8df354c..74d90e4 100644 --- a/src/listeners/custom/bushKick.ts +++ b/src/listeners/custom/bushKick.ts @@ -10,9 +10,7 @@ export default class BushKickListener extends BushListener { }); } - public override async exec( - ...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushKick'] - ): Promise<unknown> { + public override async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushKick']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/custom/bushMute.ts b/src/listeners/custom/bushMute.ts index ad95cd6..c5b1d74 100644 --- a/src/listeners/custom/bushMute.ts +++ b/src/listeners/custom/bushMute.ts @@ -10,9 +10,7 @@ export default class BushMuteListener extends BushListener { }); } - public override async exec( - ...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BushClientEvents['bushMute'] - ): Promise<unknown> { + public override async exec(...[victim, moderator, guild, reason, caseID, duration, dmSuccess]: BushClientEvents['bushMute']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/custom/bushPunishRole.ts b/src/listeners/custom/bushPunishRole.ts index 943fce5..f34f1d8 100644 --- a/src/listeners/custom/bushPunishRole.ts +++ b/src/listeners/custom/bushPunishRole.ts @@ -10,9 +10,7 @@ export default class BushPunishRoleListener extends BushListener { }); } - public override async exec( - ...[victim, moderator, guild, reason, caseID, duration]: BushClientEvents['bushPunishRole'] - ): Promise<unknown> { + public override async exec(...[victim, moderator, guild, reason, caseID, duration]: BushClientEvents['bushPunishRole']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/custom/bushPunishRoleRemove.ts b/src/listeners/custom/bushPunishRoleRemove.ts index 8c48e0e..fa09f44 100644 --- a/src/listeners/custom/bushPunishRoleRemove.ts +++ b/src/listeners/custom/bushPunishRoleRemove.ts @@ -10,9 +10,7 @@ export default class BushPunishRoleRemoveListener extends BushListener { }); } - public override async exec( - ...[victim, moderator, guild, reason, caseID, role]: BushClientEvents['bushPunishRoleRemove'] - ): Promise<unknown> { + public override async exec(...[victim, moderator, guild, reason, caseID, role]: BushClientEvents['bushPunishRoleRemove']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/custom/bushPurge.ts b/src/listeners/custom/bushPurge.ts index 7114f4f..ac81916 100644 --- a/src/listeners/custom/bushPurge.ts +++ b/src/listeners/custom/bushPurge.ts @@ -10,7 +10,7 @@ export default class BushPurgeListener extends BushListener { }); } - public override async exec(...[moderator, guild, channel, messages]: BushClientEvents['bushPurge']): Promise<unknown> { + public override async exec(...[moderator, guild, channel, messages]: BushClientEvents['bushPurge']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/custom/bushUnban.ts b/src/listeners/custom/bushUnban.ts index 59b0fc9..b2007fd 100644 --- a/src/listeners/custom/bushUnban.ts +++ b/src/listeners/custom/bushUnban.ts @@ -10,9 +10,7 @@ export default class BushUnbanListener extends BushListener { }); } - public override async exec( - ...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushUnban'] - ): Promise<unknown> { + public override async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushUnban']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/custom/bushUnmute.ts b/src/listeners/custom/bushUnmute.ts index ba1042b..c34cc14 100644 --- a/src/listeners/custom/bushUnmute.ts +++ b/src/listeners/custom/bushUnmute.ts @@ -10,9 +10,7 @@ export default class BushUnmuteListener extends BushListener { }); } - public override async exec( - ...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushUnmute'] - ): Promise<unknown> { + public override async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushUnmute']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/custom/bushUpdateModlog.ts b/src/listeners/custom/bushUpdateModlog.ts index d51696a..62979ae 100644 --- a/src/listeners/custom/bushUpdateModlog.ts +++ b/src/listeners/custom/bushUpdateModlog.ts @@ -10,9 +10,7 @@ export default class BushUpdateModlogListener extends BushListener { }); } - public override async exec( - ...[moderator, modlogID, key, oldModlog, newModlog]: BushClientEvents['bushUpdateModlog'] - ): Promise<unknown> { + public override async exec(...[moderator, modlogID, key, oldModlog, newModlog]: BushClientEvents['bushUpdateModlog']) { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/custom/bushUpdateSettings.ts b/src/listeners/custom/bushUpdateSettings.ts index 39638cc..b95c077 100644 --- a/src/listeners/custom/bushUpdateSettings.ts +++ b/src/listeners/custom/bushUpdateSettings.ts @@ -10,9 +10,7 @@ export default class BushUpdateSettingsListener extends BushListener { }); } - public override async exec( - ...[setting, guild, oldSettings, newSettings, moderator]: BushClientEvents['bushUpdateSettings'] - ): Promise<unknown> { + public override async exec(...[setting, guild, oldSettings, newSettings, moderator]: BushClientEvents['bushUpdateSettings']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; diff --git a/src/listeners/custom/bushWarn.ts b/src/listeners/custom/bushWarn.ts index 16c1d1e..b787b5c 100644 --- a/src/listeners/custom/bushWarn.ts +++ b/src/listeners/custom/bushWarn.ts @@ -10,9 +10,7 @@ export default class BushWarnListener extends BushListener { }); } - public override async exec( - ...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushWarn'] - ): Promise<unknown> { + public override async exec(...[victim, moderator, guild, reason, caseID, dmSuccess]: BushClientEvents['bushWarn']) { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; diff --git a/src/listeners/guild/guildCreate.ts b/src/listeners/guild/guildCreate.ts index 62149c3..68e9216 100644 --- a/src/listeners/guild/guildCreate.ts +++ b/src/listeners/guild/guildCreate.ts @@ -9,7 +9,7 @@ export default class GuildCreateListener extends BushListener { }); } - public override async exec(...[guild]: BushClientEvents['guildCreate']): Promise<void> { + public override async exec(...[guild]: BushClientEvents['guildCreate']) { void client.console.info( 'guildCreate', `Joined <<${guild.name}>> with <<${guild.memberCount?.toLocaleString()}>> members.` diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts index 867101b..2b964f4 100644 --- a/src/listeners/guild/guildMemberAdd.ts +++ b/src/listeners/guild/guildMemberAdd.ts @@ -10,12 +10,12 @@ export default class GuildMemberAddListener extends BushListener { }); } - public override async exec(...[member]: BushClientEvents['guildMemberAdd']): Promise<void> { + public override async exec(...[member]: BushClientEvents['guildMemberAdd']) { void this.sendWelcomeMessage(member); void this.joinAndStickyRoles(member); } - public async sendWelcomeMessage(member: BushGuildMember): Promise<void> { + public async sendWelcomeMessage(member: BushGuildMember) { if (client.config.isDevelopment) return; const welcomeChannel = await member.guild.getSetting('welcomeChannel'); if (!welcomeChannel) return; @@ -45,7 +45,7 @@ export default class GuildMemberAddListener extends BushListener { ); } - public async joinAndStickyRoles(member: BushGuildMember): Promise<void> { + public async joinAndStickyRoles(member: BushGuildMember) { if (client.config.isDevelopment) return; if (await member.guild.hasFeature('stickyRoles')) { const hadRoles = await StickyRole.findOne({ where: { guild: member.guild.id, user: member.id } }); diff --git a/src/listeners/guild/guildMemberRemove.ts b/src/listeners/guild/guildMemberRemove.ts index ff8d2ac..57ed5ce 100644 --- a/src/listeners/guild/guildMemberRemove.ts +++ b/src/listeners/guild/guildMemberRemove.ts @@ -10,12 +10,12 @@ export default class GuildMemberRemoveListener extends BushListener { }); } - public override async exec(...[member]: BushClientEvents['guildMemberRemove']): Promise<void> { + public override async exec(...[member]: BushClientEvents['guildMemberRemove']) { void this.sendWelcomeMessage(member); void this.stickyRoles(member); } - public async sendWelcomeMessage(member: BushGuildMember | PartialBushGuildMember): Promise<void> { + public async sendWelcomeMessage(member: BushGuildMember | PartialBushGuildMember) { if (client.config.isDevelopment) return; const user = member.partial ? await client.users.fetch(member.id) : member.user; await util.sleep(0.05); // ban usually triggers after member leave @@ -47,7 +47,7 @@ export default class GuildMemberRemoveListener extends BushListener { ); } - public async stickyRoles(member: BushGuildMember | PartialBushGuildMember): Promise<void> { + public async stickyRoles(member: BushGuildMember | PartialBushGuildMember) { if (!(await member.guild.hasFeature('stickyRoles'))) return; if (member.partial) { await member.guild.members.fetch(); // try to prevent in the future diff --git a/src/listeners/guild/syncUnban.ts b/src/listeners/guild/syncUnban.ts index 48f068f..db654b8 100644 --- a/src/listeners/guild/syncUnban.ts +++ b/src/listeners/guild/syncUnban.ts @@ -9,7 +9,7 @@ export default class SyncUnbanListener extends BushListener { }); } - public override async exec(...[ban]: BushClientEvents['guildBanRemove']): Promise<void> { + public override async exec(...[ban]: BushClientEvents['guildBanRemove']) { const bans = await ActivePunishment.findAll({ where: { user: ban.user.id, diff --git a/src/listeners/message/autoPublisher.ts b/src/listeners/message/autoPublisher.ts index aa91f5d..fa5cb51 100644 --- a/src/listeners/message/autoPublisher.ts +++ b/src/listeners/message/autoPublisher.ts @@ -9,7 +9,7 @@ export default class autoPublisherListener extends BushListener { }); } - public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { + public override async exec(...[message]: BushClientEvents['messageCreate']) { if (!message.guild || !(await message.guild.hasFeature('autoPublish'))) return; const autoPublishChannels = await message.guild.getSetting('autoPublishChannels'); if (autoPublishChannels) { diff --git a/src/listeners/message/automodCreate.ts b/src/listeners/message/automodCreate.ts index 9619cf8..0bf4c29 100644 --- a/src/listeners/message/automodCreate.ts +++ b/src/listeners/message/automodCreate.ts @@ -9,7 +9,7 @@ export default class AutomodMessageCreateListener extends BushListener { }); } - public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<unknown> { + public override async exec(...[message]: BushClientEvents['messageCreate']) { return new AutoMod(message); } } diff --git a/src/listeners/message/automodUpdate.ts b/src/listeners/message/automodUpdate.ts index 18fbb2e..ff89a09 100644 --- a/src/listeners/message/automodUpdate.ts +++ b/src/listeners/message/automodUpdate.ts @@ -9,7 +9,7 @@ export default class AutomodMessageUpdateListener extends BushListener { }); } - public override async exec(...[_, newMessage]: BushClientEvents['messageUpdate']): Promise<unknown> { + public override async exec(...[_, newMessage]: BushClientEvents['messageUpdate']) { const fullMessage = newMessage.partial ? await newMessage.fetch() : (newMessage as BushMessage); return new AutoMod(fullMessage); } diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts index dd72d88..11af787 100644 --- a/src/listeners/message/blacklistedFile.ts +++ b/src/listeners/message/blacklistedFile.ts @@ -64,7 +64,7 @@ export default class BlacklistedFileListener extends BushListener { }); } - public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { + public override async exec(...[message]: BushClientEvents['messageCreate']) { if (!message.guild || !(await message.guild.hasFeature('blacklistedFile'))) return; const embedAttachments = message.embeds.filter((e) => ['image', 'video', 'gifv'].includes(e.type)); const foundEmojis = [...message.content.matchAll(/<(?<animated>a?):\w+:(?<id>\d+)>/g)]; diff --git a/src/listeners/message/boosterMessage.ts b/src/listeners/message/boosterMessage.ts index cb595d4..a161784 100644 --- a/src/listeners/message/boosterMessage.ts +++ b/src/listeners/message/boosterMessage.ts @@ -9,7 +9,7 @@ export default class BoosterMessageListener extends BushListener { }); } - public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<unknown> { + public override async exec(...[message]: BushClientEvents['messageCreate']) { if (!message.guild || !(await message.guild?.hasFeature('boosterMessageReact'))) return; if (message.type === 'USER_PREMIUM_GUILD_SUBSCRIPTION') { return await message.react('<:nitroboost:785160348885975062>').catch(() => { diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index f0cb532..41e4792 100644 --- a/src/listeners/message/directMessage.ts +++ b/src/listeners/message/directMessage.ts @@ -10,7 +10,7 @@ export default class DirectMessageListener extends BushListener { }); } - public override async exec(...[message]: BushClientEvents['messageCreate']): Promise<void> { + public override async exec(...[message]: BushClientEvents['messageCreate']) { if (message.channel.type === 'DM') { if (!(message.author.id == client.user!.id) && message.author.bot) return; if (client.cache.global.blacklistedUsers.includes(message.author.id)) return; diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts index f263ff2..06e0485 100644 --- a/src/listeners/message/level.ts +++ b/src/listeners/message/level.ts @@ -10,7 +10,7 @@ export default class LevelListener extends BushListener { category: 'message' }); } - public override async exec(...[message]: BushCommandHandlerEvents['messageInvalid']): Promise<void> { + public override async exec(...[message]: BushCommandHandlerEvents['messageInvalid']) { if (message.author.bot || !message.author || !message.guild) return; if (this.#levelCooldowns.has(`${message.guild.id}-${message.author.id}`)) return; diff --git a/src/listeners/other/consoleListener.ts b/src/listeners/other/consoleListener.ts index 6092f05..fab9119 100644 --- a/src/listeners/other/consoleListener.ts +++ b/src/listeners/other/consoleListener.ts @@ -10,7 +10,7 @@ export default class ConsoleListener extends BushListener { }); } - public override async exec(line: string): Promise<void> { + public override async exec(line: string) { if (line.startsWith('eval ') || line.startsWith('ev ')) { /* eslint-disable @typescript-eslint/no-unused-vars */ const sh = promisify(exec), diff --git a/src/listeners/other/exit.ts b/src/listeners/other/exit.ts index e860eda..4ea6068 100644 --- a/src/listeners/other/exit.ts +++ b/src/listeners/other/exit.ts @@ -8,7 +8,7 @@ export default class ExitListener extends BushListener { }); } - public override async exec(code: number): Promise<void> { + public override async exec(code: number) { await client.console.error('processExit', `Process ended with code <<${code}>>.`); } } diff --git a/src/listeners/other/promiseRejection.ts b/src/listeners/other/promiseRejection.ts index dc21c3f..45e647e 100644 --- a/src/listeners/other/promiseRejection.ts +++ b/src/listeners/other/promiseRejection.ts @@ -9,7 +9,7 @@ export default class PromiseRejectionListener extends BushListener { }); } - public override async exec(error: Error): Promise<void> { + public override async exec(error: Error) { void client.console.error( 'promiseRejection', `An unhanded promise rejection occurred:\n${typeof error == 'object' ? error.stack : error}`, diff --git a/src/listeners/other/uncaughtException.ts b/src/listeners/other/uncaughtException.ts index 4ba47bd..8eb4294 100644 --- a/src/listeners/other/uncaughtException.ts +++ b/src/listeners/other/uncaughtException.ts @@ -9,7 +9,7 @@ export default class UncaughtExceptionListener extends BushListener { }); } - public override async exec(error: Error): Promise<void> { + public override async exec(error: Error) { void client.console.error( 'uncaughtException', `An uncaught exception occurred:\n${typeof error == 'object' ? error.stack : error}`, diff --git a/src/listeners/other/warning.ts b/src/listeners/other/warning.ts index d85e9e3..51f67ba 100644 --- a/src/listeners/other/warning.ts +++ b/src/listeners/other/warning.ts @@ -9,7 +9,7 @@ export default class WarningListener extends BushListener { }); } - public override async exec(error: Error): Promise<void> { + public override async exec(error: Error) { void client.console.warn('warning', `A warning occurred:\n${typeof error == 'object' ? error.stack : error}`, false); void client.console.channelError({ embeds: [ diff --git a/src/tasks/cpuUsage.ts b/src/tasks/cpuUsage.ts index a7398d7..b22923a 100644 --- a/src/tasks/cpuUsage.ts +++ b/src/tasks/cpuUsage.ts @@ -8,7 +8,7 @@ export default class CpuUsageTask extends BushTask { runOnStart: true }); } - public override async exec(): Promise<void> { + public override async exec() { const cpu = await osu.cpu.usage(client.stats.cpu === undefined ? 100 : 60_000); client.stats.cpu = cpu; } diff --git a/src/tasks/removeExpiredPunishements.ts b/src/tasks/removeExpiredPunishements.ts index a5f9d73..b39cdb7 100644 --- a/src/tasks/removeExpiredPunishements.ts +++ b/src/tasks/removeExpiredPunishements.ts @@ -8,7 +8,7 @@ export default class RemoveExpiredPunishmentsTask extends BushTask { runOnStart: true }); } - public override async exec(): Promise<void> { + public override async exec() { const expiredEntries = await ActivePunishment.findAll({ where: { expires: { diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts index b8df336..11d6ca9 100644 --- a/src/tasks/updateCache.ts +++ b/src/tasks/updateCache.ts @@ -9,18 +9,18 @@ export default class UpdateCacheTask extends BushTask { runOnStart: false // done in preinit task }); } - public override async exec(): Promise<void> { + public override async exec() { await UpdateCacheTask.updateGlobalCache(client); await UpdateCacheTask.#updateGuildCache(client); void client.logger.verbose(`UpdateCache`, `Updated cache.`); } - public static async init(client: BushClient): Promise<void> { + public static async init(client: BushClient) { await UpdateCacheTask.updateGlobalCache(client); await UpdateCacheTask.#updateGuildCache(client); } - private static async updateGlobalCache(client: BushClient): Promise<void> { + private static async updateGlobalCache(client: BushClient) { const environment = config.environment; const row: { [x: string]: any } = ((await Global.findByPk(environment)) ?? (await Global.create({ environment }))).toJSON(); @@ -32,7 +32,7 @@ export default class UpdateCacheTask extends BushTask { } } - static async #updateGuildCache(client: BushClient): Promise<void> { + static async #updateGuildCache(client: BushClient) { const rows = await Guild.findAll(); for (const row of rows) { client.cache.guilds.set(row.id, row.toJSON() as Guild); diff --git a/src/tasks/updateStats.ts b/src/tasks/updateStats.ts index 74a8114..ad3cb45 100644 --- a/src/tasks/updateStats.ts +++ b/src/tasks/updateStats.ts @@ -8,7 +8,7 @@ export default class UpdateStatsTask extends BushTask { runOnStart: true }); } - public override async exec(): Promise<void> { + public override async exec() { const row = (await Stat.findByPk(client.config.environment)) ?? (await Stat.create({ environment: client.config.environment })); row.commandsUsed = client.stats.commandsUsed; diff --git a/src/tasks/updateSuperUsers.ts b/src/tasks/updateSuperUsers.ts index e0e51f5..19dbb1e 100644 --- a/src/tasks/updateSuperUsers.ts +++ b/src/tasks/updateSuperUsers.ts @@ -8,7 +8,7 @@ export default class UpdateSuperUsersTask extends BushTask { runOnStart: true }); } - public override async exec(): Promise<void> { + public override async exec() { const superUsers = client.guilds.cache .get(client.config.supportGuild.id) ?.members.cache.filter( |