1- import { EmbedBuilder , ChatInputCommandInteraction , MessageFlagsBitField } from 'discord.js' ;
1+ import { EmbedBuilder , ChatInputCommandInteraction , MessageFlagsBitField , SlashCommandBuilder , SharedSlashCommand } from 'discord.js' ;
22import Command from './commandHandlers/Command.js' ;
33import { MentionRegistry } from '../mentions/MentionRegistry.js' ;
44import BotConfig from '../BotConfig.js' ;
55import { ChannelConfigUtil } from '../util/ChannelConfigUtil.js' ;
66import SlashCommand from './commandHandlers/SlashCommand.js' ;
77
88export default class BugCommand extends SlashCommand {
9- public slashCommandBuilder = this . slashCommandBuilder
10- . setName ( 'bug' )
11- . setDescription ( 'Creates a embed with info from a ticket in Jira.' )
12- . addStringOption ( option =>
13- option . setName ( 'ticket-id' )
14- . setDescription ( 'The ID of the ticket.' )
15- . setRequired ( true )
16- ) ;
9+ public build ( ) : SharedSlashCommand {
10+ return new SlashCommandBuilder ( )
11+ . setName ( 'bug' )
12+ . setDescription ( 'Creates a embed with info from a ticket in Jira.' )
13+ . addStringOption ( option =>
14+ option . setName ( 'ticket-id' )
15+ . setDescription ( 'The ID of the ticket.' )
16+ . setRequired ( true )
17+ ) ;
18+ }
1719
1820 public async run ( interaction : ChatInputCommandInteraction ) : Promise < boolean > {
1921 if ( interaction . channel === null ) return false ;
@@ -30,8 +32,8 @@ export default class BugCommand extends SlashCommand {
3032 if ( ! ticketRegex . test ( ticket ) ) {
3133 try {
3234 await interaction . reply ( { content : `'${ ticket } ' is not a valid ticket ID.` , flags : [ MessageFlagsBitField . Flags . Ephemeral ] } ) ;
33- } catch ( err ) {
34- Command . logger . log ( err ) ;
35+ } catch ( error ) {
36+ Command . logger . log ( error as string ) ;
3537 return false ;
3638 }
3739 return true ;
@@ -43,11 +45,11 @@ export default class BugCommand extends SlashCommand {
4345 let embed : EmbedBuilder ;
4446 try {
4547 embed = await mention . getEmbed ( ) ;
46- } catch ( err ) {
48+ } catch ( error ) {
4749 try {
48- await interaction . reply ( { content : err , flags : [ MessageFlagsBitField . Flags . Ephemeral ] } ) ;
49- } catch ( err ) {
50- Command . logger . log ( err ) ;
50+ await interaction . reply ( { content : error as string , flags : [ MessageFlagsBitField . Flags . Ephemeral ] } ) ;
51+ } catch ( innerError ) {
52+ Command . logger . log ( innerError as string ) ;
5153 return false ;
5254 }
5355 return true ;
0 commit comments