bot.on('speak', function (data) { var text = data.text; // Any command with "bop" in it will work (ex: "bop","bop i beg you!!!","lolbopbaby", etc.) if (text.match(/bop/)) { bot.vote('up'); } });
function handleCommand( command, isMod, userName, userId ) { command = command.toLowerCase(); if( command == "up" ) { bot.addDj(); } else if( command == "down" ) { bot.remDj(); } else if( command == "skip" ) { bot.skip(); } else if( command == "bonus" ) { bot.vote("up"); } }
bot.on('speak', function (data) { var text = data.text; // Any command with "bop" in it will work (ex: "bop","bop i beg you!!!","lolbopbaby", etc.) if (text.match(/bop/)) { bopcount += 1; } // And when the bopcount reaches two... if (bopcount == 2) { bot.vote('up'); } });
function upvoteCheck(data) { if (currentSong === null) { return; } for (var i = 0; i < data.votelog.length; i++) { if (data.votelog[i][0] === config.USERID) { log('I already voted for this song. No need to continue.'); return; } } var votesNeeded = (data.listeners - 1) / 2; if (data.upvotes > votesNeeded) { bot.vote('up'); log('I voted up song ' + currentSong.id + ': ' + currentSong.artist + ' - ' + currentSong.song + '.'); } else { log('There are not enough votes for me to awesome this song yet. Have ' + data.upvotes + ' but need more than ' + votesNeeded + '.'); } }
bot.on('speak', function (data) { if (data.text.match(/^\/hello$/)) { bot.speak('Hey! How are you '+data.name+' ?'); } /* if (data.userid != USER) { child = exec('./translator/pig ' + data.text, function (error, stdout, stderr) { bot.speak(stdout); console.info(stdout); } ); //child.stdin.write(data.text); child.stdin.end(); } */ if (data.text.match(/vote/)) { bot.vote('up'); } });
function dance(message) { if(danceOn) { if(currentVote == 'up') { if(message) { speakOut(message); } else { speakOut('Already shaking my booty sir.'); } } else if(currentVote == 'down') { speakOut('I already expressed my disappoint with this song. I shall not dance'); } else { bot.vote('up'); if(message) { speakOut(message); } else { speakOut(randomDanceResponseGenerator()); } currentVote = 'up'; } } }
DB.DJ.IsAdmin(data.userid, function(err, admin) { LogError(err); if (data.userid == Config.AdminId || admin) { var result = data.text.match(/^\/(.*?)( .*)?$/); if (result) { // break out the command and parameter if one exists var command = result[1].trim().toLowerCase(); var param = ''; if (result.length == 3 && result[2]) { param = result[2].trim().toLowerCase(); } // handle valid commands switch(command) { // admins case 'sa': case 'setadmin': SetAdmin(param); break; case 'da': case 'deladmin': DeleteAdmin(param); break; case 'autobop': Config.AutoBop = !Config.AutoBop; ttfm.speak('Auto-Bop set to ' + Config.AutoBop + '.'); break; case 'enforce': Config.BoothEnforce = !Config.BoothEnforce; ttfm.speak('Booth enforcement set to ' + Config.BoothEnforce + '.'); break; // djing case 'autodj': Config.AutoDJ = !Config.AutoDJ; ttfm.speak('Auto-DJing set to ' + Config.AutoDJ + '.'); break; case 'booth': ttfm.addDj(); break; case 'floor': ttfm.remDj(Config.BotId); break; case 'skip': ttfm.stopSong(); break; // fans case 'fan': SetFan(param); break; case 'unfan': DeleteFan(param); break; // queue case 'snag': QueueTrack(); break; case 'removelast': DequeueLast(); break; // voting case 'a': case 'awesome': ttfm.vote('up'); break; case 'l': case 'lame': ttfm.vote('down'); break; } } } });
function AutoBopCheck() { if (Config.AutoBop) { ttfm.vote('up'); } }
bot.on('speak', function (data) { // The content of the message var text = data.text; // The user issuing the message var user = data.name; // Does user have permission for bot commands var isAdmin = $.inArray(user, config.botAdmins) > -1; /** * Greeting and Salutation auto messages */ if (text.match(/^\/(hello|greetings)$/)) { bot.speak('Hey! How are you ' + user + ' ?'); } /** * Bop Counter * */ if (text.match(/^\/(bop|dance|thumbsup|like)/)) { // No voting for your own song if (bot.dj.djName === user && !isAdmin) { setTimeout(function() { bot.speak(user + ', are you really that big of a narcist that you had to vote for yourself?'); }, 500); setTimeout(function() { bot.speak('Shame on you ' + user + '. Shame on you.'); }, 2500); return; } bot.bopCount++; // If the instance amount of bops equals the required amount if (bot.bopCount === config.bopCount) { bot.speak('Dis a nice song ' + bot.dj.djName); bot.vote('up'); } else if (bot.bopCount < config.bopCount) { bot.speak(bot.bopCount + ' of ' + config.bopCount + ' required votes.'); } } /** * BOT ADMIN COMMANDS * * User issuing command must be in the array of accepted botPermission */ if (isAdmin) { switch(text) { // case '/go': // bot.addDj(); // setTimeout(function() { // bot.speak('Move over I\'m Djing now'); // }, 500); // break; // case '/stop': // bot.remDj(); // bot.speak('I\'m stepping why don\'t _____ start djing'); // break; // case '/skip': // bot.skip(); // bot.speak('Thank you ' + user + '. That song is borrring.'); // break; // case '/addsong': // // Bot adds song to the bottom of it's DJ queue on /addsong command // bot.playlistAll(function (data) { // bot.playlistAdd(songId, data.list.length); // }); // bot.snag(); // break; // case '/empty': // // Remove the current song from next queue // bot.playlistAll(function (data) { // bot.playlistRemove(songId, data.list.length); // }); // break; // default: // //bot.speak('I don\' understand the command @' + user + '.'); // //console.log(text) // break; } } }); // END SPEAKING METHODS
bot.on('pmmed', function (data) { /** we have to get the variables again **/ var name = data.name; var sender = data.senderid; var text = data.text; var user = data.userid; /** Test for Bot Responsiveness **/ if (text.match(/^hi$/)) { bot.pm('Hey! How are you ?',sender); bot.pm('I\'m just glad to have somebody to talk to.',sender); } if (text.match(/^test$/)) { //if (moderatorList.indexOf(user) >= 0) { if (settings.BOT_MODERATORS_ARRAY.indexOf(user) >= 0||moderatorList.indexOf(user) >= 0) { bot.pm('hi mod',sender); } else { bot.pm('hi user '+user+'',sender); } } /** Look in Moderators array to see if private messaging (PM) with an admin. If in PM with an admin, allow user to moderate via PM. **/ if (settings.BOT_MODERATORS_ARRAY.indexOf(user) >= 0||moderatorList.indexOf(user) >= 0) { /** Am I a bot admin? **/ if (text.match(/^\/botadmin$/)) { bot.pm('Yes, you\'re my admin.',sender); } /** Make Bot DJ if spot is open **/ if (text.match(/^\/dj$/)) { bot.pm('Okay.',sender); bot.addDj(); } /** Make Bot quit DJ'ing **/ if (text.match(/^\/dj off$/)) { bot.pm('Okay.',sender); bot.remDj(); } /** Upvote Current Song **/ if (text.match(/^\/upvote|up$/)) { bot.bop(); } /** Downvote Current Song **/ if (text.match(/^\/downvote|down$/)) { bot.vote('down'); } /** Skip Current Song if bot is DJ'ing **/ if (text.match(/^\/skip$/)) { bot.pm('Gonna skip this song.',sender); bot.skip(); } /** Snag the Song Currently Playing **/ if (text.match(/^\/feart|\/snag$/)) { bot.pm('Gonna heart this song',sender); bot.roomInfo(true, function(data) { var song = data.room.metadata.current_song._id; var songName = data.room.metadata.current_song.metadata.song; bot.snag(); bot.playlistAdd(song); }); } //end snag } });
var cmd_boo = function(data) { bot.vote('down') };
var cmd_bop = function(data) { bot.vote('up') };
setTimeout(function () { console.info('Voting up for ' + data.room.metadata.current_dj); bot.vote('up'); }, 1012 + Math.floor(Math.random()*10000));
function adminCommands(msg, msgMethod, senderId) { var values = msg.split(' '); var command = values.shift(); switch (command) { case 'silence': silence=true; respond('Bot silenced.', msgMethod, senderId); break; case 'speak': silence=false; respond('Bot will now speak', msgMethod, senderId); break; case 'dance': bot.vote('up'); break; case 'room': if(values.length > 0) { switchRoom(values[0]); } break; case 'say': bot.speak(values.join(' ')); break; case 'mods': console.log(adminList); break; case 'avatar': setAvatar(values.join(' ')); break; case 'os': bot.modifyLaptop(values.join(' ')); break; case 'songcount': printSongCount(); break; case 'status': console.log('Silent mode: ' + silence); console.log('Queue On: ' + queueOn); console.log('DJ Greet: ' + djGreetOn); console.log('Can dance: ' + danceOn); console.log('Current vote: ' + currentVote); console.log('Kick TT Dash: ' + bootTTDashBots); console.log('Current theme: ' + THEME); console.log('AutoSnag: ' + autoSnag); break; case 'theme': THEME = values.join(' '); break; case 'kicktton': bootTTDashBots = true; break; case 'kickttoff': bootTTDashBots = false; break; case 'godj': case 'djup': bot.addDj(); break; case 'stopdj': case 'djdown': bot.remDj(); break; case 'snagon': autoSnag = true; bot.speak('Autosnag on'); break; case 'snagoff': autoSnag = false; break; case('setsc'): case('scset'): case('setsoundcount'): console.log(values); if(values.length > 1) { var value = values.pop(); var user = values.join(" "); console.log('user: '******'number: ' + value); setSongCount(user, value); } break; default: console.log('I got something, don\'t know what ' + msg); } }
bot.on('speak', function (data) { // Get the data var name = data.name; var text = data.text; var userid = data.userid; if(userid == conf.USERID) { return; } if(text.match(/^\//) || text.match(/^\./)) { var values = text.substring(1).split(" "); var command = values.shift().toLowerCase(); switch(command) { case('hello'): case('hi'): case('hey'): speakOut('Hey ' + name + '!'); break; //Dancing commands case('boogie'): case('boxstep'): case('breakdance'): case('cabbagepatch'): case('carlton'): case('thecarlton'): case('chacha'): case('charliebrown'): case('charleston'): case('dance'): case('disco'): case('dougie'): case('electricslide'): case('grind'): case('groove'): case('handjive'): case('headbang'): case('hokeypokey'): case('hula'): case('hustle'): case('thehustle'): case('jazzhands'): case('jig'): case('jitterbug'): case('jive'): case('lindyhop'): case('mambo'): case('mashedpotato'): case('moonwalk'): case('mosh'): case('pogo'): case('poledance'): case('polka'): case('popandlock'): case('popnlock'): case('robot'): case('rock'): case('rockout'): case('rock out'): case('rocklobster'): case('runningman'): case('safetydance'): case('salsa'): case('shimmy'): case('shuffle'): case('shufflin'): case('skank'): case('snoopydance'): case('snoopy'): case('squaredance'): case('sway'): case('swing'): case('tango'): case('tapdance'): case('truffleshuffle'): case('twist'): case('vogue'): case('waltz'): case('watusi'): case('wiggle'): case('worm'): case('theworm'): case('ymca'): dance(); break; case('kiss'): dance("Aw shucks... Thanks " + name + "! :kiss:"); break; case('hug'): dance('SQUEEZE!'); break; case('fonz'): case('fonzie'): dance('Ayyyyeeeee! :thumbsup: :thumbsup:'); break; case('botsnack'): dance('OM NOM NOM'); break; case('fozzie'): case('fozziebear'): speakOut('Waka Waka Waka'); break; case('frown'): if(isAdmin(userid)) { if(currentVote == 'down') { speakOut('I have already expressed my displeasure for the current musical selection'); } else { bot.vote('down'); speakOut('What is this? I don\'t even...'); currentVote = 'down'; } } else { speakOut('I will not help spread your hate.'); } break; //Stats commands case('mystats'): doUserStats(data); break; case('mybest'): doUserBest(data); break; case('bestplay'): doRecord(); break; case('topartist'): doTopArtist(); break; case('rules'): if(bot.roomId == conf.WOOT) { speakOut(WOOT_RULES_1); setTimeout(function() { speakOut(WOOT_RULES_2) }, 250); setTimeout(function() { speakOut(WOOT_RULES_3) }, 500); setTimeout(function() { speakOut(WOOT_RULES_4) }, 750); setTimeout(function() { speakOut(WOOT_RULES_5) }, 1000); setTimeout(function() { speakOut(WOOT_RULES_6) }, 1250); setTimeout(function() { speakOut(WOOT_RULES_7) }, 1500); } break; case('commands'): listCommands(userid); break; case('songcount'): case('sc'): printSongCount(); break; case('clearsc'): case('scclear'): if(isAdmin(userid)) { resetSongCount(); speakOut('Song count reset for all DJs'); } break; case('setsc'): case('scset'): case('setsoundcount'): if(isAdmin(userid)) { console.log(values); if(values.length > 1) { var value = values.pop(); var user = values.join(" "); console.log('user: '******'number: ' + value); setSongCount(user, value); } } break; case('q'): case('queue'): parseQueueCommand(values,userid,name); break; case('speak'): case('talk'): if(isAdmin(userid)) { silence = false; speakOut('I can talk!'); } break; case('silence'): if(isAdmin(userid)) { speakOut('I\'ll be quiet'); silence = true; } else { speakOut('You can\'t shut me up'); } break; case('djgreeton'): if(isAdmin(userid)) { djGreetOn = true; speakOut('DJ Greeting turned on'); } break; case('djgreetoff'): if(isAdmin(userid)) { djGreetOn = false; speakOut('DJ Greeting turned off'); } break; case('danceon'): if(isAdmin(userid)) { danceOn = true; speakOut('Footloose! Kick off your Sunday shoes!'); } break; case('danceoff'): if(isAdmin(userid)) { danceOn = false; speakOut('I\'m never going to dance again. Guilty feet have got no rhythm'); } break; case('theme'): if(values.length > 0) { parseThemeCommand(values.join(' '), userid); } else { sayTheme(userid); } break; case('snag'): if(userid == conf.OWNER) { snag(); } break; case('godj'): if(isAdmin(userid) || isRegular(userid)) { bot.addDj(); } else { speakOut('Nah, I\'m good just chillin\', laid back, sippin\' on gin and juice'); } break; case('stopdj'): case('stepdown'): if(isAdmin(userid) || isRegular(userid)) { bot.remDj(); } else { speakOut('You\'ll never stop the music!'); } break; case('skip'): case('skipsong'): if(isAdmin(userid) || isRegular(userid)) { bot.skip(); } break; case('data'): speakOut('Yes Captain Picard?'); break; case('sunglasses'): putOnSunglasses(); break; case('good'): if(values.length == 1) { if(values[0] == 'boy' || values[0] == 'girl') { speakOut("Woof!"); } } break; case('version'): speakOut("OiteBot. Created by BruceOite. Currently running version " + myScriptVersion); break; case('woot'): parseWootCommand(values); break; case('fact'): sayFact(); break; case('boc'): sayBoc(); break; } } else if(text == ':dancers:') { dance(); } });