alaingilbert / Turntable-API

Allows you to create bots for turntable.fm
http://alaingilbert.github.com/Turntable-API/
MIT License
318 stars 97 forks source link

New Song Event #249

Closed ghost closed 10 years ago

ghost commented 10 years ago

How do i make my bot say the artist, album name, and song in the chat box when the new song event starts?

gizmotronic commented 10 years ago

This is very nearly the same question (and resolution) as #172.

ghost commented 10 years ago

not really, the song stats is for the total count of up and down votes, this is for the bot to say album, artist, and song name for the current song on the newsong event.

gizmotronic commented 10 years ago

You should have looked at the solution to that ticket before you responded. Good news! It's still there waiting for you. :)

ghost commented 10 years ago

I looked at it, and what should i change in this code block:

bot.on('endsong', function (data) { 
  var currentdj = data.room.metadata.current_dj;
  var song = data.room.metadata.current_song.metadata.song;
  var artist = data.room.metadata.current_song.metadata.artist;
  var album = data.room.metadata.current_song.metadata.album;
  var up_votes = data.room.metadata.upvotes;
  var down_votes = data.room.metadata.downvotes;
  var listeners = data.room.metadata.listeners;

  bot.speak(song +" ( "+up_votes+" :+1: "+down_votes+" :-1: "+snagCounter+" <3 "+listeners+" :busts_in_silhouette: )");

});

so it can fit my needs for my bot to say album name, song name, and artist name.

gizmotronic commented 10 years ago

Ask yourself these questions.

  1. What event is being handled by this code? What event do you need to handle?
  2. How is the bot putting something into public chat?
  3. What information is the bot putting into public chat? Where is it getting the information from? What other information has been collected?
  4. Considering everything you learned by answering the previous questions, how can you change it to do what you want?

I'm not asking you to answer these questions here. The answers are purely for your own instruction. They will ultimately take you to the answer you are looking for.

ghost commented 10 years ago

ok, thanks.