- client.getChannels() - Get the current channels.
- client.getOptions() - Get the current options.
- client.getUsername() - Get the current username.
- client.isMod() - Is a mod on a channel.
- client.readyState() - Get the current state of the socket.
Get the current channels. (Array)
console.log(client.getChannels());
Get the current options. (Object)
console.log(client.getOptions());
Get the current username. (String)
console.log(client.getUsername());
NOT RECOMMENDED
Function to check if user is a mod on a channel. (Boolean)
Important: Might not be accurate.
Parameters:
channel
: String - Channel nameusername
: String - Username
if (client.isMod('#schmoopiie', 'bob')) {
// Do something..
}
RECOMMENDED
Everytime you receive a message on Twitch, you receive an object that contains all the information you need from the user.
client.on('chat', function(channel, user, message, self) {
if (user.mod) {
// User is a mod.
}
});
Get the current state of the socket. (String)
// Returns one of the following states: "CONNECTING", "OPEN", "CLOSING" or "CLOSED".
console.log(client.readyState());