-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
29 lines (24 loc) · 958 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var Bot = require('ttapi')
, config = require('./config')
, bot = new Bot(config.bot.auth, config.bot.id, config.bot.room)
bot.on('newsong', function(data){
var song = data.room.metadata.current_song
//console.log('New song "' + song.metadata.song + '" by "' + song.metadata.artist + '" from the album "' + song.metadata.album + '"')
//add song to bot playlist
bot.playlistCreate(data.room.name, function() {
bot.playlistSwitch(data.room.name, function() {
bot.playlistAdd(data.room.name, song._id, function() {
//console.log('Added: ' + song.metadata.song + ' to playlist: ' + data.room.name);
});
bot.snag()
})
})
/*
bot.vote('up', function(){
if (!data.success) console.log("Error voting up\n", data)
console.log('Voted up')
// trigger snag animation (doesn't add to queue)
bot.snag()
})
*/
})