-
Notifications
You must be signed in to change notification settings - Fork 3
Commands
libtwirc
comes with a large number of functions that allow you to easily send commands to the Twitch IRC server. All of these functions return 0 on success and -1 on error. Note, however, that success and error do not indicate whether the command was processed by the server, but simply whether or not libtwirc
managed to send the command in the first place.
This just sends your message to the server as-is. Well, it does add the line break required by IRC at the end.
int twirc_cmd_raw(twirc_state_t *s, const char *msg)
This sends the PASS
command to the server, which is used for authentication. libtwirc
initiates authentication automatically for you once the connection has been established, so there should be no reason for you to use this.
int twirc_cmd_pass(twirc_state_t *s, const char *pass)
This sends the NICK
command to the server, which is used for authentication. libtwirc
initiates authentication automatically for you once the connection has been established, so there should be no reason for you to use this.
int twirc_cmd_nick(twirc_state_t *s, const char *nick)
Attempts to join the specified channel. chan
needs to include the leading pound character, as in #channel
.
int twirc_cmd_join(twirc_state_t *s, const char *chan)
Attempts to leave the specified channel. chan
needs to include the leading pound character, as in #channel
.
int twirc_cmd_part(twirc_state_t *s, const char *chan)
Sends a PING
to the server. param
is optional.
int twirc_cmd_ping(twirc_state_t *s, const char *param)
Sends a PONG
to the server. param
is optional. If given, if will be prefixed with :
. You should not need to use this, as libtwirc
will automatically reply to PING
message from the server for you.
int twirc_cmd_pong(twirc_state_t *s, const char *param)
Sends the QUIT
command to the server. The server will usually close the connection in reaction to this. It should always be send when we want to disconnect. However, if you use twirc_disconnect()
or twirc_kill()
, then libtwirc
will send this command for you automatically.
int twirc_cmd_quit(twirc_state_t *s)
Sends the given chat message to the specified channel. chan
needs to include the leading pound sign.
int twirc_cmd_privmsg(twirc_state_t *s, const char *chan, const char *msg)
Sends the given chat message to the specified channel, as if it had been sent with the /me
command. chan
needs to include the leading pound sign.
int twirc_cmd_action(twirc_state_t *s, const char *chan, const char *msg)
Sends the msg
as whisper to the specified user. Note, however, that Twitch sometimes prevents bots from doing this in order to avoid spam.
int twirc_cmd_whisper(twirc_state_t *s, const char *nick, const char *msg)
Requests the tags
capability from the server. libtwirc
does this automatically once the connection has been established, so you should not need this.
int twirc_cmd_req_tags(twirc_state_t *s)
Requests the membership
capability from the server. libtwirc
does this automatically once the connection has been established, so you should not need this.
int twirc_cmd_req_membership(twirc_state_t *s)
Requests the commands
capability from the server. libtwirc
does this automatically once the connection has been established, so you should not need this.
int twirc_cmd_req_commands(twirc_state_t *s)
Sends the /mods
command to the specified channel. chan
needs to include the leading pound sign.
int twirc_cmd_mods(twirc_state_t *s, const char *chan)
Sends the /vips
command to the specified channel. chan
needs to include the leading pound sign.
int twirc_cmd_vips(twirc_state_t *s, const char *chan)
Sends the /color
command to the server. This will change your chat color to the specified color, if you have the permission. color
can be either a hex color or a named color, please check the Twitch docs for further details.
int twirc_cmd_color(twirc_state_t *s, const char *color)
Sends the /delete
message to the specified channel. This will delete the message with the UUID id
, given that you have the permission to do this.
int twirc_cmd_delete(twirc_state_t *s, const char *chan, const char *id)
Times out the specified user in the given channel for secs
seconds. reason
is optional. Only works if you have the required permissions.
int twirc_cmd_timeout(twirc_state_t *s, const char *chan, const char *nick, int secs, const char *reason)
Remove the timeout for the specified user in the specified channel, granted that you have the permissions for this.
int twirc_cmd_untimeout(twirc_state_t *s, const char *chan, const char *nick)
Ban the specified user in the specified channel. reason
is optional. Required appropriate permissions.
int twirc_cmd_ban(twirc_state_t *s, const char *chan, const char *nick, const char *reason)
Un-ban the specified user in the specified channel, given that you have permissions to do so.
int twirc_cmd_unban(twirc_state_t *s, const char *chan, const char *nick)
Activates slow mode in the specified channel. User will only be able to send messages every secs
seconds. Requires appropriate permissions.
int twirc_cmd_slow(twirc_state_t *s, const char *chan, int secs)
Deactivates slow mode in the specified channel. Requires appropriate permissions.
int twirc_cmd_slowoff(twirc_state_t *s, const char *chan)
Activates followers only mode in the specified channel. Only user who are followers for the specified time
will be able to chat. Consult the Twitch docs for details. Requires appropriate permissions.
int twirc_cmd_followers(twirc_state_t *s, const char *chan, const char *time)
Deactivates followers only mode in the specified channel. Requires appropriate permissions.
int twirc_cmd_followersoff(twirc_state_t *s, const char *chan)
Activates sub only mode in the specified channel. Only subscribers will be able to chat. Requires appropriate permissions.
int twirc_cmd_subscribers(twirc_state_t *s, const char *chan)
Deactivates sub only mode in the specified channel. Requires appropriate permissions.
int twirc_cmd_subscribersoff(twirc_state_t *s, const char *chan)
Clear the chat history in the specified channel, given that you have permissions to do so. Notice, however, that this just sends a CLEARCHAT
command to all clients. Whether the clients actually remove the messages is entirely up to them.
int twirc_cmd_clear(twirc_state_t *s, const char *chan)
Activates r9kbeta mode in the given channel, given that you have the permissions to do so. Consult the Twitch docs for more information on r9kbeta mode.
int twirc_cmd_r9k(twirc_state_t *s, const char *chan)
Deactivates r9kbeta mode in the given channel, given that you have the permissions to do so.
int twirc_cmd_r9koff(twirc_state_t *s, const char *chan)
Activates emote-only mode in the given channel, given that you have the permissions to do so.
int twirc_cmd_emoteonly(twirc_state_t *s, const char *chan)
Deactivates emote-only mode in the given channel, given that you have the permissions to do so.
int twirc_cmd_emoteonlyoff(twirc_state_t *s, const char *chan)
int twirc_cmd_commercial(twirc_state_t *s, const char *chan, int secs)
int twirc_cmd_host(twirc_state_t *s, const char *chan, const char *target)
int twirc_cmd_unhost(twirc_state_t *s, const char *chan)
int twirc_cmd_mod(twirc_state_t *s, const char *chan, const char *nick)
int twirc_cmd_unmod(twirc_state_t *s, const char *chan, const char *nick)
int twirc_cmd_vip(twirc_state_t *s, const char *chan, const char *nick)
int twirc_cmd_unvip(twirc_state_t *s, const char *chan, const char *nick)
int twirc_cmd_marker(twirc_state_t *s, const char *chan, const char *comment)