DUNGEONS-30: add access gateway with Telegram and Discord approvals
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
16
scripts/register-discord.js
Normal file
16
scripts/register-discord.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'dotenv/config';
|
||||
import { loadConfig } from '../src/config.js';
|
||||
import { DiscordBot } from '../src/bots/discord.js';
|
||||
|
||||
try {
|
||||
const config = loadConfig();
|
||||
if (!config.discord.token) throw new Error('Configure Discord in .env first.');
|
||||
const bot = new DiscordBot(config);
|
||||
const scope = config.discord.guildId ? `/guilds/${config.discord.guildId}` : '';
|
||||
// POST upserts only /access, preserving unrelated commands registered by the owner.
|
||||
await bot.api(`/applications/${config.discord.applicationId}${scope}/commands`, {
|
||||
name: 'access', description: 'Request private-alpha access to Dungeons & Ground', type: 1,
|
||||
...(scope ? {} : { integration_types: [0], contexts: [0, 1] }),
|
||||
});
|
||||
console.log(`/access registered ${scope ? 'in the configured server' : 'globally (propagation can take time)'}.`);
|
||||
} catch (error) { console.error(error.message); process.exitCode = 1; }
|
||||
Reference in New Issue
Block a user