diff options
| author | Mathias Magnusson <mathias@magnusson.space> | 2026-01-20 10:43:30 +0100 |
|---|---|---|
| committer | Mathias Magnusson <mathias@magnusson.space> | 2026-01-20 10:43:30 +0100 |
| commit | db0b737210c1dd057a46b08ebfb050bcb80b35cd (patch) | |
| tree | 98337432279780d2c9eef7fa76ecea35680a370c /index.ts | |
| parent | 47f1cef7c50c06de38d9b24c2579e8f8183dae23 (diff) | |
| download | challe-anka-db0b737210c1dd057a46b08ebfb050bcb80b35cd.tar.gz | |
parameterize solve message; clean up index.ts
Diffstat (limited to 'index.ts')
| -rw-r--r-- | index.ts | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -1,5 +1,4 @@ import { - ChannelType, Client, CommandInteraction, Events, @@ -18,20 +17,14 @@ function requireEnv(key: string): string { return value; } -let token = requireEnv("DISCORD_TOKEN"); let clientId = requireEnv("DISCORD_CLIENT_ID"); -let guildId = requireEnv("DISCORD_GUILD_ID"); +let token = requireEnv("DISCORD_TOKEN"); +export let celebrationMessage = requireEnv("CELEBRATION_MESSAGE"); let client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] }); let rest = new REST({ version: "10" }).setToken(token); -async function registerSlashCommands() { - await rest.put(Routes.applicationGuildCommands(clientId, guildId), { - body: slashCommands.map(command => command.slashCommand.toJSON()), - }); -} - client.once(Events.ClientReady, (readyClient) => { console.log(`Logged in as ${readyClient.user.tag}`); }); @@ -92,7 +85,10 @@ client.on(Events.ThreadCreate, async (thread) => { }); try { - await registerSlashCommands(); + await rest.put(Routes.applicationCommands(clientId), { + body: slashCommands.map(command => command.slashCommand.toJSON()), + }); + await client.login(token); } catch (error) { console.error("Discord bot failed to start", error); |
