Minor fix
This commit is contained in:
@@ -13,6 +13,7 @@ else if (arg === '--prod') {
|
|||||||
const commands = [];
|
const commands = [];
|
||||||
// Grab all the command files from the commands directory you created earlier
|
// Grab all the command files from the commands directory you created earlier
|
||||||
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
|
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
|
||||||
|
const contentMenuCommands = fs.readdirSync('./commands-contextmenu').filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
@@ -20,6 +21,11 @@ else if (arg === '--prod') {
|
|||||||
commands.push(command.data.toJSON());
|
commands.push(command.data.toJSON());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const file of contentMenuCommands) {
|
||||||
|
const command = require(`./commands-contextmenu/${file}`);
|
||||||
|
commands.push(command.data.toJSON());
|
||||||
|
}
|
||||||
|
|
||||||
// Construct and prepare an instance of the REST module
|
// Construct and prepare an instance of the REST module
|
||||||
const rest = new REST({ version: '10' }).setToken(token);
|
const rest = new REST({ version: '10' }).setToken(token);
|
||||||
|
|
||||||
@@ -74,38 +80,7 @@ else if (arg === '--dev') {
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
} else if (arg === '--contextmenu') {
|
|
||||||
const commands = [];
|
|
||||||
// Grab all the command files from the commands directory you created earlier
|
|
||||||
const commandFiles = fs.readdirSync('./commands-contextmenu').filter(file => file.endsWith('.js'));
|
|
||||||
|
|
||||||
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
|
||||||
for (const file of commandFiles) {
|
|
||||||
const command = require(`./commands-contextmenu/${file}`);
|
|
||||||
commands.push(command.data.toJSON());
|
|
||||||
}
|
}
|
||||||
|
else if (arg && arg !== '--prod' && arg !== '--dev') {
|
||||||
// Construct and prepare an instance of the REST module
|
|
||||||
const rest = new REST({ version: '10' }).setToken(token);
|
|
||||||
|
|
||||||
|
|
||||||
// and deploy your commands!
|
|
||||||
(async () => {
|
|
||||||
try {
|
|
||||||
console.log(`Started refreshing ${commands.length} application contextmenu (/) commands.`);
|
|
||||||
|
|
||||||
// The put method is used to fully refresh all commands in the guild with the current set
|
|
||||||
const data = await rest.put(
|
|
||||||
Routes.applicationCommands(clientId),
|
|
||||||
{ body: commands },
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(`Successfully reloaded ${data.length} application contextmenu (/) commands.`);
|
|
||||||
} catch (error) {
|
|
||||||
// And of course, make sure you catch and log any errors!
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
} else if (arg && arg !== '--prod' && arg !== '--dev' && arg !== '--contextmenu') {
|
|
||||||
console.log('Invalid argument!');
|
console.log('Invalid argument!');
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user