yaejunyang/packages/index.ts

23 lines
588 B
TypeScript

import { Routes } from "discord.js";
import { DiscordBot } from "./bot";
import { APPLICATION_ID, DISCORD_TOKEN } from "./env";
export const bot = new DiscordBot(DISCORD_TOKEN);
bot.client.once("clientReady", async (client) => {
await bot.registerCommands();
await bot.registerEvents();
console.log(
"registerCommands: \n| " +
(
(await client.rest.get(
Routes.applicationCommands(APPLICATION_ID),
)) as any[]
)
.map((info) => `name: ${info.name} id: ${info.id}`)
.join("\n| "),
);
});
bot.client.login(DISCORD_TOKEN);