Initial Commit
This commit is contained in:
21
sync-commands.ts
Normal file
21
sync-commands.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
const { REST, Routes } = require("discord.js");
|
||||
const { appId, guildId, token } = require("./config.json");
|
||||
|
||||
const commands = [require("./commands/calendar/ping.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);
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user