diff --git a/plugins/commands.js b/plugins/commands.js index e71e669..a65729c 100644 --- a/plugins/commands.js +++ b/plugins/commands.js @@ -3,6 +3,7 @@ const loadFiles = require('../util/load_files'); const path = require('path'); const {MessageEmbed} = require('discord.js'); function inject(bot, dcclient, config) { + const channeldc = dcclient.channels.cache.get(config.discord.servers[bot.options.host]); bot.command_handler = {}; bot.command_handler.commands = {}; function reload() { @@ -68,10 +69,8 @@ function inject(bot, dcclient, config) { try { // ignores the message that comes from the bot itself if (message.author.id === dcclient.user.id) return; - const channelid = message.channel.id; - const channeldc = dcclient.channels.cache.get(channelid); // only receive messages in SPECIFIC channel - if (message.channel.id != bot.channelId) return; + if (message.channel.id !== channeldc.id) return; if (!message.content.startsWith(config.discord.prefix)) return; bot.command_handler.main(config.discord.prefix, message.member.displayName, message.member.displayName, message, 'no sender for discord', channeldc); } catch (e) {