I'm looking for:
ME (Veak): !voting
Bot: Veak initiated a poll
Current situation:
Me (Veak): !voting
Bot: undefined initiated a vote
The previous code I utilized was 'message.author + 'initiated a vote'
When I attempted message.author.username, an error message prompted me that the username is not defined.
The code snippet:
bot.on('message', function (user, userID, channelID, message, evt) {
if (message.substring(0, 1) == '!') {
var args = message.substring(1).split(' ');
var cmd = args[0];
args = args.splice(1);
switch(cmd) {
case 'ping':
bot.sendMessage({
to: channelID,
message: 'Pong!'
});
break;
case 'voting':
bot.sendMessage({
to: channelID,
message: ':ballot_box: **| ' + message.author + ' initiated a vote!**'
});
break;
}
}
});