Skip to content
daltongore edited this page Nov 11, 2011 · 10 revisions

These are some functions to get you started with a DJ bot. (A bot that you allow to DJ).

if (text.match(/^\*youcandj$/)) { if (data.userid != "youruserid"){ bot.speak('You ain\'t my master.'); }else{ bot.addDj(); } }

*This is the function that adds the DJ to the table using the command youcandj *Inversely, to remove your bot as a DJ, use the nomoredj command:

if (text.match(/^\*nomoredj$/)) { if (data.userid != "youruserid"){ bot.speak('You ain\'t my master.'); }else{ bot.remDj('4e66fdd0a3f751035b012b3f'); } }

*But that's not enough. How are you going to add songs? How about with addsong

if (text.match(/^\*addsong$/)) { 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(false, newSong); bot.speak('Added '+newSongName+' to queue.'); }); }

Special note for this: rather than like adding it to a queue, this song will go to the top, not the bottom. Also, as of now, I know of no way to adjust the queue.

*And you can use skip to skip the song

if (text.match(/^\*skip$/)) { if (data.userid != "youruserid"){ bot.speak('You ain\'t my master.'); }else{ bot.stopSong(); } }

You may notice the 'youruserid' part floating in there. That is to ensure that only you can control the bot's DJ function.

These scripts are from my bot, #Ringwold.

Clone this wiki locally