(commands, { multiGuild = false } = {})
| 221 | } |
| 222 | |
| 223 | function 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 | |
| 241 | async function registerGlobalCommands(client, clientId, commands, totalSubcommands) { |
| 242 | if (!clientId) { |
no outgoing calls
no test coverage detected