MCPcopy Create free account
hub / github.com/codebymitch/TitanBot / registerCommands

Function registerCommands

src/handlers/commandLoader.js:307–336  ·  view source on GitHub ↗
(client, options = {})

Source from the content-addressed store, hash-verified

305}
306
307export 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
338export async function reloadCommand(client, commandName) {
339 const command = client.commands.get(commandName);

Callers

nothing calls this directly

Calls 3

collectCommandPayloadsFunction · 0.85
registerGlobalCommandsFunction · 0.85
registerGuildCommandsFunction · 0.85

Tested by

no test coverage detected