alaingilbert / Turntable-API

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

afk option #103

Closed samuri51 closed 12 years ago

samuri51 commented 12 years ago

how would i go about assigning time to peoples names?

like someone gets on stage and the time starts and if its been longer than 20 mins they get kick off.

Izzmo commented 12 years ago

In your array of dj's, just assign a 20 minute timer to each of them. Presumably you want to restart the timer everytime they perform specific actions (chatting, voting (probably not), and snagging), then you would clear the previous timer and create a new one in place.

samuri51 commented 12 years ago

whats the command for a timer?

samuri51 commented 12 years ago

also how do i get userid out of https://github.com/alaingilbert/Turntable-API/blob/master/turntable_data/rem_dj.js

i type data.user and it finds the whole list.... i type data.user.userid suddenly its undefined??

MikeWills commented 12 years ago

Take a look at several of the bots on GitHub. Sparkle is one them that many use. Most of the questions you are asking can be found in there. I also have a bot I am working on called Uglee. There is a good list in the wiki where you can get more ideas.

samuri51 commented 12 years ago

any idea what the path to userid is in rem_dj lol thats all i really need atm, but yeah ill deff be checking that out

Izzmo commented 12 years ago

@samuri51 the data returned is in an array, which from what I've seen never returns more than one user, so you will need to access it by doing something like data.user[0] and from there you can access all of the properties.

MikeWills commented 12 years ago

According to the documentation

{ command: 'rem_dj',
  user: 
   [ { name: '@anonymous',
       created: 1307237135.77,
       laptop: 'mac',
       userid: 'xxxxxxxxxxxxxxxxxxxxxxxx',
       acl: 0,
       fans: 118,
       points: 4099,
       avatarid: 23 } ],
  success: true }

Which translates to data.user[0].userid. user is the array, and you want the first element (0).

samuri51 commented 12 years ago

thanks guys that was stumpin me to no end, i already had the whole infrastructure setup for what i wanted to do i just needed that userid lol