Events - Gielert/NoodleJS GitHub Wiki

Events

The client emits an event whenever something happens on the server.

First of all, when the client received a sync from the server, the client will emit a ready event. This event contains the welcome message and the maximum bitrate.

Example

client.on('ready', info => {
    console.log(info.welcomeMessage)
    console.log(info.maximumBitrate)
});

Users

When a user joins the server the client will emit a userJoin event. This event contains the user that joined the server.

Example

client.on('userJoin', user => {
    console.log(user.name)
});

Whenever a user changes (switches channel, mutes, etc...). The client emits a userChange event and will have two params. First the oldUser object and second the newUser object.

Example

client.on('userChange', (oldUser, newUser) => {
    console.log(oldUser.channel)
    console.log(newUser.channel)
});

If a user decides to leave the server :'( the client will emit a userDisconnect event. This will contain the user that left >:C the server.

Example

client.on('userDisconnect', user => {
    user.ban() // This is not an actual function!!!
})