const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v10');
module.exports = async (client) => {
client.logs.info('Started refreshing application (/) commands.');
const commands = [];
for (const [_, command] of client.commands) {
try {
commands.push(command.data.toJSON());
let commandName = command.data.name;
} catch (error) {
client.logs.error(`[REGISTER] Failed to register ${command.data.name}: ${error}`);
}
}
const rest = new REST({ version: '10' }).setToken(client.config.TOKEN);
try {
await rest.put(
Routes.applicationCommands(client.config.APP_ID),
{ body: commands },
);
client.logs.info('Successfully reloaded application (/) commands.');
} catch (error) {
client.logs.error(error);
}
};
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v10');
module.exports = async (client) => {
client.logs.info('Started refreshing application (/) commands.');
const commands = [];
for (const [_, command] of client.commands) {
try {
commands.push(command.data.toJSON());
let commandName = command.data.name;
} catch (error) {
client.logs.error(`[REGISTER] Failed to register ${command.data.name}: ${error}`);
}
}
const rest = new REST({ version: '10' }).setToken(client.config.TOKEN);
try {
await rest.put(
Routes.applicationCommands(client.config.APP_ID),
{ body: commands },
);
client.logs.info('Successfully reloaded application (/) commands.');
} catch (error) {
client.logs.error(error);
}
};