25 lines
620 B
TypeScript
25 lines
620 B
TypeScript
const { REST, Routes } = require("discord.js");
|
|
const { appId, guildId, token } = require("./config.json");
|
|
|
|
const commands = [
|
|
require("./commands/calendar/ping.js").data.toJSON(),
|
|
require("./commands/calendar/remind.js").data.toJSON(),
|
|
];
|
|
|
|
const rest = new REST().setToken(token);
|
|
|
|
(async () => {
|
|
try {
|
|
console.log(`Started refreshing ${commands.length} slash commands`);
|
|
const data = await rest.put(
|
|
Routes.applicationGuildCommands(appId, guildId),
|
|
{
|
|
body: commands,
|
|
},
|
|
);
|
|
console.log(`Successfully reloaded ${data.length} slash commands`);
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
})();
|