Fixed mention prefix

This commit is contained in:
TheEssem 2021-03-16 15:45:10 -05:00
parent 74baa29684
commit 03ddf5c88c
2 changed files with 4 additions and 3 deletions

View file

@ -46,8 +46,9 @@ module.exports = async (message) => {
// separate commands and args // separate commands and args
const content = message.cleanContent.substring(prefix.length).trim(); const content = message.cleanContent.substring(prefix.length).trim();
const rawContent = message.content.substring(prefix.length).trim();
const args = content.split(/ +/g); 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 // don't run if message is in a disabled channel
if (message.channel.guild) { if (message.channel.guild) {
@ -70,7 +71,7 @@ module.exports = async (message) => {
try { try {
await database.addCount(collections.aliases.has(command) ? collections.aliases.get(command) : command); await database.addCount(collections.aliases.has(command) ? collections.aliases.get(command) : command);
const startTime = new Date(); 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(); const endTime = new Date();
if (typeof result === "string" || (typeof result === "object" && result.embed)) { if (typeof result === "string" || (typeof result === "object" && result.embed)) {
await client.createMessage(message.channel.id, result); await client.createMessage(message.channel.id, result);

View file

@ -7,7 +7,7 @@ mongoose.connect(process.env.DB, {
poolSize: 10, poolSize: 10,
bufferMaxEntries: 0, bufferMaxEntries: 0,
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true, useUnifiedTopology: true
}); });
const guildSchema = new mongoose.Schema({ const guildSchema = new mongoose.Schema({
id: String, id: String,