Add client as a parameter to command invokation
This commit is contained in:
parent
d6bc7b631b
commit
0c2eafcb6c
|
@ -2,7 +2,7 @@
|
|||
const ParentPackageJSON = require("../package.json");
|
||||
|
||||
/**@param param*/
|
||||
function handleMessage(message, commands, guildData) {
|
||||
function handleMessage(client, message, commands, guildData) {
|
||||
if (!message.content.startsWith(message.guild.me.toString())) //criteria for a command is the bot being tagged
|
||||
return;
|
||||
|
||||
|
@ -17,7 +17,7 @@ function handleMessage(message, commands, guildData) {
|
|||
else if (params.length < command.expectedParamCount)
|
||||
message.reply(`Incorrect syntax!\n**Expected:** *${botName} ${command.syntax}*\n**Need help?** *${botName} help*`);
|
||||
else if(isMemberAdmin || !command.admin)
|
||||
command.invoke({ message, params, guildData });
|
||||
command.invoke({ message, params, guildData, client });
|
||||
}
|
||||
|
||||
/**@param param*/
|
||||
|
|
|
@ -48,7 +48,7 @@ module.exports = class Client extends Discord.Client {
|
|||
|
||||
onMessage(message) {
|
||||
if (message.channel.type === "text" && message.member)
|
||||
HandleMessage(message, this.commands, this.guildsData[message.guild.id] || new this.guildDataModel(message.guild.id));
|
||||
HandleMessage(this, message, this.commands, this.guildsData[message.guild.id] || new this.guildDataModel(message.guild.id));
|
||||
}
|
||||
|
||||
onDebug(info) {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
"discord.js": "11.2.0",
|
||||
"jsonfile": "3.0.1",
|
||||
"parent-package-json": "2.0.1",
|
||||
"simple-file-writer": "2.0.0"
|
||||
"simple-file-writer": "2.0.0",
|
||||
"require-all": "2.2.0"
|
||||
},
|
||||
"name": "discord-bot-core",
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in a new issue