import { Routes } from "discord.js"; import { REST } from "@discordjs/rest"; import config from "config"; import getCommands from "components/commands.component"; export default class DiscordService { rest: REST; constructor() { this.rest = new REST({ version: "10" }).setToken(config.discord.token); } async init() { try { await this.rest.put( Routes.applicationCommands(config.discord.applicationId), { body: getCommands(), }, ); console.log("Successfully added commands"); } catch (e) { console.error(e); } } }