Concord - C Discord API library
A Discord API wrapper library written in C
discord-events.h File Reference

Listen, react and trigger Discord Gateway events. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum discord_event_scheduler discord_event_scheduler_t
 return value of discord_set_event_scheduler() callback More...
 
typedef enum discord_event_scheduler(* discord_ev_scheduler) (struct discord *client, const char data[], size_t size, enum discord_gateway_events event)
 Event Handling Mode callback. More...
 

Enumerations

enum  discord_gateway_events {
  DISCORD_EV_NONE = 0 , DISCORD_EV_READY , DISCORD_EV_RESUMED , DISCORD_EV_RECONNECT ,
  DISCORD_EV_INVALID_SESSION , DISCORD_EV_APPLICATION_COMMAND_PERMISSIONS_UPDATE , DISCORD_EV_AUTO_MODERATION_RULE_CREATE , DISCORD_EV_AUTO_MODERATION_RULE_UPDATE ,
  DISCORD_EV_AUTO_MODERATION_RULE_DELETE , DISCORD_EV_AUTO_MODERATION_ACTION_EXECUTION , DISCORD_EV_CHANNEL_CREATE , DISCORD_EV_CHANNEL_UPDATE ,
  DISCORD_EV_CHANNEL_DELETE , DISCORD_EV_CHANNEL_PINS_UPDATE , DISCORD_EV_THREAD_CREATE , DISCORD_EV_THREAD_UPDATE ,
  DISCORD_EV_THREAD_DELETE , DISCORD_EV_THREAD_LIST_SYNC , DISCORD_EV_THREAD_MEMBER_UPDATE , DISCORD_EV_THREAD_MEMBERS_UPDATE ,
  DISCORD_EV_GUILD_CREATE , DISCORD_EV_GUILD_UPDATE , DISCORD_EV_GUILD_DELETE , DISCORD_EV_GUILD_BAN_ADD ,
  DISCORD_EV_GUILD_BAN_REMOVE , DISCORD_EV_GUILD_EMOJIS_UPDATE , DISCORD_EV_GUILD_STICKERS_UPDATE , DISCORD_EV_GUILD_INTEGRATIONS_UPDATE ,
  DISCORD_EV_GUILD_MEMBER_ADD , DISCORD_EV_GUILD_MEMBER_REMOVE , DISCORD_EV_GUILD_MEMBER_UPDATE , DISCORD_EV_GUILD_MEMBERS_CHUNK ,
  DISCORD_EV_GUILD_ROLE_CREATE , DISCORD_EV_GUILD_ROLE_UPDATE , DISCORD_EV_GUILD_ROLE_DELETE , DISCORD_EV_GUILD_SCHEDULED_EVENT_CREATE ,
  DISCORD_EV_GUILD_SCHEDULED_EVENT_UPDATE , DISCORD_EV_GUILD_SCHEDULED_EVENT_DELETE , DISCORD_EV_GUILD_SCHEDULED_EVENT_USER_ADD , DISCORD_EV_GUILD_SCHEDULED_EVENT_USER_REMOVE ,
  DISCORD_EV_INTEGRATION_CREATE , DISCORD_EV_INTEGRATION_UPDATE , DISCORD_EV_INTEGRATION_DELETE , DISCORD_EV_INTERACTION_CREATE ,
  DISCORD_EV_INVITE_CREATE , DISCORD_EV_INVITE_DELETE , DISCORD_EV_MESSAGE_CREATE , DISCORD_EV_MESSAGE_UPDATE ,
  DISCORD_EV_MESSAGE_DELETE , DISCORD_EV_MESSAGE_DELETE_BULK , DISCORD_EV_MESSAGE_REACTION_ADD , DISCORD_EV_MESSAGE_REACTION_REMOVE ,
  DISCORD_EV_MESSAGE_REACTION_REMOVE_ALL , DISCORD_EV_MESSAGE_REACTION_REMOVE_EMOJI , DISCORD_EV_PRESENCE_UPDATE , DISCORD_EV_STAGE_INSTANCE_CREATE ,
  DISCORD_EV_STAGE_INSTANCE_DELETE , DISCORD_EV_STAGE_INSTANCE_UPDATE , DISCORD_EV_TYPING_START , DISCORD_EV_USER_UPDATE ,
  DISCORD_EV_VOICE_STATE_UPDATE , DISCORD_EV_VOICE_SERVER_UPDATE , DISCORD_EV_WEBHOOKS_UPDATE , DISCORD_EV_MAX
}
 Discord Gateway's events. More...
 
enum  discord_event_scheduler { DISCORD_EVENT_IGNORE , DISCORD_EVENT_MAIN_THREAD , DISCORD_EVENT_WORKER_THREAD }
 return value of discord_set_event_scheduler() callback More...
 

Functions

void discord_request_guild_members (struct discord *client, struct discord_request_guild_members *request)
 Request all members for a guild or a list of guilds. More...
 
void discord_update_voice_state (struct discord *client, struct discord_update_voice_state *update)
 Sent when a client wants to join, move or disconnect from a voice channel. More...
 
void discord_update_presence (struct discord *client, struct discord_presence_update *presence)
 Update the client presence status. More...
 
void discord_set_presence (struct discord *client, struct discord_presence_update *presence)
 Set the client presence status. More...
 
void discord_set_event_scheduler (struct discord *client, discord_ev_scheduler callback)
 Provides control over Discord event's callback scheduler. More...
 
void discord_add_intents (struct discord *client, uint64_t code)
 Subscribe to Discord Events. More...
 
void discord_remove_intents (struct discord *client, uint64_t code)
 Unsubscribe from Discord Events. More...
 
void discord_set_prefix (struct discord *client, const char prefix[])
 Set a mandatory prefix before commands. More...
 
void discord_set_on_command (struct discord *client, char *command, void(*callback)(struct discord *client, const struct discord_message *event))
 Set command/callback pair. More...
 
void discord_set_on_commands (struct discord *client, char *const commands[], int amount, void(*callback)(struct discord *client, const struct discord_message *event))
 Set a variadic series of NULL terminated commands to a callback. More...
 
void discord_set_next_wakeup (struct discord *client, int64_t delay)
 Set the time for wakeup function to be called. More...
 
void discord_set_on_wakeup (struct discord *client, void(*callback)(struct discord *client))
 Triggered at a arbitrary interval value set at discord_set_next_wakeup() More...
 
void discord_set_on_idle (struct discord *client, void(*callback)(struct discord *client))
 Triggers when idle. More...
 
void discord_set_on_cycle (struct discord *client, void(*callback)(struct discord *client))
 Triggers once per event-loop cycle. More...
 
void discord_set_on_ready (struct discord *client, void(*callback)(struct discord *client, const struct discord_ready *event))
 Triggers when the client session is ready. More...
 
void discord_set_on_application_command_permissions_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_application_command_permissions *event))
 Triggers when an application command permission is updated. More...
 
void discord_set_on_auto_moderation_rule_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_auto_moderation_rule *event))
 Triggers when an auto moderation rule is created. More...
 
void discord_set_on_auto_moderation_rule_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_auto_moderation_rule *event))
 Triggers when an auto moderation rule is updated. More...
 
void discord_set_on_auto_moderation_rule_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_auto_moderation_rule *event))
 Triggers when an auto moderation rule is deleted. More...
 
void discord_set_on_auto_moderation_action_execution (struct discord *client, void(*callback)(struct discord *client, const struct discord_auto_moderation_action_execution *event))
 Triggers when an auto moderation rule is triggered and an execution is executed (e.g a message was blocked) More...
 
void discord_set_on_channel_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_channel *event))
 Triggers when a channel is created. More...
 
void discord_set_on_channel_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_channel *event))
 Triggers when a channel is updated. More...
 
void discord_set_on_channel_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_channel *event))
 Triggers when a channel is deleted. More...
 
void discord_set_on_channel_pins_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_channel_pins_update *event))
 Triggers when a channel pin is updated. More...
 
void discord_set_on_thread_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_channel *event))
 Triggers when a thread is created. More...
 
void discord_set_on_thread_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_channel *event))
 Triggers when a thread is updated. More...
 
void discord_set_on_thread_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_channel *event))
 Triggers when a thread is deleted. More...
 
void discord_set_on_thread_list_sync (struct discord *client, void(*callback)(struct discord *client, const struct discord_thread_list_sync *event))
 Triggers when the current user gains access to a channel. More...
 
void discord_set_on_thread_member_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_thread_member *event))
 Triggers when a thread the bot is in gets updated. More...
 
void discord_set_on_thread_members_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_thread_members_update *event))
 Triggers when someone is added or removed from a thread. More...
 
void discord_set_on_guild_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild *event))
 Triggers when a guild is created. More...
 
void discord_set_on_guild_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild *event))
 Triggers when a guild is updated. More...
 
void discord_set_on_guild_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild *event))
 Triggers when a guild is deleted. More...
 
void discord_set_on_guild_ban_add (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_ban_add *event))
 Triggers when a user is banned from a guild. More...
 
void discord_set_on_guild_ban_remove (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_ban_remove *event))
 Triggers when a user is unbanned from a guild. More...
 
void discord_set_on_guild_emojis_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_emojis_update *event))
 Triggers when a guild emojis are updated. More...
 
void discord_set_on_guild_stickers_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_stickers_update *event))
 Triggers when a guild stickers are updated. More...
 
void discord_set_on_guild_integrations_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_integrations_update *event))
 Triggers when a guild integrations are updated. More...
 
void discord_set_on_guild_member_add (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_member *event))
 Triggers when a guild member is added. More...
 
void discord_set_on_guild_member_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_member_update *event))
 Triggers when a guild member is updated. More...
 
void discord_set_on_guild_member_remove (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_member_remove *event))
 Triggers when a guild member is removed. More...
 
void discord_set_on_guild_members_chunk (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_members_chunk *event))
 Triggers in response to discord_request_guild_members() More...
 
void discord_set_on_guild_role_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_role_create *event))
 Triggers when a guild role is created. More...
 
void discord_set_on_guild_role_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_role_update *event))
 Triggers when a guild role is updated. More...
 
void discord_set_on_guild_role_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_role_delete *event))
 Triggers when a guild role is deleted. More...
 
void discord_set_on_guild_scheduled_event_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_scheduled_event *event))
 Triggers when a guild scheduled event is created. More...
 
void discord_set_on_guild_scheduled_event_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_scheduled_event *event))
 Triggers when a guild scheduled event is updated. More...
 
void discord_set_on_guild_scheduled_event_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_scheduled_event *event))
 Triggers when a guild scheduled event is deleted. More...
 
void discord_set_on_guild_scheduled_event_user_add (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_scheduled_event_user_add *event))
 Triggers when a user subscribes to a guild scheduled event. More...
 
void discord_set_on_guild_scheduled_event_user_remove (struct discord *client, void(*callback)(struct discord *client, const struct discord_guild_scheduled_event_user_remove *event))
 Triggers when a user unsubscribes from a guild scheduled event. More...
 
void discord_set_on_integration_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_integration *event))
 Triggers when a guild integration is created. More...
 
void discord_set_on_integration_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_integration *event))
 Triggers when a guild integration is updated. More...
 
void discord_set_on_integration_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_integration_delete *event))
 Triggers when a guild integration is deleted. More...
 
void discord_set_on_interaction_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_interaction *event))
 Triggers when user has used an interaction, such as an application command. More...
 
void discord_set_on_invite_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_invite_create *event))
 Triggers when an invite to a channel has been created. More...
 
void discord_set_on_invite_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_invite_delete *event))
 Triggers when an invite to a channel has been deleted. More...
 
void discord_set_on_message_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_message *event))
 Triggers when a message is created. More...
 
void discord_set_on_message_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_message *event))
 Triggers when a message is updated. More...
 
void discord_set_on_message_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_message_delete *event))
 Triggers when a message is deleted. More...
 
void discord_set_on_message_delete_bulk (struct discord *client, void(*callback)(struct discord *client, const struct discord_message_delete_bulk *event))
 Triggers when messages are deleted in bulk. More...
 
void discord_set_on_message_reaction_add (struct discord *client, void(*callback)(struct discord *client, const struct discord_message_reaction_add *event))
 Triggers when a message reaction is added. More...
 
void discord_set_on_message_reaction_remove (struct discord *client, void(*callback)(struct discord *client, const struct discord_message_reaction_remove *event))
 Triggers when a message reaction is removed. More...
 
void discord_set_on_message_reaction_remove_all (struct discord *client, void(*callback)(struct discord *client, const struct discord_message_reaction_remove_all *event))
 Triggers when all message reactions are removed. More...
 
void discord_set_on_message_reaction_remove_emoji (struct discord *client, void(*callback)(struct discord *client, const struct discord_message_reaction_remove_emoji *event))
 Triggers when all instances of a particular reaction from some message is removed. More...
 
void discord_set_on_presence_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_presence_update *event))
 Triggers when user presence is updated. More...
 
void discord_set_on_stage_instance_create (struct discord *client, void(*callback)(struct discord *client, const struct discord_stage_instance *event))
 Triggers when a stage instance is created. More...
 
void discord_set_on_stage_instance_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_stage_instance *event))
 Triggers when a stage instance is updated. More...
 
void discord_set_on_stage_instance_delete (struct discord *client, void(*callback)(struct discord *client, const struct discord_stage_instance *event))
 Triggers when a stage instance is deleted. More...
 
void discord_set_on_typing_start (struct discord *client, void(*callback)(struct discord *client, const struct discord_typing_start *event))
 Triggers when user starts typing in a channel. More...
 
void discord_set_on_user_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_user *event))
 Triggers when properties about a user changed. More...
 
void discord_set_on_voice_state_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_voice_state *event))
 Triggers when a voice state is updated. More...
 
void discord_set_on_voice_server_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_voice_server_update *event))
 Triggers when voice server is updated. More...
 
void discord_set_on_webhooks_update (struct discord *client, void(*callback)(struct discord *client, const struct discord_webhooks_update *event))
 Triggers when guild channel has been created, updated or deleted. More...
 

Detailed Description

Listen, react and trigger Discord Gateway events.

Author
Cogmasters