-
Notifications
You must be signed in to change notification settings - Fork 10
Methods
- connect
- disconnect
- reconnect
- sendChat
- getChatHistory
- getRoomMeta
- getQueue
- getQueuePosition
- queueMedia
- queuePlaylist
- clearQueue
- pauseQueue
- moderateSkip
- moderateDeleteChat
- moderateBanUser
- moderateUnbanUser
- moderateKickUser
- moderateMuteUser
- moderateUnmuteUser
- moderateMoveDJ
- moderateRemoveDJ
- moderateRemoveSong
- moderatePauseDJ
- moderateSetRole
- moderateUnsetRole
- moderateLockQueue
- updub
- downdub
- getMedia
- getScore
- getPlayID
- getTimeRemaining
- getTimeElapsed
- getUser
- getUserByName
- getSelf
- getCreator
- getDJ
- getUsers
- getStaff
- isCreator
- isOwner
- isManager
- isMod
- isVIP
- isResidentDJ
- isStaff
- hasPermission
Connect to a room using its slug. (the part after https://dubtrack.fm/join/)
bot.connect(slug);
slug string
The room slug to connect to
Disconnect from the currently connected room.
bot.disconnect();
Reconnect to the currently connected room.
bot.reconnect();
Send a message in the chat.
Note: Message will be split into multiple messages if over 255 chars.
bot.sendChat(message, callback);
message string
The message to send
callback requestCallback
An optional callback to execute after the request (requests if the message is splitted) completes
Get the last 512 chat message events.
bot.getChatHistory();
[
{
message: 'test',
time: 1445428545192,
type: 'chat-message',
user: {userObject},
id: '5609c755970e920300a44e88-1445428545192'
},
{...}
]
Get the room metadata.
bot.getRoomMeta();
{roomObject}
Get the room queue.
bot.getQueue();
[
{
id: '5609c279425d2903003faec4',
uid: '56003aba621a9e03003165b8',
media: {mediaObject},
user: {userObject}
}
]
Get the position of a user in the queue.
bot.getQueuePosition(id);
id string
The id of the user to get the position of
number
Add media to the bot's queue.
bot.queueMedia(type, fkid, callback);
type string
The media type (currently 'soundcloud' or 'youtube')
fkid string
The media id
callback requestCallback
An optional callback to execute after the request completes
Add a playlist to the bot's queue.
bot.queuePlaylist(playlistid, callback);
playlistid string
The id of the playlist to queue
callback requestCallback
An optional callback to execute after the request completes
Clear the bot's queue.
bot.clearQueue(callback);
callback requestCallback
An optional callback to execute after the request completes
Pause or unpause the bot's queue.
bot.pauseQueue(pause, callback);
pause boolean
The value to set
callback requestCallback
An optional callback to execute after the request completes
Skip the currently playing song.
bot.moderateSkip(callback);
callback requestCallback
An optional callback to execute after the request completes
Delete a chat message.
bot.moderateDeleteChat(id, callback);
id string
The id of the message to delete
callback requestCallback
An optional callback to execute after the request completes
Ban a user from the room.
bot.moderateBanUser(id, time, callback);
id string
The id of the user to ban
time number
An optional duration in minutes (defaults to 0 for forever)
callback requestCallback
An optional callback to execute after the request completes
Unban a user from the room.
bot.moderateUnbanUser(id, callback);
id string
The id of the user to unban
callback requestCallback
An optional callback to execute after the request completes
Kick a user from the room.
bot.moderateKickUser(id, msg, callback);
id string
The id of the user to kick
msg string
An optional kick message
callback requestCallback
An optional callback to execute after the request completes
Mute a user.
bot.moderateMuteUser(id, callback);
id string
The id of the user to mute
callback requestCallback
An optional callback to execute after the request completes
Unmute a user.
bot.moderateUnmuteUser(id, callback);
id string
The id of the user to unmute
callback requestCallback
An optional callback to execute after the request completes
Move a DJ in the queue
bot.moderateMoveDJ(id, position, callback);
id string
The id of the user to move
position int
Position in the queue for the user to be moved to
callback requestCallback
An optional callback to execute after the request completes
Remove DJ from the queue.
bot.moderateRemoveDJ(id, callback);
id string
The id of the user to remove
callback requestCallback
An optional callback to execute after the request completes
Remove a song from the queue.
bot.moderateRemoveSong(id, callback);
id string
The id of the user that queued the song
callback requestCallback
An optional callback to execute after the request completes
Pause a DJ's queue.
bot.moderatePauseDJ(id, callback);
id string
The id of the user to pause
callback requestCallback
An optional callback to execute after the request completes
Set user role.
bot.moderateSetRole(id, role, callback);
id string
The id of the user
role string
The id or type of the role
callback requestCallback
An optional callback to execute after the request completes
Unset user role.
bot.moderateUnsetRole(id, role, callback);
id string
The id of the user
role string
The id or type of the role
callback requestCallback
An optional callback to execute after the request completes
Lock or unlock the queue.
bot.moderateLockQueue(locked, callback);
locked boolean
Queue lock state
callback requestCallback
An optional callback to execute after the request completes
Updub the currently playing song.
bot.updub(callback);
callback requestCallback
An optional callback to execute after the request completes
Downdub the currently playing song.
bot.downdub(callback);
callback requestCallback
An optional callback to execute after the request completes
Get the currently playing mediaObject.
bot.getMedia();
{mediaObject}
or undefined
Get the current room score.
bot.getScore();
{updubs: 5, grabs: 1, downdubs: 0}
or undefined
Get the current play ID.
Useful for checking against id
in roomPlaylistUpdate
to verify the same media is playing in an async database callback.
bot.getPlayID();
string
or undefined
Get the time remaining of the current media in milliseconds.
bot.getTimeRemaining();
number
or undefined
Get the time elapsed of the current media in milliseconds.
bot.getTimeElapsed();
number
or undefined
Get a user by their ID.
bot.getUser(id);
id string
The id of the user to get
{userObject}
or undefined
Get a user by their username.
bot.getUserByName(username, ignoreCase);
username string
The username of the user to get
ignoreCase boolean
Ignore case when comparing usernames
{userObject}
or undefined
Get the bot.
bot.getSelf();
{userObject}
Get the creator of the room.
bot.getCreator();
{userObject}
or undefined
Get the current DJ.
bot.getDJ();
{userObject}
or undefined
Get users in the room.
bot.getUsers();
[
{userObject},
{...}
]
Get staff in the room.
bot.getStaff();
[
{userObject},
{...}
]
Check if the user is the room creator.
bot.isCreator({userObject});
object userObject
The user to check
boolean
Check if the user is a room owner.
bot.isOwner({userObject});
object userObject
The user to check
boolean
Check if the user is a room manager.
bot.isManager({userObject});
object userObject
The user to check
boolean
Check if the user is a room mod.
bot.isMod({userObject});
object userObject
The user to check
boolean
Check if the user is a room VIP.
bot.isVIP({userObject});
object userObject
The user to check
boolean
Check if the user is a room resident DJ.
bot.isResidentDJ({userObject});
object userObject
The user to check
boolean
Check if the user is member of the room staff.
bot.isStaff({userObject});
object userObject
The user to check
boolean
Check if the user has a given permission.
bot.hasPermission({userObject}, permission);
object userObject
The user to check
permission string
The the permission to check for
boolean