Constructor
new Client(email, password, optionsopt)
Create a new Client
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
email |
String | The Email to use for login | |||||||||||||||||||||||||||||||||||||||||
password |
String | the password to use | |||||||||||||||||||||||||||||||||||||||||
options |
Object |
<optional> |
An object containing additional settings
Properties
|
Properties:
Name | Type | Description |
---|---|---|
ready |
Boolean | Indicates if the client is ready for rest calls. |
room |
Room | The current room |
socketStatus |
String | The current status of the socket connection |
self |
ExtendedUser | The logged-in user |
Methods
banUser(userID, timeopt, reasonopt) → {Promise}
Bans an user from the room.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
userID |
Number | The id of the user | ||
time |
String |
<optional> |
'd' | The ban duration, defaults to one day ('h' for one hour, 'd' for a day, 'f' for forever) |
reason |
Number |
<optional> |
1 | The ban reason, defaults to 'violating community rules' |
Returns:
- Type
- Promise
connect() → {Promise}
Establishes the Websocket Conncetion to plug.dj
Returns:
- Type
- Promise
deleteMessage(chatID) → {Promise}
Deletes a chat message
Parameters:
Name | Type | Description |
---|---|---|
chatID |
String | Id of the message to be deleted |
Returns:
- Type
- Promise
joinRoom(slug) → {Promise}
Joins a room (community)
Parameters:
Name | Type | Description |
---|---|---|
slug |
String | the slug to join |
Returns:
- Type
- Promise
removeRole(userID) → {Promise}
Shorthand for {Client}.setRole(userID, 0)
Parameters:
Name | Type | Description |
---|---|---|
userID |
Number |
Returns:
- Type
- Promise
sendChat(content) → {Promise}
Sends a message in chat
Parameters:
Name | Type | Description |
---|---|---|
content |
String | The message content |
Returns:
- Type
- Promise
setRole(userID, role) → {Promise}
Sets an user as staff
Parameters:
Name | Type | Description |
---|---|---|
userID |
Number | |
role |
Number | the role, 0 for grey, 1 for res dj, 2 for bouncer, 3 for manager, 4 for co-host, 5 for host |
Returns:
- Type
- Promise
skipSong(userIDopt, historyIDopt) → {Promise}
Skips the current playback. All fields are automatically filled in, however it is recommended to provide at least the userID to prevent wrong skips
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userID |
Number |
<optional> |
The id of the current dj |
historyID |
String |
<optional> |
The id of the current playback |
Returns:
- Type
- Promise
unbanUser(userID) → {Promise}
Removes a ban for a user
Parameters:
Name | Type | Description |
---|---|---|
userID |
Number | The id of the user |
Returns:
- Type
- Promise
Events
addDj
Emitted when a moderator adds someone to the queue. This also fires a queueUpdate-event
Properties:
Name | Type | Description |
---|---|---|
user |
User | The user who got added |
moderator |
User | The Moderator |
- Source:
advance
Emitted when a new song is played
Properties:
Name | Type | Description |
---|---|---|
playback |
Playback | The current playback |
oldPlayback |
Playback | The playback before. |
- Source:
ban
Emitted when you are banned from a community
Properties:
Name | Type | Description |
---|---|---|
ban |
Ban | The ban object |
- Source:
chat
Emitted when a chat message is received
Properties:
Name | Type | Description |
---|---|---|
message |
Message | The received message |
- Source:
chatDelete
Emitted when a moderator deletes a chat message
Properties:
Name | Type | Description |
---|---|---|
message |
Message | The deleted message (can be null if message is not cached) |
The |
User | user who deleted the message |
- Source:
connect
Emitted when the socket connection is up.
Properties:
Name | Type | Description |
---|---|---|
room |
String | The room the client is currently in |
- Source:
cycleChange
Emitted when the cycle-mode gets changed
Properties:
Name | Type | Description |
---|---|---|
user |
User | The user who changed the cycle mode |
state |
Boolean | The new cycle-mode |
- Source:
earn
Emitted when the bot earns experience/plug points or levels up
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
earn |
Object |
Properties
|
- Source:
error
Emitted when the client encounters an error which it cannot handle itself
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
error |
String | Error | The error or an error message. | |
err |
Error |
<optional> |
An error object |
- Source:
floodApi
Emitted when too many api requests are fired. You don't need to handle it if you leave `options.requestFreeze` at the default value, however all actions will be stopped for 10 seconds
- Source:
floodChat
Emitted when you are sending too many chat messages and plugging-you-in isn't good enough at limiting you. Plugging-you-in will handle this by stopping to send messages entirely for a few seconds
- Source:
friendJoin
Emitted when an users joins the room
Properties:
Name | Type | Description |
---|---|---|
user |
User | The joined user |
- Source:
gifted
Emitted when someone gifts plug points to someone
Properties:
Name | Type | Description |
---|---|---|
sender |
User | The user who sent the gift |
receiver |
User | The user who received the gift |
- Source:
grab
Emitted when an user grabs a song
Properties:
Name | Type | Description |
---|---|---|
user |
User | The user who grabbed the song |
- Source:
guestJoin
Emitted when a guest joins the room
- Source:
guestLeave
Emitted when a guest leaves the room
- Source:
joinedRoom
Emitted when a room was joined and the caches were filled.
killSession
Emitted when the socket server kills the session
- Source:
levelUp
Emitted when the logged in account levels up
Properties:
Name | Type | Description |
---|---|---|
newLevel |
Number |
- Source:
lockChange
Emitted when the queue gets locked/unlocked/cleared
Properties:
Name | Type | Description |
---|---|---|
user |
User | The user who took the action |
lock |
Boolean | The new lock-state of the queue |
clear |
Boolean | Wheter the queue got cleared or not |
- Source:
maintenance
Emitted when plug.dj goes into maintenance mode
- Source:
maintenanceAlert
Emitted when plug.dj is about to go into maintenance mode
Properties:
Name | Type | Description |
---|---|---|
time |
Number | time til maintenance mode in minutes |
- Source:
moveUser
Emitted when a moderator moves someone in the queue. This also fires a queueUpdate-event
Properties:
Name | Type | Description |
---|---|---|
user |
User | The moved user |
moderator |
User | |
newPosition |
Number | |
oldPosition |
Number |
- Source:
plugMessage
Emitted when plug.dj sends a broadcast
Properties:
Name | Type | Description |
---|---|---|
message |
String |
- Source:
plugUpdate
Emitted when plig.dj gets updated.
- Source:
queueUpdate
Emitted when the waitlist changes
Properties:
Name | Type | Description |
---|---|---|
queue |
Array.<User> | The new queue as an array of users |
oldQueue |
Array.<User> | The old queue |
- Source:
rawWS
Emits the raw packages.
Properties:
Name | Type | Description |
---|---|---|
data |
Object | The data received from plug.dj |
- Source:
ready
Emitted when the client is ready to make rest calls
selfSkip
Emitted when someone skips himself
Properties:
Name | Type | Description |
---|---|---|
user |
User |
- Source:
skip
Emitted when a moderator skips a song
Properties:
Name | Type | Description |
---|---|---|
moderator |
User |
- Source:
slowMode
Emitted when chat enters slow mode.
- Source:
socketClose
Emitted when the socket is closed
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
data.code |
Number |
<optional> |
The close code. |
data.reason |
String |
<optional> |
A human-readable close reason. |
- Source:
socketError
Emitted when the socket errors
- Source:
unknown
Emitted when an unknown package is received from plug. This can indicate an outdated version of plugging-you-in
- Source:
userBan
Emitted when a moderator bans someone from the room
Properties:
Name | Type | Description |
---|---|---|
ban |
Ban | The ban |
moderator |
User |
- Source:
userJoin
Emitted when an users joins the room
Properties:
Name | Type | Description |
---|---|---|
user |
User | The joined user |
- Source:
userLeave
Emitted when an user leaves the room.
Properties:
Name | Type | Description |
---|---|---|
user |
User | The left user |
- Source:
vote
Emitted when someone votes on a song
Properties:
Name | Type | Description |
---|---|---|
user |
User | The user who voted |
vote |
Number | The vote, 1 for woot, -1 for meh |
- Source: