Wrapper to the Discord Gateway API.
More...
|
void | discord_gateway_init (struct discord_gateway *gw, struct logconf *conf, const char token[]) |
| Initialize a Gateway handle. More...
|
|
void | discord_gateway_cleanup (struct discord_gateway *gw) |
| Free a Gateway handle. More...
|
|
CCORDcode | discord_gateway_start (struct discord_gateway *gw) |
| Initialize handle with the new session primitives. More...
|
|
bool | discord_gateway_end (struct discord_gateway *gw) |
| Cleanup and reset gw session primitives. More...
|
|
CCORDcode | discord_gateway_perform (struct discord_gateway *gw) |
| Check and manage on-going Gateway session. More...
|
|
void | discord_gateway_shutdown (struct discord_gateway *gw) |
| Gracefully shutdown a ongoing Discord connection over WebSockets. More...
|
|
void | discord_gateway_reconnect (struct discord_gateway *gw, bool resume) |
| Gracefully reconnect a ongoing Discord connection over WebSockets. More...
|
|
void | discord_gateway_send_identify (struct discord_gateway *gw, struct discord_identify *event) |
| Trigger the initial handshake with the gateway. More...
|
|
void | discord_gateway_send_resume (struct discord_gateway *gw, struct discord_resume *event) |
| Replay missed events when a disconnected client resumes. More...
|
|
void | discord_gateway_send_heartbeat (struct discord_gateway *gw, int seq) |
| Maintain an active gateway connection. More...
|
|
void | discord_gateway_send_request_guild_members (struct discord_gateway *gw, struct discord_request_guild_members *event) |
| Request all members for a guild or a list of guilds. More...
|
|
void | discord_gateway_send_update_voice_state (struct discord_gateway *gw, struct discord_update_voice_state *event) |
| Sent when a client wants to join, move or disconnect from a voice channel. More...
|
|
void | discord_gateway_send_presence_update (struct discord_gateway *gw, struct discord_presence_update *event) |
| Send client's presence status update payload. More...
|
|
void | discord_gateway_dispatch (struct discord_gateway *gw) |
| Dispatch user callback matched to event. More...
|
|
Wrapper to the Discord Gateway API.
◆ discord_ev_event
typedef void(* discord_ev_event) (struct discord *client, const void *event) |
A generic event callback for casting
◆ discord_ev_message
◆ discord_gateway_init()
Initialize a Gateway handle.
Structure used for interfacing with the Discord's Gateway API
- Parameters
-
gw | the gateway handle to be initialized |
conf | pointer to discord logging module |
token | the bot token |
◆ discord_gateway_cleanup()
Free a Gateway handle.
- Parameters
-
◆ discord_gateway_start()
Initialize handle with the new session primitives.
- Parameters
-
- Returns
- CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
◆ discord_gateway_end()
Cleanup and reset gw
session primitives.
- Parameters
-
ws | the WebSockets handle created with ws_init() |
- Returns
true
if session is over, false
if session can be retried for reconnection
◆ discord_gateway_perform()
Check and manage on-going Gateway session.
- Parameters
-
- Returns
- CCORDcode value for how the operation went, CCORD_OK means nothing out of the ordinary
◆ discord_gateway_shutdown()
Gracefully shutdown a ongoing Discord connection over WebSockets.
- Parameters
-
◆ discord_gateway_reconnect()
void discord_gateway_reconnect |
( |
struct discord_gateway * |
gw, |
|
|
bool |
resume |
|
) |
| |
Gracefully reconnect a ongoing Discord connection over WebSockets.
- Parameters
-
gw | the handle initialized with discord_gateway_init() |
resume | true to attempt to resume to previous session, false restart a fresh session |
◆ discord_gateway_send_identify()
Trigger the initial handshake with the gateway.
- Parameters
-
◆ discord_gateway_send_resume()
Replay missed events when a disconnected client resumes.
- Parameters
-
◆ discord_gateway_send_heartbeat()
void discord_gateway_send_heartbeat |
( |
struct discord_gateway * |
gw, |
|
|
int |
seq |
|
) |
| |
Maintain an active gateway connection.
- Parameters
-
◆ discord_gateway_send_request_guild_members()
Request all members for a guild or a list of guilds.
- Parameters
-
◆ discord_gateway_send_update_voice_state()
Sent when a client wants to join, move or disconnect from a voice channel.
- Parameters
-
◆ discord_gateway_send_presence_update()
Send client's presence status update payload.
- Parameters
-
◆ discord_gateway_dispatch()
Dispatch user callback matched to event.
- Parameters
-