[Commands] Remove un-needed implementation of seperate REST client. (#22)

This commit is contained in:
2026-10-05 08:36:12 -07:00
committed by GitHub
parent 1757ef2f8a
commit 2581c733a6
2 changed files with 11 additions and 9 deletions
+3 -5
View File
@@ -1,4 +1,4 @@
import { Client, REST, RESTPostAPIApplicationCommandsJSONBody, Routes } from 'discord.js';
import { Client, RESTPostAPIApplicationCommandsJSONBody, Routes } from 'discord.js';
import fs from 'fs';
import path from 'path';
import { config } from '../config';
@@ -6,8 +6,6 @@ import { Command } from '../types';
const ROOT_DIR = path.resolve(__dirname, '..');
const rest = new REST({ version: '10' }).setToken(config.DISCORD_TOKEN!);
export async function refreshCommands(client: Client) {
try {
const commands: RESTPostAPIApplicationCommandsJSONBody[] = [];
@@ -49,14 +47,14 @@ export async function refreshCommands(client: Client) {
console.log('Started refreshing application (/) commands.');
console.log('Global commands: ' + commands.length);
await rest.put(
await client.rest.put(
Routes.applicationCommands(config.DISCORD_CLIENT_ID!),
{ body: commands }
);
for (const guild in guildCommands) {
console.log('Guild commands: ' + guildCommands[guild].length + ' (' + guild + ')');
await rest.put(
await client.rest.put(
Routes.applicationGuildCommands(config.DISCORD_CLIENT_ID!, guild),
{ body: guildCommands[guild] }
);