This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Description
I am trying to add a simple points/karma system to my slack bot
https://github.com/paircast/mlh-webex-bot-karma
however I am getting an error trying to use the middleware

` controller.middleware.heard.use(function(bot, message, next){
let text = message.text.split(" ");
let found = false;
if(text[0] == "sdpoints"){
// perform the code that adds points to a user
}else if(text[0] == "sdremove"){
// perform the code to remove a specific user
}else if(text[0] == "sdreset"){
// perform the code to set the users points to zero
}else if(text[0] == "sduser"){
// perform the code to add a new user
}else if(text[0] == "sdtally"){
// perform the code to tally up the results so far.
}else if(text[0] == "sdhelp"){
//send the help response
message.user_profile = "Here is a list of things you can say:\n1. /points '# of points' 'Name of person'\n2. /tally\n3. /remove 'users name'\n4. /user 'new users name'\n5. /reset";
next();
}else{
//send by default the help response
}
});
controller.hears(['sdpoints (.)', 'sdremove (.)', 'sdreset', 'sduser (.*)', 'sdtally', 'sdhelp'], 'direct_message,direct_mention', function(bot, message){
console.log("Made it to the hears reply section", message.user_profile);
bot.reply(message, message.user_profile);
});`