@@ -23,23 +23,27 @@ const command: Command = {
2323 enabled : true ,
2424 deferReply : true ,
2525 ephemeral : true ,
26- async execute ( interaction : ChatInputCommandInteraction & any , client : ExtendedClient , Discord : typeof import ( "discord.js" ) ) {
26+ async execute (
27+ interaction : ChatInputCommandInteraction & any ,
28+ client : ExtendedClient ,
29+ Discord : typeof import ( "discord.js" )
30+ ) {
2731 try {
2832 const cmd : any = interaction . options . get ( "command" ) ?. value ;
2933
3034 const commands : string [ ] = [ ] ;
3135
3236 async function pushRoot ( ) {
33- const files = fs . readdirSync ( `./dist/commands` ) . filter ( file => file . endsWith ( ".js" ) ) ;
37+ const files = fs . readdirSync ( `./dist/commands` ) . filter ( ( file ) => file . endsWith ( ".js" ) ) ;
3438
35- for ( const file of files ) {
39+ for ( const file of files ) {
3640 const command = require ( `../${ file } ` ) ;
3741
38- if ( command . name ) {
39- if ( ! command . enabled ) continue ;
42+ if ( command . name ) {
43+ if ( ! command . enabled ) continue ;
4044
41- if ( command . default_member_permissions ) {
42- if ( ! interaction . member . permissions . has ( command . default_member_permissions ) ) continue ;
45+ if ( command . default_member_permissions ) {
46+ if ( ! interaction . member . permissions . has ( command . default_member_permissions ) ) continue ;
4347 }
4448
4549 commands . push ( command . name ) ;
@@ -50,16 +54,16 @@ const command: Command = {
5054 }
5155
5256 async function pushDir ( dir : String ) {
53- const files = fs . readdirSync ( `./dist/commands/${ dir } ` ) . filter ( file => file . endsWith ( ".js" ) ) ;
57+ const files = fs . readdirSync ( `./dist/commands/${ dir } ` ) . filter ( ( file ) => file . endsWith ( ".js" ) ) ;
5458
55- for ( const file of files ) {
59+ for ( const file of files ) {
5660 const command = require ( `../${ dir } /${ file } ` ) ;
5761
58- if ( command . name ) {
59- if ( ! command . enabled ) continue ;
62+ if ( command . name ) {
63+ if ( ! command . enabled ) continue ;
6064
61- if ( command . default_member_permissions ) {
62- if ( ! interaction . member . permissions . has ( command . default_member_permissions ) ) continue ;
65+ if ( command . default_member_permissions ) {
66+ if ( ! interaction . member . permissions . has ( command . default_member_permissions ) ) continue ;
6367 }
6468
6569 commands . push ( command . name ) ;
@@ -70,52 +74,61 @@ const command: Command = {
7074 }
7175
7276 await pushRoot ( ) ;
73- ( await getDirs ( "./dist/commands" ) ) . forEach ( dir => pushDir ( dir ) ) ;
77+ ( await getDirs ( "./dist/commands" ) ) . forEach ( ( dir ) => pushDir ( dir ) ) ;
7478
7579 const cmds = [ ] ;
7680
77- for ( const cmd of commands ) {
81+ for ( const cmd of commands ) {
7882 const info = client . commands . get ( cmd ) ;
7983
8084 cmds . push ( `</${ cmd } :${ client . commandIds . get ( cmd ) } >\n${ emoji . reply } ${ info . description } ` ) ;
8185 }
8286
8387 const help = new Discord . EmbedBuilder ( )
8488 . setColor ( client . config . embeds . default as ColorResolvable )
85- . setThumbnail ( client . user ?. displayAvatarURL ( { extension : "png" , forceStatic : false } ) )
89+ . setThumbnail (
90+ client . user ?. displayAvatarURL ( {
91+ extension : "png" ,
92+ forceStatic : false
93+ } )
94+ )
8695 . setTitle ( "Commands" )
8796 . setDescription ( cmds . sort ( ) . join ( "\n" ) )
88- . setTimestamp ( )
97+ . setTimestamp ( ) ;
8998
9099 // If a command was specified, get info on that command
91100 const command = client . commands . get ( cmd ) ;
92101
93- if ( command ) {
94- if ( ! command . enabled ) return await interaction . editReply ( { embeds : [ help ] } ) ;
102+ if ( command ) {
103+ if ( ! command . enabled ) return await interaction . editReply ( { embeds : [ help ] } ) ;
95104
96105 const description = command . description ?? "N/A" ;
97- const botPermissions = command . botPermissions . length ? `\`${ command . botPermissions . join ( "\`, \`" ) } \`` : "N/A" ;
98- const cooldown = command . cooldown ? `${ command . cooldown } second${ command . cooldown === 1 ? "" : "s" } ` : "None" ;
106+ const botPermissions = command . botPermissions . length
107+ ? `\`${ command . botPermissions . join ( "`, `" ) } \``
108+ : "N/A" ;
109+ const cooldown = command . cooldown
110+ ? `${ command . cooldown } second${ command . cooldown === 1 ? "" : "s" } `
111+ : "None" ;
99112
100113 const commandHelp = new Discord . EmbedBuilder ( )
101114 . setColor ( client . config . embeds . default as ColorResolvable )
102115 . setTitle ( `Command: ${ command . name } ` )
103- . addFields (
116+ . addFields (
104117 { name : "Description" , value : description } ,
105118 { name : "Cooldown" , value : cooldown } ,
106119 { name : "Bot Permissions" , value : botPermissions }
107120 )
108- . setTimestamp ( )
121+ . setTimestamp ( ) ;
109122
110123 await interaction . editReply ( { embeds : [ commandHelp ] } ) ;
111124 return ;
112125 }
113126
114127 await interaction . editReply ( { embeds : [ help ] } ) ;
115- } catch ( err ) {
128+ } catch ( err ) {
116129 client . logCommandError ( err , interaction , Discord ) ;
117130 }
118131 }
119- }
132+ } ;
120133
121134export = command ;
0 commit comments