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 - Usernameif (client.isMod("#schmoopiie", "bob")) {
// Do something..
}
RECOMMENDED
Everytime you receive a message on Twitch, you receive the user data which contain the user-type. Read more about user-type on the Twitch API documentation.
client.on("chat", function (channel, user, message, self) {
// Username is a mod or username is the broadcaster..
if (user["user-type"] === "mod" || user.username === channel.replace("#", "")) {
// 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());