From 0f03a53c8f187c8bfc47fbb88e8adfd78699e11e Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Wed, 29 Sep 2021 14:57:51 -0400 Subject: [PATCH] . --- _clear-commands.js | 26 ++++++++++++++++++++++++++ config.json | 2 +- main.js | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 _clear-commands.js diff --git a/_clear-commands.js b/_clear-commands.js new file mode 100644 index 0000000..fc7ea5d --- /dev/null +++ b/_clear-commands.js @@ -0,0 +1,26 @@ +// dotenv for handling environment variables +const dotenv = require('dotenv'); +dotenv.config(); + +const { REST } = require('@discordjs/rest'); +const { Routes } = require('discord-api-types/v9'); +const { guildId, clientId } = require('./config.json'); +const token = process.env.TOKEN; + +const rest = new REST({ version: '9' }).setToken(token); + +(async () => { + try { + console.log('Started refreshing application (/) commands.'); + + await rest.put( + Routes.applicationGuildCommands(clientId, guildId), + { body: '' }, + ); + + console.log('Successfully reloaded application (/) commands.'); + process.exit(); + } catch (error) { + console.error(error); + } +})(); \ No newline at end of file diff --git a/config.json b/config.json index 75f680c..85cc74a 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,5 @@ { - "isDev": true, + "isDev": false, "clientId": "858181619721175050", "guildId": "760701839427108874", "devChannelId": "890752931643654144", diff --git a/main.js b/main.js index 00775ed..c78dacf 100644 --- a/main.js +++ b/main.js @@ -26,6 +26,7 @@ const { MessageActionRow, MessageButton } = require('discord.js'); const fn = require('./functions.js'); const config = require('./config.json'); const strings = require('./strings.json'); +config.isDev = process.env.isDev; client.once('ready', () => { fn.collections.slashCommands(client);