diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/config/prefix.ts | 8 | ||||
-rw-r--r-- | src/commands/dev/reload.ts | 8 | ||||
-rw-r--r-- | src/commands/dev/setLevel.ts | 10 | ||||
-rw-r--r-- | src/commands/info/botInfo.ts | 3 | ||||
-rw-r--r-- | src/commands/info/help.ts | 8 | ||||
-rw-r--r-- | src/commands/info/ping.ts | 3 | ||||
-rw-r--r-- | src/commands/info/pronouns.ts | 8 | ||||
-rw-r--r-- | src/commands/moderation/ban.ts | 12 | ||||
-rw-r--r-- | src/commands/moderation/kick.ts | 10 | ||||
-rw-r--r-- | src/commands/moulberry-bush/capePerms.ts | 8 | ||||
-rw-r--r-- | src/commands/moulberry-bush/level.ts | 8 | ||||
-rw-r--r-- | src/commands/moulberry-bush/rule.ts | 10 | ||||
-rw-r--r-- | src/lib/extensions/BushClient.ts | 4 | ||||
-rw-r--r-- | src/lib/extensions/BushCommandHandler.ts | 1 | ||||
-rw-r--r-- | src/lib/extensions/BushTaskHandler.ts | 3 | ||||
-rw-r--r-- | src/lib/models/Modlog.ts | 3 | ||||
-rw-r--r-- | src/listeners/client/syncSlashCommands.ts | 19 |
17 files changed, 55 insertions, 71 deletions
diff --git a/src/commands/config/prefix.ts b/src/commands/config/prefix.ts index c20cfa5..9ddf81b 100644 --- a/src/commands/config/prefix.ts +++ b/src/commands/config/prefix.ts @@ -1,4 +1,3 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; import { Guild as DiscordGuild, Message } from 'discord.js'; import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; @@ -21,14 +20,15 @@ export default class PrefixCommand extends BushCommand { usage: 'prefix [prefix]', examples: ['prefix', 'prefix +'] }, - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.STRING, + type: 'STRING', name: 'prefix', description: 'The prefix to set for this server', required: false } - ] + ], + slash: true }); } diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index 82a98a0..9aee9a7 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -1,5 +1,4 @@ import { stripIndent } from 'common-tags'; -import { ApplicationCommandOptionType } from 'discord-api-types'; import { Message } from 'discord.js'; import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; @@ -24,14 +23,15 @@ export default class ReloadCommand extends BushCommand { ], ownerOnly: true, typing: true, - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.BOOLEAN, + type: 'BOOLEAN', name: 'fast', description: 'Whether to use esbuild for fast compiling or not', required: false } - ] + ], + slash: true }); } diff --git a/src/commands/dev/setLevel.ts b/src/commands/dev/setLevel.ts index 4f97528..5a702e9 100644 --- a/src/commands/dev/setLevel.ts +++ b/src/commands/dev/setLevel.ts @@ -1,4 +1,3 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; import { Message, User } from 'discord.js'; import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; @@ -35,20 +34,21 @@ export default class SetLevelCommand extends BushCommand { } ], ownerOnly: true, - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.USER, + type: 'USER', name: 'user', description: 'The user to change the level of', required: true }, { - type: ApplicationCommandOptionType.INTEGER, + type: 'INTEGER', name: 'level', description: 'The level to set the user to', required: true } - ] + ], + slash: true }); } diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index 66bf5af..406ea2d 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -12,7 +12,8 @@ export default class BotInfoCommand extends BushCommand { content: 'Shows information about the bot', usage: 'botinfo', examples: ['botinfo'] - } + }, + slash: true }); } diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 8dac8ee..e7998a4 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -1,5 +1,4 @@ import { stripIndent } from 'common-tags'; -import { ApplicationCommandOptionType } from 'discord-api-types'; import { Message, MessageEmbed } from 'discord.js'; import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; @@ -22,14 +21,15 @@ export default class HelpCommand extends BushCommand { type: 'commandAlias' } ], - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.STRING, + type: 'STRING', name: 'command', description: 'The command to get help for', required: false } - ] + ], + slash: true }); } diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index f0d017e..f0b4a2f 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -11,7 +11,8 @@ export default class PingCommand extends BushCommand { content: 'Gets the latency of the bot', usage: 'ping', examples: ['ping'] - } + }, + slash: true }); } diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index bade100..83aa5ca 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -1,4 +1,3 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteraction, Message, MessageEmbed, User } from 'discord.js'; import got, { HTTPError } from 'got'; import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; @@ -48,15 +47,16 @@ export default class PronounsCommand extends BushCommand { } ], clientPermissions: ['SEND_MESSAGES'], - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.USER, + type: 'USER', name: 'user', description: 'The user to get pronouns for', required: false } ], - slashEphemeral: true // I'll add dynamic checking to this later + slashEphemeral: true, // I'll add dynamic checking to this later + slash: true }); } async sendResponse(message: Message | CommandInteraction, user: User, author: boolean): Promise<void> { diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 4847d19..a493071 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -1,4 +1,3 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteraction, Message, User } from 'discord.js'; import moment from 'moment'; import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; @@ -46,26 +45,27 @@ export default class BanCommand extends BushCommand { usage: 'ban <member> <reason> [--time]', examples: ['ban @Tyman being cool', 'ban @Tyman being cool --time 7days'] }, - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.USER, + type: 'USER', name: 'user', description: 'The user to ban', required: true }, { - type: ApplicationCommandOptionType.STRING, + type: 'STRING', name: 'reason', description: 'The reason to show in modlogs and audit log', required: false }, { - type: ApplicationCommandOptionType.STRING, + type: 'STRING', name: 'time', description: 'The time the user should be banned for (default permanent)', required: false } - ] + ], + slash: true }); } async *genResponses( diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index 7bd53e0..b97fe91 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -1,4 +1,3 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteraction, GuildMember, Message } from 'discord.js'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; @@ -29,20 +28,21 @@ export default class KickCommand extends BushCommand { usage: 'kick <member> <reason>', examples: ['kick @Tyman being cool'] }, - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.USER, + type: 'USER', name: 'user', description: 'The user to kick', required: true }, { - type: ApplicationCommandOptionType.STRING, + type: 'STRING', name: 'reason', description: 'The reason to show in modlogs and audit log', required: false } - ] + ], + slash: true }); } diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts index 380ed2d..1592175 100644 --- a/src/commands/moulberry-bush/capePerms.ts +++ b/src/commands/moulberry-bush/capePerms.ts @@ -1,4 +1,3 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; import { Message, MessageEmbed } from 'discord.js'; import got from 'got'; import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; @@ -64,14 +63,15 @@ export default class CapePermissionsCommand extends BushCommand { ], clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'], channel: 'guild', - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.STRING, + type: 'STRING', name: 'user', description: 'The username of the player to see the cape permissions of', required: true } - ] + ], + slash: true }); } private async getResponse(user: string): Promise<{ content?: string; embeds?: MessageEmbed[] }> { diff --git a/src/commands/moulberry-bush/level.ts b/src/commands/moulberry-bush/level.ts index f53aa64..64d6dad 100644 --- a/src/commands/moulberry-bush/level.ts +++ b/src/commands/moulberry-bush/level.ts @@ -1,4 +1,3 @@ -import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteractionOption, Message, User } from 'discord.js'; import { BushCommand } from '../../lib/extensions/BushCommand'; import { BushInteractionMessage } from '../../lib/extensions/BushInteractionMessage'; @@ -32,14 +31,15 @@ export default class LevelCommand extends BushCommand { } } ], - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.USER, + type: 'USER', name: 'user', description: 'The user to get the level of', required: false } - ] + ], + slash: true }); } diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 674b776..16cda5e 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,5 +1,4 @@ import { Argument } from 'discord-akairo'; -import { ApplicationCommandOptionType } from 'discord-api-types'; import { CommandInteraction, Message, MessageEmbed, User } from 'discord.js'; import { SlashCommandOption } from '../../lib/extensions/BushClientUtil'; import { BushCommand } from '../../lib/extensions/BushCommand'; @@ -98,20 +97,21 @@ export default class RuleCommand extends BushCommand { ], clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'], channel: 'guild', - slashCommandOptions: [ + slashOptions: [ { - type: ApplicationCommandOptionType.INTEGER, + type: 'INTEGER', name: 'rule', description: 'The rule to show', required: false }, { - type: ApplicationCommandOptionType.USER, + type: 'USER', name: 'user', description: 'The user to ping', required: false } - ] + ], + slash: true }); } private getResponse( diff --git a/src/lib/extensions/BushClient.ts b/src/lib/extensions/BushClient.ts index 1bd3493..5c7729c 100644 --- a/src/lib/extensions/BushClient.ts +++ b/src/lib/extensions/BushClient.ts @@ -90,7 +90,9 @@ export class BushClient extends AkairoClient { otherwise: '' }, ignorePermissions: this.config.owners, - ignoreCooldown: this.config.owners + ignoreCooldown: this.config.owners, + automateCategories: true, + autoRegisterSlashCommands: true }); this.util = new BushClientUtil(this); diff --git a/src/lib/extensions/BushCommandHandler.ts b/src/lib/extensions/BushCommandHandler.ts index 670125d..b6501c2 100644 --- a/src/lib/extensions/BushCommandHandler.ts +++ b/src/lib/extensions/BushCommandHandler.ts @@ -16,6 +16,7 @@ export const ArgumentMatches = { REST_CONTENT: 'restContent', NONE: 'none' }; +export type BushCommandHandlerOptions = CommandHandlerOptions; export const ArgumentTypes = { STRING: 'string', diff --git a/src/lib/extensions/BushTaskHandler.ts b/src/lib/extensions/BushTaskHandler.ts index c76dbfb..923e42b 100644 --- a/src/lib/extensions/BushTaskHandler.ts +++ b/src/lib/extensions/BushTaskHandler.ts @@ -1,8 +1,7 @@ import { AkairoHandlerOptions, TaskHandler } from 'discord-akairo'; import { BushClient } from './BushClient'; -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface BushTaskHandlerOptions extends AkairoHandlerOptions {} +export type BushTaskHandlerOptions = AkairoHandlerOptions; export class BushTaskHandler extends TaskHandler { public constructor(client: BushClient, options: BushTaskHandlerOptions) { diff --git a/src/lib/models/Modlog.ts b/src/lib/models/Modlog.ts index 3917a88..5a2cb69 100644 --- a/src/lib/models/Modlog.ts +++ b/src/lib/models/Modlog.ts @@ -1,7 +1,6 @@ import { DataTypes, Sequelize } from 'sequelize'; -import { BaseModel } from './BaseModel'; import { v4 as uuidv4 } from 'uuid'; -import * as Models from './'; +import { BaseModel } from './BaseModel'; export enum ModlogType { BAN = 'BAN', diff --git a/src/listeners/client/syncSlashCommands.ts b/src/listeners/client/syncSlashCommands.ts deleted file mode 100644 index 69b91bc..0000000 --- a/src/listeners/client/syncSlashCommands.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { BushListener } from '../../lib/extensions/BushListener'; - -export default class SyncSlashCommandsListener extends BushListener { - constructor() { - super('syncslashcommands', { - emitter: 'client', - event: 'ready' - }); - } - async exec(): Promise<void> { - if (this.client.config.dev && this.client.config.devGuild) { - // Use guild slash commands for instant registration in dev - await this.client.util.syncSlashCommands(false, this.client.config.devGuild); - } else { - // Use global in production - await this.client.util.syncSlashCommands(); - } - } -} |