alaingilbert / Turntable-API

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

Easy way to identify a guest? #168

Closed MikeWills closed 11 years ago

MikeWills commented 11 years ago

With the new guest support, is there an easy way to identify them so we can greet them and try to get them to sign up. I'll research as well... thought I see if others have figured this out yet.

MikeWills commented 11 years ago
{"command":"registered","roomid":"4f73ef36eb35c10888004976","user":
[{"name":"g16957872","created":1364438486.56,"laptop":"mac","userid":"5153add6eb35c15d55c8987b","acl":0,
"fans":0,"points":0,"images": {"fullfront":"/roommanager_assets/avatars/34/fullfront.png",
"headfront":"/roommanager_assets/avatars/34/headfront.png"},
"_id":"5153add6eb35c15d55c8987b","avatarid":34}],"success":true}
MikeWills commented 11 years ago

What do you think. If the name starts with g and the person has no DJ points and no fans then they are a guest? That doesn't seem 100% fool proof... but good enough? Thoughts?

Izzmo commented 11 years ago

Is that the right response? I thought there was a guest flag in there.

MikeWills commented 11 years ago

That is what my bot got. Actually. Let me make sure I am running the latest API.

Mike Wills http://mikewills.me

Sent from my mobile. On Mar 27, 2013 10:49 PM, "Nick George" notifications@github.com wrote:

Is that the right response? I thought there was a guest flag in there.

— Reply to this email directly or view it on GitHubhttps://github.com/alaingilbert/Turntable-API/issues/168#issuecomment-15566861 .

sharedferret commented 11 years ago
user: 
 [ { name: 'g41789377',
     created: 1364442928.28,
     laptop: 'mac',
     userid: '5153bf30eb35c15d59c3c5f6',
     acl: 0,
     fans: 0,
     points: 0,
     images: [Object],
     _id: '5153bf30eb35c15d59c3c5f6',
     avatarid: 34 } ],
success: true }

user: 
 [ { name: 'twilight',
     laptop_version: null,
     registered: 1364062622.25,
     created: 1364052356.54,
     userid: '514dc984eb35c137e6fe9ce1',
     acl: 0,
     fans: 0,
     points: 0,
     images: [Object],
     _id: '514dc984eb35c137e6fe9ce1',
     avatarid: 2,
     laptop: 'mac' } ],
success: true }

Users have a "registered" timestamp, whereas guests do not. You can tell if a user is a Guest or not based on whether the "registered" field exists (this is also how TT decides whether to show "Guest" or a full profile in the UI).

MikeWills commented 11 years ago

Ah... I missed that. Thanks!

technobly commented 11 years ago

User.name.match(/^g[0-9]{8}$/) has been working great for me.

Izzmo commented 11 years ago

@sharedferret Have you done a test on accounts created before guests were enacted? Without looking myself, I'm curious as to if both timestamps will be the same.

MikeWills commented 11 years ago

@DubbyTT The only problem with that is if you get those jokers that change their name to g######## and they kick off your logic. And I know that TT had a way to identify the difference. That is why I asked.

technobly commented 11 years ago

@MikeWills I only use it for my auto queue, so it works perfect.. jokers can sit down if they wanna :)

That said tonight I saw some 7 digit guests... so if this keeps up I'll probably look for:

if(typeof user.registered !== "undefined") // add to auto queue

good stuff to know ;-)

gizmotronic commented 11 years ago

Beware: there are regular users who don't have a registered field. I'm testing both the registered and points properties (because guests won't have any points).

MikeWills commented 11 years ago

Why would that be? Do you know if there is a difference in how they are setup?

Izzmo commented 11 years ago

@gizmotronic can you give an example, or examples, of ones which do not have the field?

MikeWills commented 11 years ago

I'll reopen so we can get this identified.

gizmotronic commented 11 years ago

Mea culpa! This turned out to be corrupt event logs (due to a bug in my bot, fixed a couple weeks ago) that I mistakenly connected to a user report of being identified as a guest by an extension that also uses TTAPI. I'm still not quite sure what issue I ran over yesterday, but a query that filters out the bad data clearly shows that the registered and roomChanged events provided a 'registered' property for each of the 3 people that my code had misidentified as guests.

Please accept my apologies for the false alarm, and go ahead and re-close this.