discord cmd handler fixed guys!!

This commit is contained in:
ChomeNS 2022-11-12 13:04:38 +07:00
parent 953ec94cb0
commit 69711aa978

View file

@ -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) {