Add client as a parameter to command invokation

This commit is contained in:
benji7425 2017-09-24 21:20:12 +01:00
parent e249b8d45d
commit 1fc45e85b4
3 changed files with 5 additions and 4 deletions

View File

@ -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*/

View File

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

View File

@ -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": {