diff --git a/src/handlers/Command.js b/src/handlers/Command.js index 7b5779b..93e5275 100644 --- a/src/handlers/Command.js +++ b/src/handlers/Command.js @@ -114,9 +114,16 @@ class CommandHandler { if (_this.options.logs) console.log(`[OPCommands] Command '${interaction.commandName}' executed by: '${interaction.user.tag}'`); _this.client.commands.get(interaction.commandName).run(_this.client, interaction); if (_this.options.notifyOwner && (commandFile.limits.permissions == ('ADMINISTRATOR').toLowerCase())) { + if(!_this.client.msgs.notifyCommandMessage) { + // If there isn't any message, it uses the default one _this.client.users.fetch(_this.client.owners[0]).then(user => { user.send("[Logs] Administrator command `" + interaction.commandName + "` was executed by " + `<@${interaction.user.id}> in **${interaction.guild.name}**`); }); + } else { + _this.client.users.fetch(_this.client.owners[0]).then(user => { + _this.client.msgs.notifyCommandMessage(user, interaction); + }) + } } } catch (e) { if (_this.options.logs) console.log("[OPCommands] Command error: " + interaction.commandName); diff --git a/test/index.js b/test/index.js index daf18d0..69b548e 100644 --- a/test/index.js +++ b/test/index.js @@ -17,7 +17,8 @@ handler.setMessages({ ownerOnly: (interaction) => interaction.reply("Missing **Bot Owner** permission."), permissions: (interaction, perms) => interaction.reply(`You are missing the following permissions: **${perms.join(", ")}**`), cooldown: (interaction, cooldown) => interaction.reply(`You must wait **${cooldown}** before executing another command.`), - notifyOwnerMessage: (owner) => owner.send("I'm online!"); + notifyOwnerMessage: (owner) => owner.send("I'm online!"), + notifyCommandMessage: (owner, interaction) => owner.send("[OPCommands] Administrator command `" + interaction.commandName + "` was executed by " + `<@${interaction.user.id}> in **${interaction.guild.name}**`) }); client.login("BOT_TOKEN");