Added flag, fixed the command count issue (for real)
This commit is contained in:
parent
49d9be8b93
commit
2f1c37579e
6 changed files with 45 additions and 1 deletions
|
@ -40,7 +40,8 @@ module.exports = async (message) => {
|
|||
logger.log("info", `${message.author.username} (${message.author.id}) ran command ${command}`);
|
||||
try {
|
||||
const global = (await database.global.findOne({}).exec());
|
||||
global.cmdCounts.set(collections.aliases.has(command) ? collections.aliases.get(command) : command, ((isNaN(global.cmdCounts.get(command)) ? 0 : parseFloat(global.cmdCounts.get(command))) + 1).toFixed());
|
||||
const count = global.cmdCounts.get(collections.aliases.has(command) ? collections.aliases.get(command) : command);
|
||||
global.cmdCounts.set(collections.aliases.has(command) ? collections.aliases.get(command) : command, parseInt(count) + 1);
|
||||
await global.save();
|
||||
const result = await cmd(message, args, content.replace(command, "").trim()); // we also provide the message content as a parameter for cases where we need more accuracy
|
||||
if (typeof result === "string" || (typeof result === "object" && result.embed)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue