@@ -16,7 +16,9 @@ export default async function registerCommands(commandHandler: CommandHandler) {
1616
1717 if ( ! guild ) {
1818 console . log (
19- colors . yellow ( `⏩ Ignoring: Guild ${ devGuildId } does not exist or client isn't in this guild.` )
19+ colors . yellow (
20+ `⏩ Ignoring: Guild ${ devGuildId } does not exist or client isn't in this guild.` ,
21+ ) ,
2022 ) ;
2123 continue ;
2224 }
@@ -38,33 +40,41 @@ export default async function registerCommands(commandHandler: CommandHandler) {
3840 for ( const command of commands ) {
3941 // <!-- Delete command if options.deleted -->
4042 if ( command . options ?. deleted ) {
41- const targetCommand = appCommands ?. cache . find ( ( cmd ) => cmd . name === command . data . name ) ;
43+ const targetCommand = appCommands ?. cache . find (
44+ ( cmd ) => cmd . name === command . data . name ,
45+ ) ;
4246
4347 if ( ! targetCommand ) {
4448 console . log (
45- colors . yellow ( `⏩ Ignoring: Command "${ command . data . name } " is globally marked as deleted.` )
49+ colors . yellow (
50+ `⏩ Ignoring: Command "${ command . data . name } " is globally marked as deleted.` ,
51+ ) ,
4652 ) ;
4753 } else {
4854 targetCommand . delete ( ) . then ( ( ) => {
49- console . log ( colors . green ( `🚮 Deleted command "${ command . data . name } " globally.` ) ) ;
55+ console . log (
56+ colors . green ( `🚮 Deleted command "${ command . data . name } " globally.` ) ,
57+ ) ;
5058 } ) ;
5159 }
5260
5361 for ( const guildCommands of devGuildCommands ) {
54- const targetCommand = guildCommands . cache . find ( ( cmd ) => cmd . name === command . data . name ) ;
62+ const targetCommand = guildCommands . cache . find (
63+ ( cmd ) => cmd . name === command . data . name ,
64+ ) ;
5565
5666 if ( ! targetCommand ) {
5767 console . log (
5868 colors . yellow (
59- `⏩ Ignoring: Command "${ command . data . name } " is marked as deleted for ${ guildCommands . guild . name } .`
60- )
69+ `⏩ Ignoring: Command "${ command . data . name } " is marked as deleted for ${ guildCommands . guild . name } .` ,
70+ ) ,
6171 ) ;
6272 } else {
6373 targetCommand . delete ( ) . then ( ( ) => {
6474 console . log (
6575 colors . green (
66- `🚮 Deleted command "${ command . data . name } " in ${ guildCommands . guild . name } .`
67- )
76+ `🚮 Deleted command "${ command . data . name } " in ${ guildCommands . guild . name } .` ,
77+ ) ,
6878 ) ;
6979 } ) ;
7080 }
@@ -78,19 +88,30 @@ export default async function registerCommands(commandHandler: CommandHandler) {
7888 let editedCommand = false ;
7989
8090 // Edit command globally
81- const appGlobalCommand = appCommands ?. cache . find ( ( cmd ) => cmd . name === command . data . name ) ;
91+ const appGlobalCommand = appCommands ?. cache . find (
92+ ( cmd ) => cmd . name === command . data . name ,
93+ ) ;
8294
8395 if ( appGlobalCommand ) {
84- const commandsAreDifferent = areSlashCommandsDifferent ( appGlobalCommand , commandData ) ;
96+ const commandsAreDifferent = areSlashCommandsDifferent (
97+ appGlobalCommand ,
98+ commandData ,
99+ ) ;
85100
86101 if ( commandsAreDifferent ) {
87102 appGlobalCommand
88103 . edit ( commandData )
89104 . then ( ( ) => {
90- console . log ( colors . green ( `✅ Edited command "${ commandData . name } " globally.` ) ) ;
105+ console . log (
106+ colors . green ( `✅ Edited command "${ commandData . name } " globally.` ) ,
107+ ) ;
91108 } )
92109 . catch ( ( error ) => {
93- console . log ( colors . red ( `❌ Failed to edit command "${ commandData . name } " globally.` ) ) ;
110+ console . log (
111+ colors . red (
112+ `❌ Failed to edit command "${ commandData . name } " globally.` ,
113+ ) ,
114+ ) ;
94115 console . error ( error ) ;
95116 } ) ;
96117
@@ -100,26 +121,31 @@ export default async function registerCommands(commandHandler: CommandHandler) {
100121
101122 // Edit command in a specific guild
102123 for ( const guildCommands of devGuildCommands ) {
103- const appGuildCommand = guildCommands . cache . find ( ( cmd ) => cmd . name === commandData . name ) ;
124+ const appGuildCommand = guildCommands . cache . find (
125+ ( cmd ) => cmd . name === commandData . name ,
126+ ) ;
104127
105128 if ( appGuildCommand ) {
106- const commandsAreDifferent = areSlashCommandsDifferent ( appGuildCommand , commandData ) ;
129+ const commandsAreDifferent = areSlashCommandsDifferent (
130+ appGuildCommand ,
131+ commandData ,
132+ ) ;
107133
108134 if ( commandsAreDifferent ) {
109135 appGuildCommand
110136 . edit ( commandData )
111137 . then ( ( ) => {
112138 console . log (
113139 colors . green (
114- `✅ Edited command "${ commandData . name } " in ${ guildCommands . guild . name } .`
115- )
140+ `✅ Edited command "${ commandData . name } " in ${ guildCommands . guild . name } .` ,
141+ ) ,
116142 ) ;
117143 } )
118144 . catch ( ( error ) => {
119145 console . log (
120146 colors . red (
121- `❌ Failed to edit command "${ commandData . name } " in ${ guildCommands . guild . name } .`
122- )
147+ `❌ Failed to edit command "${ commandData . name } " in ${ guildCommands . guild . name } .` ,
148+ ) ,
123149 ) ;
124150 console . error ( error ) ;
125151 } ) ;
@@ -137,24 +163,32 @@ export default async function registerCommands(commandHandler: CommandHandler) {
137163 if ( ! devGuilds . length ) {
138164 console . log (
139165 colors . yellow (
140- `⏩ Ignoring: Cannot register command "${ command . data . name } " as no valid "devGuildIds" were provided.`
141- )
166+ `⏩ Ignoring: Cannot register command "${ command . data . name } " as no valid "devGuildIds" were provided.` ,
167+ ) ,
142168 ) ;
143169 continue ;
144170 }
145171
146172 for ( const guild of devGuilds ) {
147- const cmdExists = guild . commands . cache . some ( ( cmd ) => cmd . name === command . data . name ) ;
173+ const cmdExists = guild . commands . cache . some (
174+ ( cmd ) => cmd . name === command . data . name ,
175+ ) ;
148176 if ( cmdExists ) continue ;
149177
150178 guild ?. commands
151179 . create ( command . data )
152180 . then ( ( ) => {
153- console . log ( colors . green ( `✅ Registered command "${ command . data . name } " in ${ guild . name } .` ) ) ;
181+ console . log (
182+ colors . green (
183+ `✅ Registered command "${ command . data . name } " in ${ guild . name } .` ,
184+ ) ,
185+ ) ;
154186 } )
155187 . catch ( ( error ) => {
156188 console . log (
157- colors . red ( `❌ Failed to register command "${ command . data . name } " in ${ guild . name } .` )
189+ colors . red (
190+ `❌ Failed to register command "${ command . data . name } " in ${ guild . name } .` ,
191+ ) ,
158192 ) ;
159193 console . error ( error ) ;
160194 } ) ;
@@ -168,10 +202,16 @@ export default async function registerCommands(commandHandler: CommandHandler) {
168202 appCommands
169203 ?. create ( command . data )
170204 . then ( ( ) => {
171- console . log ( colors . green ( `✅ Registered command "${ command . data . name } " globally.` ) ) ;
205+ console . log (
206+ colors . green ( `✅ Registered command "${ command . data . name } " globally.` ) ,
207+ ) ;
172208 } )
173209 . catch ( ( error ) => {
174- console . log ( colors . red ( `❌ Failed to register command "${ command . data . name } " globally.` ) ) ;
210+ console . log (
211+ colors . red (
212+ `❌ Failed to register command "${ command . data . name } " globally.` ,
213+ ) ,
214+ ) ;
175215 console . error ( error ) ;
176216 } ) ;
177217 }
0 commit comments