Added Slash Command registration timing

This commit is contained in:
ION606
2022-10-24 20:49:42 -04:00
parent b75cb7b495
commit 1324c3db8f
+25
View File
@@ -5,6 +5,7 @@ const {Client, Constants} = require('discord.js');
* @param {Client} bot
*/
function registerCommands(bot) {
return new Promise((resolve, reject) => {
const commands = bot.application.commands;
/*
@@ -16,6 +17,8 @@ function registerCommands(bot) {
key: code
*/
//#region Slash Commands
bot.commands.forEach((val, key) => {
if ((val.options && val.name != 'econ') || val.isDm) {
if (val.isDm) {
@@ -109,6 +112,28 @@ function registerCommands(bot) {
},
]
});
return resolve(true);
//Takes much longer, so it'll be the benchmark for when the Promise resolves
//#region GAMES
const gameOpts = require('./commands/games/gameCommandOptions.js');
commands.create({
name: 'game',
description: 'Play one of Selmer Bot\'s games!', //NOT APPLICABLE USING SUB COMMAND GROUPS???
// type: Constants.ApplicationCommandOptionTypes.SUB_COMMAND_GROUP,
options: gameOpts
}).then(() => { resolve(true); }).catch((err) => { reject(err); });
//#endregion
//#endregion
//#region Context Menus
commands.create({
name: "Temp",
type: 'USER'
});
//#endregion
});
}