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,