I'm trying to make it so that when someone types !familyfortunes %NAME% in message that it will run with the command and take the parameter (%NAME%) from the message and then store it in a variable.
I thought I could use if(message.toLowerCase.indexOf("!familyfortunes") !=-1){} and store $message into another variable but split to remove !familyfortunes so it only kept the username but that keeps returning the error:
greatbritishbg: !familyfortunes lol [10:53:39] error - TypeError: undefined is not a function at null. (example.js:68:29)
Which is the .split() part.
client.addListener('chat', function (channel, user, message) {
console.log(user.username + ': ' + message);
if (message.toLowerCase() === '!familyfortunes') { //If message contains !familyfortunes
//var res = messageString.split("familyfortunes ");// Remove Family Fortunes to just get username
client.say(channel, 'Latest Follower: ' + Follower.response);
var raidName = Follower.response;
io.emit('follow', raidName);
}
}
Any advice on how I can tackle this would be appreciated. Thanks.