Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/handlers/Command.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");