feat: add safe global Discord command registration
This commit is contained in:
10
scripts/register-discord-commands.ts
Normal file
10
scripts/register-discord-commands.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { commands } from '../src/discord/commands';
|
||||
import { registerCommands } from '../src/discord/registration';
|
||||
|
||||
if (process.argv.includes('--apply')) {
|
||||
const registered = await registerCommands(process.env.DISCORD_CLIENT_ID ?? '', process.env.DISCORD_BOT_TOKEN ?? '', commands);
|
||||
console.log(`Registered global commands for servers and bot DMs: ${registered.map(name => `/${name}`).join(', ')}`);
|
||||
} else {
|
||||
console.log(JSON.stringify(commands, null, 2));
|
||||
console.log('Preview only. Add --apply to register these commands with Discord.');
|
||||
}
|
||||
Reference in New Issue
Block a user