-
Notifications
You must be signed in to change notification settings - Fork 3
Login data
Julien edited this page Mar 7, 2019
·
1 revision
When you call upon twirc_connect(), it will save your connection and authentication data in a twirc_login_t struct. Once you have been successfully logged in, it will also remember your display name as well as user ID as reported by the Twitch server. All of this information can be queried at any time.
The login struct has the following members:
-
char *host
The host address that was used to connect to the server. -
char *port
The port that was used to connect to the server. -
char *nick
The Twitch user name (nickname) that was used to connect to the server. -
char *pass
The Twitch oauth token (password) that was used to connect to the server. -
char *name
Your Twitch display name as reported by the server via GLOBALUSERSTATE. -
char *id
Your Twitch user ID as reported by the server via GLOBALUSERSTATE.
The following function allows you to retrieve a pointer to the login struct:
struct twirc_login *twirc_get_login(twirc_state_t *s);
Example:
void handle_join(twirc_state_t *s, twirc_event_t *evt)
{
twirc_login_t *login = twirc_get_login(s);
// Check if we just saw ourself joining a channel
if (strcmp(evt->origin, login->nick) == 0)
{
twirc_cmd_privmsg(s, evt->channel, "Hello everyone!");
}
}