Each and every actions support Promises. Some commands requires you to be logged in.
- Action - Send an action message on a channel. (/me <message>)
- Ban - Ban username on channel.
- Clear - Clear all messages on a channel.
- Color - Change the color of your username.
- Commercial - Run commercial on a channel for X seconds.
- Connect - Connect to server.
- Disconnect - Disconnect from server.
- Emoteonly - Enable emote-only on a channel.
- Emoteonlyoff - Disable emote-only on a channel.
- Followersonly - Enable followers-only on a channel.
- Followersonlyoff - Disable followers-only on a channel.
- Host - Host a channel.
- Join - Join a channel.
- Mod - Mod username on channel.
- Mods - Get list of mods on a channel.
- Part - Leave a channel.
- Ping - Send a PING to the server.
- R9kbeta - Enable R9KBeta on a channel.
- R9kbetaoff - Disable R9KBeta on a channel.
- Raw - Send a RAW message to the server.
- Say - Send a message on a channel.
- Slow - Enable slow mode on a channel.
- Slowoff - Disable slow mode on a channel.
- Subscribers - Enable subscriber-only on a channel.
- Subscribersoff - Disable subscriber-only on a channel.
- Timeout - Timeout username on channel for X seconds.
- Unban - Unban username on channel.
- Unhost - End the current hosting.
- Unmod - Unmod user on a channel.
- Whisper - Send an instant message to a user.
Send an action message on a channel. (/me <message>)
Parameters:
channel
: String - Channel name (Required)message
: String - Message (Required)
client.action('channel', 'Your message');
Promises:
- Resolved on message sent1
- Rejected on request timed out
1: There is no possible way to know if a message has been sent successfully unless we create two connections. This promise will always be resolved unless you are trying to send a message and you're not connected to a server.
client
.action('channel', 'Your message')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Ban username on channel.
Parameters:
channel
: String - Channel name (Required)username
: String - Username to ban (Required)reason
: String - Reason for the ban (Optional)
client.ban('channel', 'username', 'reason');
Promises:
- Resolved on ban_success
- Rejected on already_banned, bad_ban_admin, bad_ban_broadcaster, bad_ban_global_mod, bad_ban_self, bad_ban_staff, no_permission, usage_ban or request timed out
client
.ban('channel', 'username', 'reason')
.then(function(data) {
// data returns [channel, username, reason]
})
.catch(function(err) {
//
});
Clear all messages on a channel.
Parameters:
channel
: String - Channel name (Required)
client.clear('channel');
Promises:
- Resolved on clearchat event
- Rejected on no_permission, usage_clear or request timed out
client
.clear('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Change the color of your username.
Parameters:
color
: String - Color name (Required)
Note: Turbo users can change their color using hexadecimal color (like #000000
or #FFFFFF
) and non-turbo users can choose one of the following colors:
- Blue
- BlueViolet
- CadetBlue
- Chocolate
- Coral
- DodgerBlue
- Firebrick
- GoldenRod
- Green
- HotPink
- OrangeRed
- Red
- SeaGreen
- SpringGreen
- YellowGreen
client.color('#C0C0C0');
client.color('SpringGreen');
Promises:
- Resolved on color_changed
- Rejected on turbo_only_color, usage_color or request timed out
client
.color('#C0C0C0')
.then(function(data) {
// data returns [color]
})
.catch(function(err) {
//
});
Run commercial on a channel for X seconds. Available lengths (seconds) are 30
, 60
, 90
, 120
, 150
, 180
.
Parameters:
channel
: String - Channel name (Required)seconds
: Integer - Commercial lengths (Required)
client.commercial('channel', 30);
Promises:
- Resolved on commercial_success
- Rejected on bad_commercial_error, no_permission, usage_commercial or request timed out
client
.commercial('channel', 30)
.then(function(data) {
// data returns [channel, seconds]
})
.catch(function(err) {
//
});
Connect to server.
client.connect();
Promises:
- Resolved once connected to the server1
- Rejected if disconnected from server
1: Only fire once, will not fire upon reconnection.
client
.connect()
.then(function(data) {
// data returns [server, port]
})
.catch(function(err) {
//
});
Disconnect from server.
client.disconnect();
Promises:
- Resolved when the socket is closed
- Rejected if socket is already closed
client
.disconnect()
.then(function(data) {
// data returns [server, port]
})
.catch(function(err) {
//
});
Enable emote-only on a channel.
Parameters:
channel
: String - Channel name (Required)
client.emoteonly('channel');
Promises:
- Resolved on emote_only_on
- Rejected on usage_emote_only_on, already_emote_only_on, no_permission or request timed out
client
.emoteonly('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Disable emote-only on a channel.
Parameters:
channel
: String - Channel name (Required)
client.emoteonlyoff('channel');
Promises:
- Resolved on emote_only_off
- Rejected on usage_emote_only_off, already_emote_only_off, no_permission or request timed out
client
.emoteonlyoff('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Enable followers-only on a channel.
Parameters:
channel
: String - Channel name (Required)length
: Integer - Length in minutes (Optional, default is30
)
client.followersonly('channel', 30);
Promises:
- Resolved on ROOMSTATE
- Rejected on no_permission or request timed out
client
.followersonly('channel', 30)
.then(function(data) {
// data returns [channel, minutes]
})
.catch(function(err) {
//
});
Disabled followers-only on a channel.
Parameters:
channel
: String - Channel name (Required)
client.followersonlyoff('channel');
Promises:
- Resolved on ROOMSTATE
- Rejected on no_permission or request timed out
client
.followersonlyoff('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Host a channel.
Parameters:
channel
: String - Channel name (Required)target
: String - Channel to host (Required)
client.host('channel', 'target');
Promises:
- Resolved on hosts_remaining
- Rejected on bad_host_hosting, bad_host_rate_exceeded, no_permission, usage_host or request timed out
client
.host('channel', 'target')
.then(function(data) {
// data returns [channel, target]
})
.catch(function(err) {
//
});
Join a channel.
Parameters:
channel
: String - Channel name (Required)
client.join('channel');
Promises:
- Resolved on success
- Rejected on msg_channel_suspended or request timed out
client
.join('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Mod username on channel.
Parameters:
channel
: String - Channel name (Required)username
: String - Username to add as a moderator (Required)
client.mod('channel', 'username');
Promises:
- Resolved on mod_success
- Rejected on usage_mod, bad_mod_banned, bad_mod_mod or request timed out
client
.mod('channel', 'username')
.then(function(data) {
// data returns [channel, username]
})
.catch(function(err) {
//
});
Get list of mods on a channel.
Parameters:
channel
: String - Channel name (Required)
client.mods('channel');
Promises:
- Resolved on room_mods or no_mods
- Rejected on usage_mods or request timed out
client
.mods('channel')
.then(function(data) {
// data returns [moderators]
})
.catch(function(err) {
//
});
Leave a channel.
Parameters:
channel
: String - Channel name (Required)
client.part('channel');
Promises:
- Resolved on leaving a channel
- Rejected on request timed out
client
.part('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Send a PING to the server.
client.ping();
Promises:
- Resolved on PONG received
- Rejected on request timed out
client
.ping()
.then(function(data) {
// data returns [latency]
})
.catch(function(err) {
//
});
Enable R9KBeta on a channel.
Parameters:
channel
: String - Channel name (Required)
client.r9kbeta('channel');
Promises:
- Resolved on r9k_on
- Rejected on usage_r9k_on, already_r9k_on, no_permission or request timed out
client
.r9kbeta('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Disable R9KBeta on a channel.
Parameters:
channel
: String - Channel name (Required)
client.r9kbetaoff('channel');
Promises:
- Resolved on r9k_off
- Rejected on usage_r9k_off, already_r9k_off, no_permission or request timed out
client
.r9kbetaoff('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Send a RAW message to the server.
Parameters:
message
: String - Message to send to the server (Required)
client.raw('CAP REQ :twitch.tv/tags');
Promises:
- Resolved on message sent
- Rejected on request timed out
client
.raw('CAP REQ :twitch.tv/tags')
.then(function(data) {
// data returns [message]
})
.catch(function(err) {
//
});
Send a message on a channel.
Parameters:
channel
: String - Channel name (Required)message
: String - Message (Required)
client.say('channel', 'Your message');
Promises:
- Resolved on message sent1
- Rejected on request timed out
1: There is no possible way to know if a message has been sent successfully unless we create two connections. This promise will always be resolved unless you are trying to send a message and you're not connected to server.
client
.say('channel', 'Your message')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Enable slow mode on a channel.
Parameters:
channel
: String - Channel name (Required)length
: Integer - Length in seconds (Optional, default is 300)
client.slow('channel', 300);
Promises:
- Resolved on success
- Rejected on usage_slow_on, no_permission or request timed out
client
.slow('channel', 300)
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Disable slow mode on a channel.
Parameters:
channel
: String - Channel name (Required)
client.slowoff('channel');
Promises:
- Resolved on success
- Rejected on usage_slow_off, no_permission or request timed out
client
.slowoff('channel', 300)
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Enable subscriber-only on a channel.
Parameters:
channel
: String - Channel name (Required)
client.subscribers('channel');
Promises:
- Resolved on subs_on
- Rejected on usage_subs_on, already_subs_on, no_permission or request timed out
client
.subscribers('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Disable subscriber-only on a channel.
Parameters:
channel
: String - Channel name (Required)
client.subscribersoff('channel');
Promises:
- Resolved on subs_off
- Rejected on usage_subs_off, already_subs_off, no_permission or request timed out
client
.subscribersoff('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Timeout username on channel for X seconds.
Parameters:
channel
: String - Channel name (Required)username
: String - Username to timeout (Required)length
: Integer - Length in seconds (Optional, default is 300)reason
: String - Reason for the timeout (Optional)
client.timeout('channel', 'username', 300, 'reason');
Promises:
- Resolved on timeout_success
- Rejected on usage_timeout, bad_timeout_admin, bad_timeout_broadcaster, bad_timeout_global_mod, bad_timeout_self, bad_timeout_staff, no_permission or request timed out
client
.timeout('channel', 'username', 300, 'reason')
.then(function(data) {
// data returns [channel, username, seconds, reason]
})
.catch(function(err) {
//
});
Unban username on channel.
Parameters:
channel
: String - Channel name (Required)username
: String - Username to unban (Required)
client.unban('channel', 'username');
Promises:
- Resolved on unban_success
- Rejected on usage_unban, bad_unban_no_ban, no_permission or request timed out
client
.unban('channel', 'username')
.then(function(data) {
// data returns [channel, username]
})
.catch(function(err) {
//
});
End the current hosting. You must be the broadcaster or an editor.
Parameters:
channel
: String - Channel name (Required)
client.unhost('channel');
Promises:
- Resolved on success
- Rejected on usage_unhost, not_hosting, no_permission or request timed out
client
.unhost('channel')
.then(function(data) {
// data returns [channel]
})
.catch(function(err) {
//
});
Unmod user on a channel.
Parameters:
channel
: String - Channel name (Required)username
: String - Username to unmod (Required)
client.unmod('channel', 'username');
Promises:
- Resolved on unmod_success
- Rejected on usage_unmod, bad_unmod_mod, no_permission or request timed out
client
.unmod('channel', 'username')
.then(function(data) {
// data returns [channel, username]
})
.catch(function(err) {
//
});
Send an instant message to a user.
Parameters:
username
: String - Username (Required)message
: String - Message (Required)
client.whisper('username', 'Your message');
Promises:
- Resolved on message sent1
- Rejected on request timed out
1: There is no possible way to know if a message has been sent successfully unless we create two connections. This promise will always be resolved unless you are trying to send a message and you're not connected to server.
client
.whisper('username', 'Your message')
.then(function(data) {
// data returns [username, message]
})
.catch(function(err) {
//
});