Last active
December 14, 2015 19:18
-
-
Save sycobuny/5135174 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var responses = { | |
leader: function() { | |
bot.say(to, leaderboard_data.Passings[leaderboard_running[0].index].Driver.DriverName + ' is leading the race. ' + lapticker + '') | |
console.log(to, leaderboard_data.Passings[leaderboard_running[0].index].Driver.DriverName + ' is leading the race. ' + lapticker + '') | |
}, | |
luckydog: function() { | |
bot.say(to, leaderboard_data.Passings[leaderboard_luckydog].Driver.DriverName + ' is sitting in lucky dog position. ' + lapticker + '') | |
console.log(to, leaderboard_data.Passings[leaderboard_luckydog].Driver.DriverName + ' is sitting in lucky dog position. ' + lapticker + '') | |
}, | |
running: function() { | |
var order = '', sep=''; | |
console.log('Passings: ' + leaderboard_running.length); | |
for(var i = 0;i < leaderboard_running.length;i++) { | |
//console.log('P' + i + ' : ' + leaderboard_data.Passings[i].CarNo); | |
order = order + sep + leaderboard_data.Passings[leaderboard_running[i].index].CarNo; | |
sep = ', '; | |
} | |
bot.say(to, 'Currently running ' + lapticker + ': ' + order); | |
console.log(to, 'Currently running ' + lapticker + ': ' + order); | |
} | |
} | |
for (var i in responses) { | |
var re = new RegExp('^' + i); | |
if (re.match(message)) | |
responses[i](); | |
} | |
// alternately from the loop: | |
responses[message.split(' ')[0]](); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
else if(message.substring(1,7) == 'leader') { | |
bot.say(to, leaderboard_data.Passings[leaderboard_running[0].index].Driver.DriverName + ' is leading the race. ' + lapticker + '') | |
console.log(to, leaderboard_data.Passings[leaderboard_running[0].index].Driver.DriverName + ' is leading the race. ' + lapticker + '') | |
} | |
else if(message.substring(1,9) == 'luckydog') { | |
bot.say(to, leaderboard_data.Passings[leaderboard_luckydog].Driver.DriverName + ' is sitting in lucky dog position. ' + lapticker + '') | |
console.log(to, leaderboard_data.Passings[leaderboard_luckydog].Driver.DriverName + ' is sitting in lucky dog position. ' + lapticker + '') | |
} | |
else if(message.substring(1,8) == 'running') { | |
var order = '', sep=''; | |
console.log('Passings: ' + leaderboard_running.length); | |
for(var i = 0;i < leaderboard_running.length;i++) { | |
//console.log('P' + i + ' : ' + leaderboard_data.Passings[i].CarNo); | |
order = order + sep + leaderboard_data.Passings[leaderboard_running[i].index].CarNo; | |
sep = ', '; | |
} | |
bot.say(to, 'Currently running ' + lapticker + ': ' + order); | |
console.log(to, 'Currently running ' + lapticker + ': ' + order); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment