Skip to content

Commit

Permalink
fix xp handler
Browse files Browse the repository at this point in the history
  • Loading branch information
saiteja-madha committed Sep 30, 2021
1 parent 8dc348b commit 550afb9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/events/message/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,27 @@ module.exports = async (client, message) => {
// check for bot mentions
if (message.content.includes(`${client.user.id}`)) message.reply(`My prefix is \`${settings.prefix}\``);

let isCommand = false;
if (message.content.startsWith(prefix)) {
const args = message.content.replace(`${prefix}`, "").split(/\s+/);
const invoke = args.shift().toLowerCase();
const cmd = client.getCommand(invoke);

// command is found
if (cmd) {
isCommand = true;
try {
await cmd.execute(message, args, invoke, prefix);
} catch (ex) {
sendMessage(message.channel, "Oops! An error occurred while running the command");
client.logger.error("messageRun", ex);
}
}
}

// if not a command
else {
await automodHandler.performAutomod(message, settings);
if (settings.ranking.enabled) xpHandler.handleXp(message);
}
// if not a command
if (!isCommand) {
await automodHandler.performAutomod(message, settings);
if (settings.ranking.enabled) xpHandler.handleXp(message);
}
};

0 comments on commit 550afb9

Please sign in to comment.