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

Function prepareCommandsForRegistration

src/handlers/commandLoader.js:223–239  ·  view source on GitHub ↗
(commands, { multiGuild = false } = {})

Source from the content-addressed store, hash-verified

221}
222
223function prepareCommandsForRegistration(commands, { multiGuild = false } = {}) {
224 if (commands.length >= COMMAND_COUNT_WARN_THRESHOLD) {
225 logger.warn(
226 `Command count (${commands.length}) is near Discord's ${MAX_COMMANDS} limit` +
227 (multiGuild ? ' for global registration' : ' for guild registration')
228 );
229 }
230
231 if (commands.length <= MAX_COMMANDS) {
232 return commands;
233 }
234
235 logger.warn(`Command count (${commands.length}) exceeds Discord limit (${MAX_COMMANDS}), truncating...`);
236 const truncated = commands.slice(0, MAX_COMMANDS);
237 logger.info(`Truncated to ${truncated.length} commands for registration`);
238 return truncated;
239}
240
241async function registerGlobalCommands(client, clientId, commands, totalSubcommands) {
242 if (!clientId) {

Callers 2

registerGlobalCommandsFunction · 0.85
registerGuildCommandsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected