(client, options = {})
| 305 | } |
| 306 | |
| 307 | export async function registerCommands(client, options = {}) { |
| 308 | const { |
| 309 | clientId = null, |
| 310 | guildId = null, |
| 311 | multiGuild = false, |
| 312 | } = options; |
| 313 | |
| 314 | try { |
| 315 | const { commands, totalSubcommands } = collectCommandPayloads(client); |
| 316 | |
| 317 | if (multiGuild) { |
| 318 | logger.info('Command registration mode: multi-guild (global commands)'); |
| 319 | await registerGlobalCommands(client, clientId, commands, totalSubcommands); |
| 320 | return; |
| 321 | } |
| 322 | |
| 323 | if (!guildId) { |
| 324 | logger.warn( |
| 325 | 'Command registration skipped: set GUILD_ID for single-server setup, or MULTI_GUILD=true for multi-server support' |
| 326 | ); |
| 327 | return; |
| 328 | } |
| 329 | |
| 330 | logger.info(`Command registration mode: single-guild (GUILD_ID=${guildId})`); |
| 331 | await registerGuildCommands(client, guildId, commands, totalSubcommands); |
| 332 | } catch (error) { |
| 333 | logger.error('Error registering commands:', error); |
| 334 | throw error; |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | export async function reloadCommand(client, commandName) { |
| 339 | const command = client.commands.get(commandName); |
nothing calls this directly
no test coverage detected