From 03ddf5c88c7027ec33c4d515b5c3f2822e11a742 Mon Sep 17 00:00:00 2001 From: TheEssem Date: Tue, 16 Mar 2021 15:45:10 -0500 Subject: [PATCH] Fixed mention prefix --- events/messageCreate.js | 5 +++-- utils/database/mongo.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/events/messageCreate.js b/events/messageCreate.js index 5289b0a..3a6089d 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -46,8 +46,9 @@ module.exports = async (message) => { // separate commands and args const content = message.cleanContent.substring(prefix.length).trim(); + const rawContent = message.content.substring(prefix.length).trim(); const args = content.split(/ +/g); - const command = args.shift().toLowerCase(); + const command = rawContent.split(/ +/g).shift().toLowerCase(); // don't run if message is in a disabled channel if (message.channel.guild) { @@ -70,7 +71,7 @@ module.exports = async (message) => { try { await database.addCount(collections.aliases.has(command) ? collections.aliases.get(command) : command); const startTime = new Date(); - const result = await cmd(message, args, message.content.substring(prefix.length).trim().replace(command, "").trim()); // we also provide the message content as a parameter for cases where we need more accuracy + const result = await cmd(message, args, rawContent.replace(command, "").trim()); // we also provide the message content as a parameter for cases where we need more accuracy const endTime = new Date(); if (typeof result === "string" || (typeof result === "object" && result.embed)) { await client.createMessage(message.channel.id, result); diff --git a/utils/database/mongo.js b/utils/database/mongo.js index fd3eece..70a07bf 100644 --- a/utils/database/mongo.js +++ b/utils/database/mongo.js @@ -7,7 +7,7 @@ mongoose.connect(process.env.DB, { poolSize: 10, bufferMaxEntries: 0, useNewUrlParser: true, - useUnifiedTopology: true, + useUnifiedTopology: true }); const guildSchema = new mongoose.Schema({ id: String,