import { REST } from '@discordjs/rest' import { commandList, discordCommand } from './constants' import { Routes } from 'discord-api-types/v9' import { config } from './configuration' export default class DiscordAdapter { private rest: REST public constructor() { this.rest = new REST({ version: '9' }).setToken(config.token) } public async registerCommands(pCommands: discordCommand[]) { if (!config.debug) try { console.log('Refreshing slash commands') await this.rest.put(Routes.applicationGuildCommands(config.client_id, config.guild_id), { body: pCommands }) console.log('Successfully refreshed slash commands') } catch (error) { console.log(`Error refreshing slash commands: ${error}`) } } }