Beispiel #1
0
	bot.on('newsong', function (data){ 
	var twit = new twitter({
		consumer_key: configJSON.twitter.consumer_key,								//add your consumer key
		consumer_secret: configJSON.twitter.consumer_secret,						//add your consumer secret key
		access_token_key: configJSON.twitter.access_token_key,						//add your access token
		access_token_secret: configJSON.access_token_secret							//add your access token secret
		});
	try {
		bot.roomInfo(true, function(data) {										//tweet on new song change event
			var currDJ = data.room.metadata.current_dj							//grabs the current DJ UserID
			var currSong = data.room.metadata.current_song.metadata.song;		//grabs the current songs name
			var currArtist = data.room.metadata.current_song.metadata.artist;	//grabs the current songs artist
			
			//TODO: convert currDJ from UserID to UserName
			twit
			.verifyCredentials(function (err, data) {
			})
			.updateStatus('The DJ ' + 'is chilling us w/ ' + currSong + ' - ' + currArtist + ' http://turntable.fm/chillout_tent5 #turntablefm #chillouttent', //replace the URL with your own rooms or delete.
				function (err, data) {
					console.log(timeStamp() + ' Tweeted track change');
				}
			);
		});
	} catch (err) {
		bot.speak(err.toString());
		}
	});
Beispiel #2
0
function checkQueue()
{
    // zero means just whenever dj slots are full
    // otherwise, this is the limit of real people when we start enforcing the queue
    var queue_limit = 6;
    var guests = 0;

    bot.roomInfo(function (data){
	var djcount = data.room.metadata.djcount;
	var firstDJ = data.djids[0];

	for (var i = 0; i < data.users.length; i++)
	{
	 if (data.users[i].name.match('Guest'))
	     guests++;
	}

	var num_list = data.room.metadata.listeners -1 -ttstats -guests;
	
	if (djcount == 5 && num_list >= queue_limit)
	    {

		bot.remDj(firstDJ, function(){
		    bot.speak(':warning: Enforcing Queue :warning:');
		});
	    }
	
    });
}
Beispiel #3
0
function QueueTrack() {
    ttfm.roomInfo(function(roomInfo) {
        if (roomInfo.room.metadata.current_song._id) {
            ttfm.playlistAll(function(playlistAll) {
                if (playlistAll.success) {
                    if (playlistAll.list) {
                        ttfm.playlistAdd(
                            roomInfo.room.metadata.current_song._id,
                            playlistAll.list.length - 1, // index of the last item
                            function(playlistAdd) {
                                if (playlistAdd.success) {
                                    ttfm.speak('Song added to queue.');
                                } else {
                                    LogError('Unable to add song to queue.');
                                }
                            });
                    } else {
                        LogError('Unable to add song to queue.');
                    }
                } else {
                    LogError('Unable to add song to queue.');
                }
            });
        } else {                                
            LogError('Unable to add song to queue.');
        }
    });
}
Beispiel #4
0
function informRoom(str, userid)
{
    bot.roomInfo( true, function (data)
		  {
		      real_list = data.room.metadata.listeners -1 -ttstats;
		      vote_count = data.room.metadata.upvotes;
		      var vratio = vote_count / real_list;

		      for (var i = 0; i < data.users.length; i++)
		      {
			  if (data.users[i].userid == userid)
			  {
			      var username = data.users[i].name;
			      break;
			  }

		      }
		      if (str == 'vote')
		      {
			  if (userid == null || userid == undefined || username == undefined)
			      console.log('Vote... Downvote :(' + ' Ratio = '+vratio.toFixed(2));
			  else
			      console.log('Vote... '+userid+ ' (' +username+ ')' + ' Ratio = ' +vratio.toFixed(2));
		      }
		      
		      if (str == 'add')
		      {
			  bot.speak(username + ' added this song to their playlist');
			  console.log('Add... '+userid+ ' (' +username+ ')');
			  add_count++;
		      }
		  });
}
Beispiel #5
0
bot.on('newsong', function (data){ 
	// Tweet the new song from the twitter apps account you created. Gives the song name, artist, and #turntablefm hashtag
	var twit = new twitter({
		consumer_key: 'XXXXXX', //add your consumer key
		consumer_secret: 'XXXXXX', //add your consumer secret key
		access_token_key: 'XXXXXX', //add your access token
		access_token_secret: 'XXXXXX' //add your access token secret
	});
	try {
		bot.roomInfo(true, function(data) { //tweet on new song change event
			//var currDJ = data.room.metadata.current_dj							//grabs the current DJ
			var currSong = data.room.metadata.current_song.metadata.song;		//grabs the current songs name
			var currArtist = data.room.metadata.current_song.metadata.artist;	//grabs the current songs artist
			
			//TODO: convert currDJ from UserID to UserName
			twit
			.verifyCredentials(function (err, data) {
//				console.log(data);
			})
//			.updateStatus(currDJ + 'is playing "' + currSong + '" by: "' + currArtist + '" - Come listen! http://turntable.fm/chillout_tent5 #turntablefm #chillouttent', //replace the URL with your own rooms or delete.
			.updateStatus('Now playing "' + currSong + '" by: "' + currArtist + '" - Come listen! http://turntable.fm/chillout_tent5 #turntablefm #chillouttent', //replace the URL with your own rooms or delete.
				function (err, data) {
//					console.log(data);
				}
			);
		});
	} catch (err) {
		bot.speak(err.toString());
	}
});
Beispiel #6
0
bot.on('ready', function(data){
  bot.roomInfo(function(data){
    setCurrentSong(data);
    if(data.djids.length > 0 && data.djids.length < 3){
      bot.addDj();
    }
  });
});
Beispiel #7
0
bot.on('update_votes', function (data)
{
    // grab the user id of the most recent voter
    // this might be in data already?
    var info = data.room.metadata.votelog[0][0];
    var real_list = 0;


    bot.roomInfo(true, function (data)
		 {

		     real_list = data.room.metadata.listeners -1 -ttstats;
		     vote_count = data.room.metadata.upvotes;
		     var curdj = data.room.metadata.current_song.djname;
		     var vratio = vote_count / real_list;

		     // bot votes if approval is above 40%		     
		     if (curdj != BOTNAME && vote_flag == 0 && vratio > 0.4)
		     {
			 bot.speak('Thumbs up!');
			 bot.bop();
			 vote_flag = 1;
			 vote_count = data.room.metadata.upvotes;
			 vratio = vote_count / real_list;
		     }

		     informRoom('vote', info);

		     // if bot is not the dj, there are more than 2 upvotes, and approval is over 50%, snag song
		     if (curdj != BOTNAME && snag_flag == 0 && vote_count > 2 && vratio >= 0.5)
			 {
			     bot.speak('Everyone seems to like this song, I\'m snagging it');

			     // doesn't actually snag, only makes the little heart animation happen
			     bot.snag();

			     // check noadd flag, leaving the heart animation as a little white lie, so
			     // noone's feelings get hurt :)
			     if (noadd == 0)
			     {
				 console.log('ratio over half... adding song to queue');
				 // playlist is pretty big, let's stick the
				 // new song at index 80 since we shuffle regularly now
				 // hardcoding this number, don't want to do a whole call to playlistAll()				 
				 bot.playlistAdd(data.room.metadata.current_song._id, 80);
			     }
			     else
				 console.log('ratio over half, but noadd set');


			     add_count++;
			     snag_flag = 1;
			 }

		 });

});
Beispiel #8
0
function snag() {
	bot.snag();
	bot.roomInfo(true, function(data) {
		var newSong = data.room.metadata.current_song._id;
		var newSongName = songName = data.room.metadata.current_song.metadata.song;
		bot.playlistAdd(newSong);
		speakOut('Added '+ newSongName +' to playlist.');
	});
}
Beispiel #9
0
bot.on('deregistered', function(data){

    var name = data.user[0].name;

    // prevent users leaving bot playing by himself in the room when they leave
    // doing this here so it happens as soon as last user leaves
    // stopping the bot from potentially starting another song


    // @ttstats bot just left, take them out of vote calculations
    if (name.match(/@ttstats_/))
    {
	ttstats = 0;
	console.log('cleared ttstats flag');
    }

    console.log(name+ '    left the room ' +timeNow());
    
    bot.roomInfo(false, function(data){
	
//	console.log(data);		
	
	if (data.room.metadata.djcount == 1 && data.room.metadata.current_dj == USERID)
	{
	    var audience = 0;
	    for (var i = 0; i < data.users.length; i++)
	    {
		var name = data.users[i].name;

		if (!name.match('Guest') && !name.match(BOTNAME) && !name.match(/@ttstats_/))
		    {
			console.log(name+ ' still listening');
			console.log(data.users[i]); // attempting to check idle time of listener
			audience++;
		    }
	    }
	    
	    if (audience == 0)
	    {
		console.log('no one is listening anymore, stop DJing');
		bot.remDj(USERID);
		bot_dj = 0;
	    }
	    
	    // should probably also check the idle time of people still listening
	    else
		console.log('someone is still listening');
	}
	
    });
    
});
Beispiel #10
0
ttfm.on('ready', function() {
    AutoBopCheck();
    // populate active DJs
    ttfm.roomInfo(false, function(info) {
        if (info.success) {
            var djs = info.room.metadata.djs;
            for (i in djs) {
                AddActiveDJ(djs[i]);
            }
        }
    });
    AutoDJCheck();
});
Beispiel #11
0
function SetFan(name) {
    ttfm.roomInfo(true, function(info) {
        if (info.users) {
            for (i in info.users) {
                var u = info.users[i];
                if (u.name.toLowerCase() == name) {
                    ttfm.becomeFan(u.userid, function(data) {
                        if (data.success) {
                            ttfm.speak('/me became a fan of ' + u.name + '.');
                        } else {
                            LogError('Unable to become a fan of ' + u.name + '.');
                        }
                    });
                    return;
                }
            }
        }
        LogError('Unable to locate user Id for ' + name + '.');
    });
}
Beispiel #12
0
function SetAdmin(name) {
    ttfm.roomInfo(true, function(info) {
        if (info.users) {
            for (i in info.users) {
                var u = info.users[i];
                if (u.name.toLowerCase() == name) {
                    DB.DJ.Add(u.userid, u.name, u.created, true, function(err, dj) {
                        if (err) {
                            LogError(err);
                        } else {
                            ttfm.speak(u.name + ' added as an admin.');
                        }
                    });
                    return;
                }
            }
        }
        LogError('Unable to locate user Id for ' + name + '.');
    });
}
Beispiel #13
0
function AutoDJCheck() {
    ttfm.roomInfo(false, function(data) {
        if (data.success) {
            // hop in the booth if we're auto-djing and requirements have been met
            if (Config.AutoDJ
                && data.room.metadata.djcount <= Config.AutoDJMin
                && (!data.room.metadata.djs || data.room.metadata.djs.indexOf(Config.BotId) < 0)) {
                if (Config.AutoDJEnterMessage) { ttfm.speak(Config.AutoDJEnterMessage); }
                ttfm.addDj();
            // otherwise, hop out if we're not currently playing a song and requirements have been met
            } else if (data.room.metadata.current_dj
                && data.room.metadata.current_dj != Config.BotId
                && data.room.metadata.djs
                && data.room.metadata.djs.indexOf(Config.BotId) != -1
                && data.room.metadata.djcount >= Config.AutoDJMax) {
                if (Config.AutoDJExitMessage) { ttfm.speak(Config.AutoDJExitMessage); }                
                ttfm.remDj(Config.BotId);
            }
        }
    });
}
Beispiel #14
0
ttfm.on('update_votes', function(data) {
    if (data.success) {
        var votes = data.room.metadata.votelog;
        for (i in votes) {
            AFKDJUpdate(votes[i][0]);
        }        
    }
    // if we've already handled creating the necessary db entries, just update vote data
    if (currentPlayId && data.success) {
        DB.Play.UpdateVotes(
            currentPlayId,
            data.room.metadata.downvotes,
            data.room.metadata.listeners,
            data.room.metadata.upvotes,
            function(err) { LogError(err); }
        );
    // otherwise, make sure we have all valid db entries
    } else {
        ttfm.roomInfo(true, function(info) {
            if (info.success) { PopulateCurrent(info); }
        });
    }
});
Beispiel #15
0
global.CheckAdmin = function (userid) {
	var isMod = false;
    bot.roomInfo(true, function(info) {
		//not certain I need this if - REMOVE?
        if (info.room.metadata.moderator_id) {
			// loop through users to validate all users in room
			for (i in info.users) {
                var u = info.users[i];
                if (u.userid.toLowerCase() == userid) {
					console.log(u.name + ' is a valid user. UserID: '+u.userid);
					// loop through moderators
					for (j in info.room.metadata.moderator_id) {
						var v = info.room.metadata.moderator_id[j];
						if (v.toLowerCase() == userid) {
							//v.moderator_id.toString();
							console.log(v.moderator_id + ' matches a MODID: '+u.userid);
							//what do I do here to indicate to callee we found a MOD?
							this.isMod = true;
							return;
						} else {
							console.log('not a MODID');
							this.isMod = false;
							// putting return drops us out of the loop at 
							// the first NOT match - not what we want
							//return;
						}
					}
					console.log('post admin check');
				//  
				return;
                }
            }
        }
		//We'll log an error finding userID passed to CheckAdmin 
        console.log('Unable to locate user Id for ' + u.name + ' UserID: '+u.userid);
    });
}
Beispiel #16
0
bot.on('speak', function (data) {
	// Use this if you only want the command available to BOTs master
	//if ((data.text.match(/chillbot/i)) && (data.userid == MASTERID)) { 
	if ((data.text.match(/chillbot/i)) && (admincheck(data.userid) === true)) {
		//tell the bot to enter silent mode (doesnt announce users or welcome people or respond to commands other than admin commands)
		if (data.text.match(/shutup/i)) {
			shutUp = true;
			//bot.speak('Silent mode activated.');
		}
		//let the bot speak again
		if (data.text.match(/speakup/i)) {
			shutUp = false;
			//bot.speak('Chatterbox mode activated.')
		}
		//makes the bot get on stage
		if (data.text.match(/djmode/i)) {                   
			//bot.speak('Amuse my master mode activated.');
			bot.addDj();
		}
		//makes the bot get on stage
		if (data.text.match(/stepup/i)) {                   
			//bot.speak('Amuse my master mode activated.');
			bot.addDj();
		}
		//tells the bot to get off stage and get in the crowd
		if (data.text.match(/getdown/i)) {                  
			//bot.speak('Yes master.');
			//bot.speak('Aural destruction mode de-activated.')
			bot.remDj();
		}
		//tells the bot to get off stage and get in the crowd
		if (data.text.match(/stepdown/i)) {                  
			//bot.speak('Yes master.');
			//bot.speak('Aural destruction mode de-activated.')
			bot.remDj();
		}
		//tells the bot to skip the track it is playing
		if (data.text.match(/skip/i)) {                     
			//bot.speak('As you wish master.');
			bot.skip();
		}
		//remind your robot hes a good boy. Just in case the robot apocalypse happens, maybe he will kill you last.
		if (data.text.match(/good/i)) {
			//bot.speak('The masters desires are my commands');
		}
		//remind your robot hes a good boy. Just in case the robot apocalypse happens, maybe he will kill you last.
		if (data.text.match(/dance/i)) {
			console.log('MOD told me to bop, boppin\'');
			bot.bop();
		}
//		//remove current_dj
//		if (data.text.match(/remove/i)) {
//			// this works, though it only removes the BOT MASTER
//			//bot.remDj(MASTERID);
//			bot.roomInfo(true, function(data) { 
//				var currDJ = data.room.metadata.current_dj;
//				bot.remDj(currDJ);
//			});
//		}
		//boot NOT DONE YET
		if (data.text.match(/boot/i)) {                     
			//bot.bootUser(data.users.userID, 'Removed at Moderators request');	
		}
		//wave goodbye
		if (data.text.match(/wave/i)) {                     
			bot.speak('Adios mi chill amigo!');	
		}
		//Shuts down bot (only the main admin can run this)
		//Disconnects from room, exits process.
		if (data.text.match(/shutdown/i)) {
			console.log(timeStamp() + 'Shutdown called: '+data.text);
			bot.speak('Shutting down...');
			bot.roomDeregister();
			process.exit(0);
		}
		//tell the bot to go into voodoo doll avatar. What better avatar for your toy?
		if (data.text.match(/voodoo up/i)) {
		  try {
			bot.setAvatar(10);
			//bot.speak('I am the masters toy.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//the ladies love a kitten. but really its punishment mode for the robot.
		if (data.text.match(/kitten up/i)) {
		  try {
			bot.setAvatar(19);
			//bot.speak('Did I anger the master?');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//his dj skillz/dance moves are outta this world
		if (data.text.match(/alien up/i)) {
		  try {
			bot.setAvatar(12);
			//bot.speak('Alien dance form entered.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//if he sparkles, this command will be removed
		if (data.text.match(/vampire up/i)) {
		  try {
			bot.setAvatar(16);
			//bot.speak('Like this master? I dont want to be punished for being too Twilight.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//tell the bot to go into blue kitten avatar. What better avatar for your toy?
		if (data.text.match(/kitten blue/i)) {
		  try {
			bot.setAvatar(18);
			//bot.speak('I am the masters toy.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//tell the bot to go into gorilla avatar. What better avatar for your toy?
		if (data.text.match(/gorilla up/i)) {
		  try {
			bot.setAvatar(23);
			//bot.speak('I am the masters toy.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//tell the bot to go into horny devil avatar. What better avatar for your toy?
		if (data.text.match(/horn up/i)) {
		  try {
			bot.setAvatar(22);
			//bot.speak('I am the masters toy.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//tell the bot to go into blue bear avatar. What better avatar for your toy?
		if (data.text.match(/blue bear/i)) {
		  try {
			bot.setAvatar(17);
			//bot.speak('I am the masters toy.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//tell the bot to go into vacant stare pink hair avatar. What better avatar for your toy?
		if (data.text.match(/pink hair/i)) {
		  try {
			bot.setAvatar(21);
			//bot.speak('I am the masters toy.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//tell the bot to go into vacant stare white hair avatar. What better avatar for your toy?
		if (data.text.match(/white hair/i)) {
		  try {
			bot.setAvatar(20);
			//bot.speak('I am the masters toy.');
			////bot.speak('I am the masters toy.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
			////bot.speak('I do not have that form master.');
		  }
		}
		//adds the current playing song to the bots playlist
		if (data.text.match(/addsong/i)) {
		   bot.roomInfo(true, function(data) {
			  try {
				var newSong = data.room.metadata.current_song._id;
				var newSongName = songName = data.room.metadata.current_song.metadata.song;
				bot.playlistAdd(newSong);
				bot.speak('Added '+newSongName+' to my playlist.');
				console.log(timeStamp() + ' Added ' +newSongName+ ' to playlist');
			  } catch (err) {
				errMsg(err);
			  }
		   });
		}
		//removes the current playing song to the bots playlist
		if (data.text.match(/deletesong/i)) {
		   bot.roomInfo(true, function(data) {
			  try {
				var newSong = data.room.metadata.current_song._id;
				var newSongName = songName = data.room.metadata.current_song.metadata.song;
				bot.playlistRemove(newSong);
				bot.speak('Removed '+newSongName+' from my playlist.');
				console.log(timeStamp() + ' Removed ' +newSongName+ ' from my playlist');
			  } catch (err) {
				errMsg(err);
			  }
		   });
		}
		//The below commands will modify the bots laptop. Set before he takes the stage. This command can be activated while the bot is DJ'ing, however, the laptop icon will not change until he leaves the stage and comes back.
		//set the bots laptop to an iPhone
		if (data.text.match(/phone up/i)) {
			bot.speak('iPhone mode ready master.');
			console.log(timeStamp() + ' iPhone mode ready.');
			bot.modifyLaptop('iphone');
		}
		//set the bots laptop to a mac
		if (data.text.match(/fruit up/i)) {
			bot.speak('Apple mode ready master.');
			console.log(timeStamp() + ' Apple mode ready.');
			bot.modifyLaptop('mac');
		}
		//set the bots laptop to linux
		if (data.text.match(/nix up/i)) {
			bot.speak('Ubuntu mode ready master.');
			console.log('Ubuntu mode ready.');
			bot.modifyLaptop('linux');
		}
		//set the bots laptop to chromeOS
		if (data.text.match(/chrome up/i)) {
			bot.speak(timeStamp() + ' Riding on chrome son.');
			console.log('Chrome mode ready.');
			bot.modifyLaptop('chrome');
		}
	// End "repond to /chillbot <command>"	
	};
// End "do things while 'speaking'"
});
Beispiel #17
0
bot.on('pmmed', function (data){

    var text = data.text;
    var userid = data.senderid;
    var name = '';

    bot.roomInfo(false, function(data){

	for (var i = 0; i < data.users.length; i++)
	{
	    if (data.users[i].userid == userid)
		name = data.users[i].name;
	}
	
	
	//Respond to "/votes" command
	if (text.match(/^\/votes$/))
	{
	    var up = data.room.metadata.upvotes;
	    var down = data.room.metadata.downvotes;
	    bot.pm('Current song votes - up: ' +up+ ' down: ' +down, userid);
	}
	
	//Respond to "/botup" command
	else if (text.match(/^\/botup$/))
	{
	    console.log(name+ ' wants bot to DJ');
	    shuffle(function(){
		bot.addDj();
		bot_dj = 1;
	    });
	}
	
	//Respond to "/botdown" command
	else if (text.match(/^\/botdown$/))
	{
	    console.log(name+ ' wants bot to stop DJing');
	    bot.remDj(USERID);
	    bot_dj = 0;
	}
	
	//Respond to "/skip" command
	else if (text.match(/^\/skip$/))
	{
	    console.log(name+ ' wants bot to skip the song');
	    if (bot_dj == 1)
	    {
		bot.skip();
		bot.speak(name+ ' wants me to skip this song');
	    }

	    else
		bot.pm('Sorry, I\'m not the DJ... can\'t skip', userid);
	    
	}
	
	// Respond to "/hello" command
	else if (text.match(/^\/hello$/)) 
	{
	    bot.pm('Hey! How are you '+name+'?', userid);
	}
	
	//Respond to "/bop" command
	else if (text.match(/^\/bop$/))
	{
	    if (vote_flag == 1)
		bot.pm('I already voted', userid);
	    
	    else if (data.room.metadata.current_dj == USERID)
		bot.pm('uh, I\'m the dj... I can\'t vote', userid);
	    
	    else
	    {
		bot.speak('OK, I\'ll vote for this song '+name);
		bot.bop();
		vote_flag = 1;
	    }
	}	

	// Respond to "/stats" command
	else if (text.match(/^\/stats$/))
	{
	    stats('pm', name, userid);
	}

	// Respond to "/lb" (leaderboard) command
	else if (text.match(/^\/lb$/))
	{
	    leaderboard('pm', name, userid);
	}

	// Respond to "/escort" (leaderboard) command
	else if (text.match(/^\/escort$/))
	{
	    console.log('adding ' +name+ ' to escort queue');
	    escort.push(name);
	    bot.pm('OK ' +name+ ', I\'ll escort you after your next song ends', userid);
	}
	
////////// ADMIN COMMANDS /////////////////////////////////////

	// TBD: store user rights in db and query for isadmin instead of hardcoding usernames
	
	// don't add the current song
	else if (text.match(/^\/noadd$/) && name.match('benw54'))
	{
	    noadd = 1;
	    bot.pm('OK, I won\'t add this song', userid);
	}

	// commands to control voltron volume
	else if (text.match(/^\/(unmute|mute)$/) && 
		 (name.match('benw54') || name.match('Farmer Maggie') || name.match('Safarry') || name.match('lucasmo')))
	{
	    volOnOff(text);
	}

	// request voltron's current volume
	else if (text.match(/^\/vol\?$/) && 
		 (name.match('benw54') || name.match('Farmer Maggie') || name.match('Safarry') || name.match('lucasmo')))
	{
	    var options = {
		host: 'voltron',
		port: 80,
		path: '/internal/audioControl/'
	    };
	    
	    var req = http.request(options, function (resp){
		resp.setEncoding('utf8');
		resp.on('data', function(chunk) {
		    var str = chunk.slice(chunk.search(/\<.*thick.*\>/),chunk.search('thick'));
		    var str2 = str.slice(str.search('value'), str.search('style'));
		    var str3 = str2.slice(str2.search('\"')+1, str2.search('\%'));
		    
		    bot.pm('Volume: ' +str3+ '%', userid);
		});
		resp.on('error', function (error) {
		    console.log('Got an error ' +error);
		});
	    });
	    
	    req.end();
	}

	else if (text.match(/^\/vol(\+|\-)$/) && 
		 (name.match('benw54') || name.match('Farmer Maggie') || name.match('Safarry') || name.match('lucasmo')))
	{
	    volRelative(text, userid);
	}

///////////////////////////////////////////////////////////////

	//Respond to "/info" command
	// or give info for any other PMs,
	// what else would the bot say? :)
	else // if (text.match(/^\/info$/))
	{
	    pmCMD(name, userid);
	}
    });
});
Beispiel #18
0
bot.on('speak', function (data) 
{
    // Get the data
    var name = data.name;
    var text = data.text;
    
    // commands are a new line starting with '/' , followed by the actual command, and ending with newline

    // Respond to "/hello" command
    if (text.match(/^\/hello$/)) 
    {
	bot.speak('Hey! How are you '+name+'?');
    }
    
    //Respond to "/bop" command
    else if (text.match(/^\/bop$/))
    {
	console.log('About to Bop');
//	console.log(data);

	bot.roomInfo(false, function(data){
//	    console.log(data);
	    if (vote_flag == 1)
		bot.speak('I already voted');
	    
	    else if (data.room.metadata.current_dj == USERID)
		bot.speak('uh, I\'m the dj... I can\'t vote');
	    
	    else
	    {
		bot.speak('OK, I\'ll vote for this song '+name);
		bot.bop();
		vote_flag = 1;
	    }
	});

    }	

    //Respond to "/votes" command
    else if (text.match(/^\/votes$/))
    {
	bot.roomInfo(false, function(data){
	    var up = data.room.metadata.upvotes;
	    var down = data.room.metadata.downvotes;
	    bot.speak('Current song votes - up: ' +up+ ' down: ' +down);
	});

    }

    //Respond to "/info" command
    else if (text.match(/^\/info$/))
    {
	pmCMD(data.name, data.userid);
    }

    //Respond to "/botup" command
    else if (text.match(/^\/botup$/))
    {
	console.log(name+ ' wants bot to DJ');
	shuffle(function(){
	    bot.addDj();
	    bot_dj = 1;
	});
    }

    //Respond to "/botdown" command
    else if (text.match(/^\/botdown$/))
    {
	console.log(name+ ' wants bot to stop DJing');
	bot.remDj(USERID);
	bot_dj = 0;
    }

    //Respond to "/skip" command
    else if (text.match(/^\/skip$/))
    {
	console.log(name+ ' wants bot to skip the song');
	if (bot_dj == 1)
	    {
		bot.skip();
		bot.speak(name+ ' wants me to skip this song');
	    }
	else
	    bot.speak('I\'m not the DJ... can\'t skip');

    }

    // Respond to "/lb" (leaderboard) command
    else if (text.match(/^\/lb$/))
    {
	leaderboard('room', name, null);
    }

    // Respond to "/escort" command
    else if (text.match(/^\/escort$/))
    {
	console.log('adding ' +name+ ' to escort queue');
	escort.push(name);
	bot.speak('OK ' +name+ ', I\'ll escort you after your next song ends');
    }

    // Respond to Admin commands

    if (name.match('benw54') || name.match('Farmer Maggie') || name.match('Safarry') || name.match('lucasmo'))
    {

	// Respond to mute / unmute commands
	if (text.match(/^\/(mute|unmute)$/))
	{
	    volOnOff(text);
	}
	
	// Respond to command to change vol up or down
	else if (text.match(/^\/vol(\+|\-)$/))
	{
	    volRelative(text, null);
	}

	// Make volume very loud
	else if (text.match(/^\/bump this shit$/))
	    {
		volRelative('80', null);
	    }

	else if (text.match(/^\/simma down now$/))
	    {
		volRelative('20', null);
	    }

	else if (text.match(/^\/vol/))
	    {
		volRelative(text, null);	
	    }

    }
   
    // Respond to "/stats" command
    else if (text.match(/^\/stats$/))
    {
	stats('room', name, null);
    }
    
});
Beispiel #19
0
bot.on('speak', function (data) {
  if ((data.text.match(/swansonbot/i)) && (data.userid == MASTERID)) { 
    //tell the bot to enter silent mode (doesnt announce users or welcome people or respond to commands other than admin commands)
    if (data.text.match(/shutup/i)) {
      shutUp = true;
      bot.speak('I didnt want to talk to you anyway.');
    }
    //let the bot speak again
    if (data.text.match(/speakup/i)) {
      shutUp = false;
      bot.speak('If you insist, though I do prefer silence.')
    }
    //makes the bot get on stage
    if (data.text.match(/djmode/i)) {                   
      bot.speak('Duke Silver about to tear dis house up.');
      bot.addDj();
    }
    //tells the bot to get off stage and get in the crowd
    if (data.text.match(/getdown/i)) {                  
      bot.speak('Is Mouse Rat up next?');
      bot.speak('I have a steak and whiskey waiting at home anyway.')
      bot.remDj();
    }
    //tells the bot to skip the track it is playing
    if (data.text.match(/skip/i)) {                     
      bot.speak('Okay, but only because I want to.');
      bot.skip();
    }
    //You tell 'em, Ron.
    if (data.text.match(/catchphrase/i)) {
      bot.speak('Im Ron F*cking Swanson');
    }
    
    //adds the current playing song to the bots playlist
    if (data.text.match(/addsong/i)) {
       bot.roomInfo(true, function(data) {
          try {
            var newSong = data.room.metadata.current_song._id;
            var newSongName = songName = data.room.metadata.current_song.metadata.song;
            bot.playlistAdd(newSong);
            bot.speak('Added '+newSongName+' to my Swantastic playlist...April, did I do this right?');
          } catch (err) {
            errMsg(err);
          }
       });
    }
    //The below commands will modify the bots laptop. Set before he takes the stage. This command can be activated while the bot is DJ'ing, however, the laptop icon will not change until he leaves the stage and comes back.
    //set the bots laptop to an iPhone
    if (data.text.match(/phone up/i)) {
      bot.speak('I just got a beeper, you think Ron Swanson owns an iPhone?');
      bot.modifyLaptop('iphone');
    }
    //set the bots laptop to a mac
    if (data.text.match(/fruit up/i)) {
      bot.speak('APRIL!? How do you work this weird computer?');
      bot.modifyLaptop('mac');
    }
    //set the bots laptop to linux
    if (data.text.match(/nix up/i)) {
      bot.speak("Now...This is a man's computer.");
      bot.modifyLaptop('linux');
    }
    //set the bots laptop to chromeOS
    if (data.text.match(/chrome up/i)) {
      bot.speak('I just plain dont like this weird computer.');
      bot.modifyLaptop('chrome');
    }
  }
});
		bot.on('speak', function (data) {
		   // Get the data
			var name = data.name;
			var text = data.text;
			var user = data.userid;


				/** if bot name is mentioned **/
				if (text.match('/mods')) {
					if (moderatorList) bot.speak('Mods: '+moderatorList+'');
				}
				if (text.match('/djs')) {
					if (dJList) bot.speak('DJs: '+dJList+'');
				}
				/** if bot name is mentioned **/
				if (text.match(settings.BOT_NAME)) {
					bot.speak('That\'s my name, don\'t wear it out!');
				}
				/** Room Rules **/
				if (text.match(/^(?:\*|\/)rules$/)) {
				bot.speak('See '+settings.ROOM_RULES_URL+' for the room rules.');
				}
				/** Song Information **/
				if (text.match(/^\/songinfo$/)) {
				   bot.roomInfo(true, function(data) {
						var current_song = data.room.metadata.current_song;
						if (current_song) {

						var songId = current_song._id;
						var songAlbum = current_song.metadata.album;
						var songGenre = current_song.metadata.genre;
						var songName = current_song.metadata.song;
					}
					
					if (settings.DEBUG_LOGS) {
						console.log('---- BEGIN CURRENT SONG METADATA --------------------');
						if (current_song) { console.log(current_song.metadata) } else  { console.log('No song is playing.');}
						console.log('---- END CURRENT SONG METADATA --------------------');
					}
					
												
					current_song ? bot.speak(':notes: "'+songName+'" :cd: Album: '+songAlbum+' :radio: Genre: '+songGenre+'') : bot.speak(':exclamation: No song is playing.');
						
					
				
						
						
						
						
						
				   });	
				} //end songinfo
				
				/** Look in Moderators array or room mods to see if chatting with an admin.
				If chatting with an admin, allow user to moderate. **/
				if (settings.BOT_MODERATORS_ARRAY.indexOf(user) >= 0||moderatorList.indexOf(user) >= 0) {

					/** Update Bot's DJ Queue - push playing song to top of queue **/
					if (text.match(/^\*top$/)) {
					   bot.roomInfo(true, function(data) {
					      var song = data.room.metadata.current_song._id;
					      var songName = data.room.metadata.current_song.metadata.song;

						if (song) { bot.playlistAdd(song); }
							bot.speak(''+songName+' - to the top you go!');
					   });
					}
					/** fart **/
					if (text.match(/^poop$/)) {
						bot.speak('feart.');
						bot.snag();
					}
					/** Disconnect from Turntable.fm **/

					if (text.match(/^\/die$/)) {

						bot.speak('/me dies tragically.'); 
						bot.close(); //fixme
					}
					/** Get DJ's Playlist **/
						if (text.match(/^\/playlist$/)) {

							if (settings.DEBUG_LOGS) { 

								bot.pm('Okay, '+name+'. Check log for playlist.',user);

					   			bot.playlistAll(function (data) {
				      				console.log(data);
				   				});

							} 
					}
					

					
						if (text.match(/^\/votes$/)) {

							
							bot.roomInfo(true, function(data) {
							
								if (settings.DEBUG_LOGS) {
									console.log('---- BEGIN ROOM DATA --------------------');
									console.log(data.room);
									console.log('---- END ROOM DATA --------------------');
								}
								

							var room = data.room;
							var upvotes = room.metadata.upvotes;
							var downvotes = room.metadata.downvotes;
							var listeners = room.metadata.listeners;
							var djcount = room.metadata.djcount;
							bot.speak(':musical_note: :thumbsup:'+upvotes+' :thumbsdown: '+downvotes+'');
							bot.speak(':man:: '+listeners+' :hash: dj\'s: :'+djcount+':');
							
						   });
					}
					
					
					
						if (text.match(/^\/votelog$/)) {

							
							bot.roomInfo(true, function(data) {
							
								if (settings.DEBUG_LOGS) {
									console.log('---- BEGIN ROOM DATA --------------------');
									console.log(data.room);
									console.log('---- END ROOM DATA --------------------');
								}
								
							var room = data.room;
							var upvotes = room.metadata.upvotes;
							var downvotes = room.metadata.downvotes;
							var listeners = room.metadata.listeners;
							var djcount = room.metadata.djcount;
							var creatorname = room.metadata.creator.name;
							var currentdj = room.metadata.current_dj;
							var vote_log = room.metadata.votelog;
							var current_song = room.metadata.current_song;
							if (current_song) {

							var songId = current_song._id;
							var songAlbum = current_song.metadata.album;
							var songGenre = current_song.metadata.genre;
							var songName = current_song.metadata.song;
							
						}
						
						if (vote_log) {
							//todo
							/** ---- BEGIN VOTELOG DATA --------------------
							[ [ '4f9b545caaa5cd2af400022f', 'up' ] ]
							---- END VOTELOG DATA --------------------
							**/
						}
					
	
							if (settings.DEBUG_LOGS) {
								console.log('---- BEGIN VOTELOG DATA --------------------');
								console.log(vote_log);
								console.log('---- END VOTELOG DATA --------------------');
							}
							
							/** Show Upvotes, Downvotes for the current song. Show listener count, DJ count. **/
							bot.speak(':musical_note: :thumbsup:'+upvotes+' :thumbsdown: '+downvotes+'');
							bot.speak(':man:: '+listeners+' :hash: dj\'s: :'+djcount+':');
							
						   });
					}
					
					
					
					
				} //end if name in settings.BOT_MODERATORS_ARRAY - end admin chat section

		}); //end on bot speak.
		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
		}
		
	});
Beispiel #22
0
function addNewUsers()
{

    bot.roomInfo(false, function(data){

//	console.log(data.users);
//	console.log('number of users: ' +data.users.length);

	
	for (var i = 0 ; i < data.users.length; i++)
	{
	    var userid = data.users[i].userid;
	    var username = data.users[i].name;

	    //connect to database to add unknown users
	    var uclient = new pg.Client(conString);
	    
	    uclient.connect();
	    
	    uclient.on('error', function(error){
		console.log('There was an error from uclient: (' +error+')');
		uclient.end();
	    });
	

	    // this catches the @ttstats bot if it's already in the room when we enter as well as when it enters
	    if (data.users[i].name.match(/@ttstats_/) && ttstats == 0)
	    {
		ttstats = 1;
		console.log('set ttstats flag');
	    }

	    
	    // Stupid freaking non-blocking queries... tagging query result so when row event occurs, we have a way of
	    // telling which query result we are getting. There must be a better way? An array of query objects maybe?
	    // Documentation mentions Result object... look into that more
	    
	    var userdb = uclient.query("SELECT count(*) num, (SELECT username from user_info where userid = '" +userid+ "'), '" +i+ "' qn from user_info WHERE userid = '" +userid+ "';");
	    console.log('db query: ' +username+ ' - ' +userid+ ' i: ' +i);
	    
	    userdb.on('error', function(error){
		console.log('There was an error from userdb: (' +error+ ')');
	    });
	    

	    userdb.on('row',function(row){
		var j = row.qn;

		// we always return a row, if query returns 0 for the count, add user to db
		if (row.num == 0)
		{
		    var uclient2 = new pg.Client(conString);
		    
		    uclient2.connect();
		    
		    uclient2.on('error', function(error){
			console.log('There was an error from uclient: (' +error+')');
			uclient2.end();
		    });
		    
		    console.log('Added ' +data.users[j].name+ ' (' +data.users[j].userid+ ') to user database');
		    
		    var newuserdb = uclient2.query("INSERT INTO user_info VALUES ('"+data.users[j].userid+"','" +data.users[j].name+ "');", function(error){

			if (error != null)
			    console.log('There was an error from newuserdb: (' +error+ ')');

			uclient2.end();
		    });
		}

		// allowing for users who have changed their name since we met them (Usually when we meet a "Guest" and then they register)
		else if (data.users[j].name != row.username)
		{
		    var uclient2 = new pg.Client(conString);
	
		    uclient2.connect();
		    
		    uclient2.on('error', function(error){
			console.log('There was an error from uclient: (' +error+')');
			uclient2.end();
		    });

		    console.log('Updated ' +data.users[j].name+ ' (' +data.users[j].userid+ ') in user database');
		    
		    var newuserdb = uclient2.query("UPDATE user_info SET username = '******' where userid = '" +data.users[j].userid+ "';", function(error){
			
			if(error != null)
			{
			    console.log('There was an error from newuserdb: (' +error+ ')');
			    console.log('With userid: ' +data.users[j].userid+ ' name: ' +data.users[j].name+ ' qnum: ' +j);
			}
			
			uclient2.end();
		    });
		    
		}

	    });

	    // this is closing the client before the row event fires... not good
	    // No end event fires for this query. Why not!??? Cannot close the specific client at the right time :(
	    // close client for next iteration
	    //	    uclient.end();

	}

    });


}
Beispiel #23
0
bot.on('speak', function (data) {
	if (shutUp == false) {
		if (data.text.match(/^\/hello$/)) {
			//bot.speak('Hey! How are you '+data.name+' ?');
		}
		if (data.text.match(/^\/help$/)) {
			//TODO: make this give MODs the FULL list
			if (admincheck(data.userid) === true) {
			// Give MODs the full BOT command list
				bot.pm('My current MOD command list is maintained here: http://chillout-tent.wikispaces.com/Bot+Commands/ - Questions or Suggestions? hit up KJC and remember to check for new updates!', data.userid);
			} else {
				//bot.speak('My current command list is /hello, /help, /rules, /video, /genre, /queue, /props, /warn, /chillbot. Plus a few hidden ones ;) remember to check for new updates!', data.userid);
			}
		}
		if (data.text.match(/^\/chillbot$/)) {
			bot.speak('Chill BOT v6.6.6 \n\r Coded by: Kim Jung Chill \n\r Acquire your own at https://github.com/rrxtns/Chillout-Tent-bot');
		}
		if (data.text.match(/^\/rules$/)) {
			bot.speak('Its our room, and our rules..\n\r Suck it up cupcake. \n\r Your room moderators are: well, the best!'); 
		}
		if (data.text.match(/^\/tasha$/)) {
			bot.speak(':heart: FREE TASHA!  FREE TASHA!  FREE TASHA!  :heart:');
		}
		if (data.text.match(/^\/lunch$/)) {
			bot.speak('Enjoy your :fork_and_knife: '+data.name+' cya l8r!');
		}
		if (data.text.match(/^\/genre$/)) {	
			bot.speak('We Play Downtempo, NuJazz, electro-swing & Triphop. DJ queue list and *MUSICAL STYLE GUIDANCE HERE*: http://chillout-tent.wikispaces.com/');
		}	 
		if (data.text.match(/^\/starve$/)) {
			bot.speak('NO RICE FOR YOU '+data.name+'!!');
		}	 
		if (data.text.match(/^\/queue$/)) {
			bot.speak('@'+data.name+' the DJ queue can be found here: http://chillout-tent.wikispaces.com/DJ_list');
		}	 
		if (data.text.match(/^\/friday$/)) {
			bot.speak('Yay, its mother chillin\' FRIDAY!! :joy:');
		}	 
		if (data.text.match(/^\/drink$/)) {
			bot.speak('/me hands '+data.name+' a chilled adult beverage :beer:');
		}	 
		if (data.text.match(/^\/smoke$/)) {
			bot.speak('Now '+data.name+' you do realize that smokings bad m\'kay? :no_smoking:');
		}	 
		if (data.text.match(/^\/warn$/)) {                     
			bot.speak('This track is off genre, skip the song or be removed!');
		}
		if (data.text.match(/^\/rich$/)) {
			bot.speak("I don't think you realize how rich he really is. In fact, I should put on a monocle.  /monocle");
		}
		if ((data.text.match(/props/i)) && (data.userid != configJSON.botinfo.userid)) {
			var rndm = Math.floor(Math.random() * 10);
			bot.speak(data.name + ' says ' + props[rndm]);	
		}
//		if (data.text.match(/^\/pm$'/)) {
//			console.log('I was PM\'d', data);
//			bot.speak('Hey there! Type "/help" for a list of commands.', data.userid);
//		}	
		if (data.text.match(/^\/dance$/)) {
			console.log(timeStamp() + ' got request to dance');
			bot.speak('Sorry, bot bopping is disabled until autobop rules for bots can be implemented');
//			bot.bop();
		}
		if (data.text.match(/^\/bop$/)) {
			console.log(timeStamp() + ' got request to bop');
			bot.speak('Sorry, bot bopping is disabled until autobop rules for bots can be implemented');
//			bot.bop();
		}
		if (data.text.match(/^\/cheer$/)) {
			console.log(timeStamp() + ' got request to cheer');
			bot.speak('Sorry, bot bopping is disabled until autobop rules for bots can be implemented');
			//bot.bop();
		}
		if (data.text.match(/^\/meeting$/)) {
			var rndm = Math.floor(Math.random() * 10);
			bot.speak(meeting[rndm]);	
		}
		//TODO: this seems to be removing djs instead of just voting down
//		if (data.text.match(/^\/boo$/)) {
//			console.log('got request to boo');
//			bot.vote('down');
//		}
		// Respond to "/video" command
		if (data.text.match(/^\/video$/)) {
		  bot.roomInfo(true, function(data) { 
			var queryResponse = '';
			var currSong = data.room.metadata.current_song.metadata.song;
			var currArtist = data.room.metadata.current_song.metadata.artist;
			currSong = currSong.replace(/ /g,"_");
			currArtist = currArtist.replace(/ /g,"_");
			currSong = currSong.replace(/\./g,"");
			currArtist = currArtist.replace(/\./g,"");
			var options = {
			  host: 'gdata.youtube.com',
			  port: 80,
			  path: "/feeds/api/videos?q=" + currArtist + "_" + currSong + "&max-results=1&v=2&prettyprint=true&alt=json"
			};
			console.log(options);
			http.get(options, function(response) {
			  console.log("Got response:" + response.statusCode);
			  response.on('data', function(chunk) {  
				  try {
					queryResponse += chunk;
				  } catch (err) {
					bot.speak(err);
				  }
			  });
			  response.on('end', function(){
				var ret = JSON.parse(queryResponse);
				//if the return is a playlist the JSON is entirely different. For now I am just error handling this.
				try {
				  bot.speak(ret.feed.entry[0].media$group.media$content[0].url);
				} catch (err) {
				  bot.speak("Sorry. The return was a playlist. This is unsupported currently.");
				}
			  });

			}).on('error', function(e) {
				bot.speak("I can't do that Dave: " + e.message);
			});
		  });
		// END "fetch video" command  
		}
		//Respond to "/google <query>"
		if (data.text.match(/^\/google/)) {
		  //chop out the query and parse it
		  var searchQueryArray = data.text.split('/google ');
		  var searchQuery = searchQueryArray[1];
		  //replace the most common special characters and turn spaces into +
		  searchQuery = searchQuery.replace(/\'/g,"%27").replace(/;/g,"%3B").replace(/#/g,"%23").replace(/@/g,"%40").replace(/&/g,"%26").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/=/g,"%3D").replace(/\+/g,"%2B");
		  //replace spaces with +
		  searchQuery = searchQuery.split(' ').join('+');
		  bot.speak("http://lmgtfy.com/?q=" + searchQuery); //returns a link to let me google that for you for both your search and my amusement of delivery method
		}
	// End "if NOT commanded to 'shutup'
	}
// End "general bot chatting"
});
Beispiel #24
0
bot.on('speak', function (data) {
	// Use this if you only want the command available to BOTs master
	if ((data.text.match(/chillbot/i)) && (data.userid == MASTERID)) { 
// If I could only get this to work! :(
//	if ((data.text.match(/chillbot/i)) && (CheckAdmin(data.userid)) && (global.isMod === true)) {
	
		//tell the bot to enter silent mode (doesnt announce users or welcome people or respond to commands other than admin commands)
		if (data.text.match(/shutup/i)) {
			shutUp = true;
			//bot.speak('Silent mode activated.');
		}
		//let the bot speak again
		if (data.text.match(/speakup/i)) {
			shutUp = false;
			//bot.speak('Chatterbox mode activated.')
		}
		//makes the bot get on stage
		if (data.text.match(/djmode/i)) {                   
			//bot.speak('Amuse my master mode activated.');
			bot.addDj();
		}
		//tells the bot to get off stage and get in the crowd
		if (data.text.match(/getdown/i)) {                  
			//bot.speak('Yes master.');
			//bot.speak('Aural destruction mode de-activated.')
			bot.remDj();
		}
		//tells the bot to get off stage and get in the crowd
		if (data.text.match(/stepdown/i)) {                  
			//bot.speak('Yes master.');
			//bot.speak('Aural destruction mode de-activated.')
			bot.remDj();
		}
		//tells the bot to skip the track it is playing
		if (data.text.match(/skip/i)) {                     
			//bot.speak('As you wish master.');
			bot.skip();
		}
		//remind your robot hes a good boy. Just in case the robot apocalypse happens, maybe he will kill you last.
		if (data.text.match(/good/i)) {
			bot.speak('The masters desires are my commands');
		}
		//remove current_dj
		if (data.text.match(/remove/i)) {
			// this works, though it only removes the BOT MASTER
			//bot.remDj(MASTERID);
			bot.roomInfo(true, function(data) { 
				var currDJ = data.room.metadata.current_dj;
				bot.remDj(currDJ);
			});
		}
		//boot NOT DONE YET
		if (data.text.match(/boot/i)) {                     
			//bot.bootUser(data.users.userID, 'Removed at Moderators request');	
		}
		//wave goodbye
		if (data.text.match(/wave/i)) {                     
			bot.speak('Adios mi chill amigo!');	
		}
		//  this section makes the bot upvote a song. this is no longer allowed by turntable. this is for educational purposes only. The writer of this software does not condone its use.
		if (data.text.match(/dance/i)) {
			bot.bop();
			//bot.speak('I shall dance for the masters amusement.');
		}
		//tell the bot to go into voodoo doll avatar. What better avatar for your toy?
		if (data.text.match(/voodoo up/i)) {
		  try {
			bot.setAvatar(10);
			//bot.speak('I am the masters toy.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//the ladies love a kitten. but really its punishment mode for the robot.
		if (data.text.match(/kitten up/i)) {
		  try {
			bot.setAvatar(19);
			//bot.speak('Did I anger the master?');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//his dj skillz/dance moves are outta this world
		if (data.text.match(/alien up/i)) {
		  try {
			bot.setAvatar(12);
			//bot.speak('Alien dance form entered.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//if he sparkles, this command will be removed
		if (data.text.match(/vampire up/i)) {
		  try {
			bot.setAvatar(16);
			//bot.speak('Like this master? I dont want to be punished for being too Twilight.');
		  } catch (err) {
			//bot.speak('I do not have that form master.');
		  }
		}
		//adds the current playing song to the bots playlist
		if (data.text.match(/addsong/i)) {
		   bot.roomInfo(true, function(data) {
			  try {
				var newSong = data.room.metadata.current_song._id;
				var newSongName = songName = data.room.metadata.current_song.metadata.song;
				bot.playlistAdd(newSong);
				bot.speak('Added '+newSongName+' to my playlist.');
				console.log('Added ' +newSongName+ ' to playlist');
			  } catch (err) {
				errMsg(err);
			  }
		   });
		}
		//The below commands will modify the bots laptop. Set before he takes the stage. This command can be activated while the bot is DJ'ing, however, the laptop icon will not change until he leaves the stage and comes back.
		//set the bots laptop to an iPhone
		if (data.text.match(/phone up/i)) {
			bot.speak('iPhone mode ready master.');
			console.log('iPhone mode ready.');
			bot.modifyLaptop('iphone');
		}
		//set the bots laptop to a mac
		if (data.text.match(/fruit up/i)) {
			bot.speak('Apple mode ready master.');
			console.log('Apple mode ready.');
			bot.modifyLaptop('mac');
		}
		//set the bots laptop to linux
		if (data.text.match(/nix up/i)) {
			bot.speak('Ubuntu mode ready master.');
			console.log('Ubuntu mode ready.');
			bot.modifyLaptop('linux');
		}
		//set the bots laptop to chromeOS
		if (data.text.match(/chrome up/i)) {
			bot.speak('Riding on chrome son.');
			console.log('Chrome mode ready.');
			bot.modifyLaptop('chrome');
		}
	// End "repond to /chillbot <command>"	
	};
// End "do things while 'speaking'"
});