silvanus/modules/_clear-commands.js

27 lines
694 B
JavaScript
Raw Permalink Normal View History

2023-01-18 00:35:24 +00:00
// dotenv for handling environment variables
const dotenv = require('dotenv');
dotenv.config();
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const clientId = process.env.clientId;
2023-01-19 17:44:49 +00:00
const { guildId } = require('../data/config.json');
2023-01-18 00:35:24 +00:00
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);
}
})();