-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.js
More file actions
27 lines (22 loc) · 824 Bytes
/
build.js
File metadata and controls
27 lines (22 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const commandList = require('./util/commands'); // List of commands
const { Routes, REST } = require('discord.js');
const { Logger } = require('./util/Logger');
require('dotenv').config();
const commands = [];
for (const key in commandList) {
const command = commandList[key];
commands.push(command.data.toJSON());
}
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
(async () => {
try {
Logger.info('Started refreshing application (/) commands.');
await rest.put(
Routes.applicationCommands(process.env.DISCORD_APPLICATION_ID),
{ body: commands },
);
Logger.info('Successfully reloaded application (/) commands.');
} catch (error) {
Logger.error('Error reloading application (/) commands:', error);
}
})();