Closed TheHolyWaffle closed 11 years ago
I don't think that is possible. Those are server messages. The API basically is interacting with the web version of TT (as I understand it).
But it's still being sent to the client, right?
Oh... you want to get that information... not send it. Sorry, my bad.
When an admin escort someone off the stage, this is what you get :
{
"success": true,
"command": "rem_dj",
"roomid": "4e6851fa14169c2255108b8c",
"user": [{
"name": "alain_scrib",
"created": 1315461804.92,
"laptop": "mac",
"userid": "4e685aac14169c225510e99d",
"acl": 0,
"fans": 5,
"points": 22,
"_id": "4e685aac14169c225510e99d",
"avatarid": 2
}],
"modid": "4deadb0f4fe7d013dc0555f1"
}
So you can implement that feature like this :
bot.on('rem_dj', function(data) {
if (data.modid) {
escortedName = data.user[0].name;
adminId = data.modid;
// Do what you want with these informations !
}
});
We could also create a new function in the api that would be used like this :
bot.on('escort', function(data) { });
data:
{
"command": "escort",
"user": {
"name": "alain_scrib",
"userid": "4e685aac14169c225510e99d"
},
"moderator": {
"name": "agilbert",
"userid": "4deadb0f4fe7d013dc0555f1"
},
"success": true
}
Let me know what you think about this ?
Yes, your latest post would be the exact thing I was looking for. I think this will simplify things by a lot and help out other people like me who didn't know that you could also do it with the rem_dj event.
I'm voting for this addition :+1:
https://github.com/alaingilbert/Turntable-API/commit/989f76bc178f535ac332de37c5b55b8d3e559f3a
I did the escort event to be an alias of
bot.on('rem_dj', function(data) {
if (data.modid) {...}
});
So you receive the same data in rem_dj
and escort
events.
The only difference is the command
that change.
Alright, thank you :)
Would it be possible to add this one in ? The speak event doesn't seem to contain the line that says 'person x has been escorted...'.
EDIT: The event should trigger whenever a dj is removed by an admin.