Little aditions

Added optional propreties to commands.

Commands with the proprety `folder: 'dev'` can't be reloaded via the reload command.

Now the 'interactionCreate' event log the time of executing of the command.
This commit is contained in:
Guz
2021-08-26 17:58:38 -03:00
parent 671052f1c1
commit ce2e244b70
3 changed files with 18 additions and 2 deletions

View File

@@ -29,8 +29,12 @@ module.exports = {
const command = commands.find(c => c.data.name === cmdName);
if(!command?.meta.canReload) {
interaction.reply({ content: `You can't reload the \`${command.data.name}\` command.`, ephemeral: true });
if(command?.properties.folder == 'dev') {
interaction.reply({ content: `You can't reload \`${cmdName}\` because it is a development command.`, ephemeral: true });
return;
}
else if(!command) {
interaction.reply({ content: `Command \`${cmdName}\` wasn't found.`, ephemeral: true });
return;
}
@@ -65,6 +69,8 @@ module.exports = {
await clientCommand.permissions.set({ id: clientCommand.id, permissions: newCommand.permissions });
interaction.reply({ content: `Command \`${cmdName}\` reloaded successfully.`, ephemeral: true });
console.log(
'Old Command --------------------------------\n', oldCommand,
'\nData:\n', oldCommandData,

View File

@@ -4,6 +4,9 @@ module.exports = {
name: 'interactionCreate',
async execute(interaction, client) {
console.log('NEW INTERACTION ################################');
console.time('Interaction time');
if(interaction.isCommand()) {
console.log(`\nCommand ${interaction.commandName} executing ----------------\n`);
@@ -31,5 +34,8 @@ module.exports = {
}
console.timeEnd('Interaction time');
console.log('################################################\n');
},
};

View File

@@ -23,6 +23,10 @@ for (const folder of commandFolders) {
for (const file of commandFiles) {
const command = require(`./commands/${folder}/${file}`);
if(command.properties) command.proprieties.folder = folder;
else command.properties = { folder: folder };
commands.push(command);
commandsData.push(command.data.toJSON());