Orca
A bot framework that is easy to reason about, easy to debug, and easy to use.
Public Attributes | List of all members
discord_gateway Struct Reference

The handle used for establishing a Discord Gateway connection via WebSockets. More...

#include <discord-internal.h>

Collaboration diagram for discord_gateway:
Collaboration graph
[legend]

Public Attributes

struct websockets * ws
 the websockets handle that connects to Discord
 
struct {
   bool   enable
 will attempt reconnecting if true
 
   int   attempt
 current reconnect attempt (resets to 0 when succesful)
 
   int   threshold
 max amount of reconnects before giving up
 
reconnect
 
bool is_resumable
 will attempt to resume session if connection shutsdowns
 
bool is_ready
 can start sending/receiving additional events to discord
 
bool shutdown
 if true shutdown websockets connection as soon as possible
 
struct discord_gateway_identifyid
 this info sent expecting a connection authentication
 
char session_id [512]
 the session id (for resuming lost connections)
 
struct {
   enum discord_gateway_opcodes   opcode
 field 'op'
 
   int   seq_number
 field 's'
 
   char   event_name [64]
 field 't'
 
   struct sized_buffer   event_data
 field 'd'
 
payload
 
struct {
   u64_unix_ms_t   interval_ms
 fixed interval between heartbeats
 
   u64_unix_ms_t   tstamp
 start pulse timestamp in milliseconds
 
hbeat
 
struct discord_session session
 on-going Discord Gateway session
 
struct sized_buffer prefix
 the prefix expected before every command More...
 
struct discord_gateway_cmd_cbs on_default_cmd * on_cmd
 user's command/callback pair and amount of callback pairs More...
 
size_t num_cmd
 
struct {
   idle_cb   on_idle
 triggers on every event loop iteration
 
   event_raw_cb   on_event_raw
 triggers for every event if set, receive its raw JSON string
 
   idle_cb   on_ready
 triggers when connection first establishes
 
   guild_role_cb   on_guild_role_create
 triggers when a guild role is created
 
   guild_role_cb   on_guild_role_update
 triggers when a guild role is updated
 
   guild_role_delete_cb   on_guild_role_delete
 triggers when a guild role is deleted
 
   guild_member_cb   on_guild_member_add
 triggers when a guild member joins a guild
 
   guild_member_remove_cb   on_guild_member_remove
 triggers when a guild member is removed from a guild
 
   guild_member_cb   on_guild_member_update
 triggers when a guild member status is updated (ex: receive role)
 
   guild_ban_cb   on_guild_ban_add
 triggers when a ban occurs
 
   guild_ban_cb   on_guild_ban_remove
 triggers when a ban is removed
 
   channel_cb   on_channel_create
 triggers when a channel is created
 
   channel_cb   on_channel_update
 triggers when a channel is updated
 
   channel_cb   on_channel_delete
 triggers when a channel is deleted
 
   channel_pins_update_cb   on_channel_pins_update
 triggers when a channel pinned messages updates
 
   message_cb   on_message_create
 triggers when a message is created
 
   sb_message_cb   sb_on_message_create
 
   message_cb   on_message_update
 trigger when a message is updated
 
   sb_message_cb   sb_on_message_update
 
   message_delete_cb   on_message_delete
 triggers when a message is deleted
 
   message_delete_bulk_cb   on_message_delete_bulk
 triggers when a bulk of messages is deleted
 
   message_reaction_add_cb   on_message_reaction_add
 triggers when a reaction is added to a message
 
   message_reaction_remove_cb   on_message_reaction_remove
 triggers when a reaction is removed from a message
 
   message_reaction_remove_all_cb   on_message_reaction_remove_all
 triggers when all reactions are removed from a message
 
   message_reaction_remove_emoji_cb   on_message_reaction_remove_emoji
 triggers when all occurences of a specific reaction is removed from a message
 
   voice_state_update_cb   on_voice_state_update
 triggers when a voice state is updated
 
   voice_server_update_cb   on_voice_server_update
 triggers when a voice server is updated
 
cbs
 
enum discord_event_handling_mode(* blocking_event_handler )(void *cxt)
 
int ping_ms
 latency between client and websockets server, calculated by the interval between HEARTBEAT and HEARTBEAT_ACK
 
pthread_mutex_t lock
 
struct discord_userbot
 the bot user structure
 
struct sized_buffer sb_bot
 
struct discordp_client
 pointer to client this struct is part of
 

Detailed Description

The handle used for establishing a Discord Gateway connection via WebSockets.

Note
A wrapper over struct websockets
See also
websockets.h

Member Data Documentation

◆ on_cmd

struct discord_gateway_cmd_cbs on_default_cmd* discord_gateway::on_cmd

user's command/callback pair and amount of callback pairs

See also
discord_set_on_command()

◆ prefix

struct sized_buffer discord_gateway::prefix

the prefix expected before every command

See also
discord_set_prefix()

◆ sb_bot

struct sized_buffer discord_gateway::sb_bot
Todo:
this is temporary

◆ sb_on_message_create

sb_message_cb discord_gateway::sb_on_message_create
Todo:
this is temporary

◆ sb_on_message_update

sb_message_cb discord_gateway::sb_on_message_update
Todo:
this is temporary

The documentation for this struct was generated from the following file: