This commit is contained in:
ChomeNS 2022-08-19 07:15:05 +07:00
parent 89f8d5d94d
commit fb95cb30a5

View file

@ -7,7 +7,9 @@ const {MessageEmbed} = require('discord.js');
function inject(bot, dcclient) {
bot.command_handler.commands = loadFiles(path.join(__dirname, '../commands'));
bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc) {
const raw = message.substr(prefix.length);
let raw;
if (typeof message.content!=='undefined') raw = message.content.substr(prefix.length);
if (typeof message.content==='undefined') raw = message.substr(prefix.length);
const [commandName, ...args] = raw.split(' ');
var command = bot.command_handler.commands.find((command) => command.name === commandName.toLowerCase());
try {
@ -69,7 +71,7 @@ function inject(bot, dcclient) {
// only receive messages in SPECIFIC channel
if (message.channel.id != bot.channelId) return;
if (!message.content.startsWith(config.discord.prefix)) return;
bot.command_handler.main(config.discord.prefix, message.member.displayName, message.member.displayName, message.content, 'no sender for discord', channeldc);
bot.command_handler.main(config.discord.prefix, message.member.displayName, message.member.displayName, message, 'no sender for discord', channeldc);
} catch (e) {
return;
};