From 4918789a52e82766dd213958163d3af7528ad4bb Mon Sep 17 00:00:00 2001 From: Marcus Netz Date: Mon, 23 Nov 2020 14:52:42 +0100 Subject: [PATCH] fixing prefix cmdhandler --- src/commands/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/index.js b/src/commands/index.js index d14443e..09100d3 100644 --- a/src/commands/index.js +++ b/src/commands/index.js @@ -11,7 +11,7 @@ const skill = require('./skill'); const createFromFile = require('./createFromFile'); require('dotenv').config(); -const prefix = process.env.PREFIX || '!'; +const cmdprefix = process.env.CMDPREFIX || '!'; const commands = { roll, @@ -30,8 +30,8 @@ const Datastore = require('nedb'), }); module.exports = async (message) => { - console.log(`${new Date().toUTCString} ${message.author.tag}`) - if ((message.attachments.size > 0) && message.channel.type == 'dm') { + console.log(`${new Date().toUTCString()} ${message.author.tag} (size: ${message.attachments.size})`) + if ((message.attachments.size > 0) && message.channel.type == 'dm' && !message.author.bot) { try { const response = await fetch(message.attachments.first().url); const data = await validateJSON(response); @@ -43,8 +43,8 @@ module.exports = async (message) => { } else { - if (!message.content.startsWith(prefix) || message.author.bot) return; - const args = message.content.slice(prefix.length).split(' '); + if (!message.content.startsWith(cmdprefix) || message.author.bot) return; + const args = message.content.slice(cmdprefix.length).split(' '); const command = args.shift().toLowerCase(); if (Object.keys(commands).includes(command)) { commands[command](message, args, db);