mirror of
https://github.com/nx-bat/discordbot-ng.git
synced 2026-11-11 07:13:37 -05:00
[Commands] Remove un-needed implementation of seperate REST client. (#22)
This commit is contained in:
@@ -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] }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user