Set Callbacks#
On Command#
-
void discord_set_on_command(struct discord *client, char *command, discord_on_message cb)#
Set command/callback pair.
The callback is triggered when a user types the assigned command in a chat visible to the client
Note
The command and any subjacent empty space is left out of the message content
- Parameters:
client – the client created with discord_init()
command – the command to trigger the callback
callback – the callback to be triggered on event
-
void discord_set_on_commands(struct discord *client, discord_on_message cb, ...)#
Set a variadic series of NULL terminated commands to a callback.
The callback is triggered when a user types one of the assigned commands in a chat visble to the client
Note
The command and any subjacent empty space is left out of the message content
- Parameters:
client – the client created with discord_init()
callback – the callback to be triggered on event
... – commands and a NULL terminator
On Discord Events#
- group DiscordCallbackSet
Set callbacks to be triggered on event detection.
Note
the functions will automatically set the necessary intent(s) to make the callback triggerable
- param client:
the client created with discord_init()
- param callback:
the callback to be triggered on event
Functions
-
void discord_set_on_idle(struct discord *client, discord_on_idle cb)#
Triggers at every event-loop iteration.
-
void discord_set_on_ready(struct discord *client, discord_on_idle cb)#
Triggers when the client is ready.
-
void discord_set_on_application_command_create(struct discord *client, discord_on_application_command cb)#
Triggers when a application command is created.
-
void discord_set_on_application_command_update(struct discord *client, discord_on_application_command cb)#
Triggers when a application command is updated.
-
void discord_set_on_application_command_delete(struct discord *client, discord_on_application_command cb)#
Triggers when a application command is deleted.
-
void discord_set_on_channel_create(struct discord *client, discord_on_channel cb)#
Triggers when a channel is created.
-
void discord_set_on_channel_update(struct discord *client, discord_on_channel cb)#
Triggers when a channel is updated.
-
void discord_set_on_channel_delete(struct discord *client, discord_on_channel cb)#
Triggers when a channel is deleted.
-
void discord_set_on_channel_pins_update(struct discord *client, discord_on_channel_pins_update cb)#
Triggers when some channel pins are updated.
-
void discord_set_on_thread_create(struct discord *client, discord_on_channel cb)#
Triggers when a thread is created.
-
void discord_set_on_thread_update(struct discord *client, discord_on_channel cb)#
Triggers when a thread is updated.
-
void discord_set_on_thread_delete(struct discord *client, discord_on_channel cb)#
Triggers when a thread is deleted.
-
void discord_set_on_guild_create(struct discord *client, discord_on_guild cb)#
Triggers when guild information becomes available.
-
void discord_set_on_guild_update(struct discord *client, discord_on_guild cb)#
Triggers when a guild’s information becomes updated.
-
void discord_set_on_guild_delete(struct discord *client, discord_on_guild_delete cb)#
Triggers when removed from a guild.
-
void discord_set_on_guild_role_create(struct discord *client, discord_on_guild_role cb)#
Triggers when a guild role is created.
-
void discord_set_on_guild_role_update(struct discord *client, discord_on_guild_role cb)#
Triggers when a guild role is updated.
-
void discord_set_on_guild_role_delete(struct discord *client, discord_on_guild_role_delete cb)#
Triggers when a guild role is deleted.
-
void discord_set_on_guild_member_add(struct discord *client, discord_on_guild_member cb)#
Triggers when a guild member is added.
-
void discord_set_on_guild_member_update(struct discord *client, discord_on_guild_member cb)#
Triggers when a guild member is updated.
-
void discord_set_on_guild_member_remove(struct discord *client, discord_on_guild_member_remove cb)#
Triggers when a guild member is removed.
-
void discord_set_on_guild_ban_add(struct discord *client, discord_on_guild_ban cb)#
Triggers when a guild ban is added.
-
void discord_set_on_guild_ban_remove(struct discord *client, discord_on_guild_ban cb)#
Triggers when a guild ban is removed.
-
void discord_set_on_interaction_create(struct discord *client, discord_on_interaction cb)#
Triggers when a interaction is created.
-
void discord_set_on_message_create(struct discord *client, discord_on_message cb)#
Triggers when a message is created.
-
void discord_set_on_message_update(struct discord *client, discord_on_message cb)#
Triggers when a message is updated.
-
void discord_set_on_message_delete(struct discord *client, discord_on_message_delete cb)#
Triggers when a message is deleted.
-
void discord_set_on_message_delete_bulk(struct discord *client, discord_on_message_delete_bulk cb)#
Triggers when a bulk of messages are deleted.
-
void discord_set_on_message_reaction_add(struct discord *client, discord_on_message_reaction_add cb)#
Triggers when a message reaction is added.
-
void discord_set_on_message_reaction_remove(struct discord *client, discord_on_message_reaction_remove cb)#
Triggers when a message reaction is removed.
-
void discord_set_on_message_reaction_remove_all(struct discord *client, discord_on_message_reaction_remove_all cb)#
Triggers when all reaction from some message is removed.
-
void discord_set_on_message_reaction_remove_emoji(struct discord *client, discord_on_message_reaction_remove_emoji cb)#
Triggers when all instances of a particular reaction from some message is removed.
-
void discord_set_on_voice_state_update(struct discord *client, discord_on_voice_state_update cb)#
Triggers when a voice state is updated.
-
void discord_set_on_voice_server_update(struct discord *client, discord_on_voice_server_update cb)#
Triggers when a voice server is updated.
Types#
- group DiscordCallbackTypes
Typedefs
-
typedef void (*discord_on_application_command)(struct discord *client, const struct discord_application_command *app_cmd)#
-
typedef void (*discord_on_channel)(struct discord *client, const struct discord_channel *channel)#
-
typedef void (*discord_on_channel_pins_update)(struct discord *client, u64_snowflake_t guild_id, u64_snowflake_t channel_id, u64_unix_ms_t last_pin_timestamp)#
-
typedef void (*discord_on_guild)(struct discord *client, const struct discord_guild *guild)#
-
typedef void (*discord_on_guild_delete)(struct discord *client, u64_snowflake_t guild_id)#
-
typedef void (*discord_on_guild_role)(struct discord *client, u64_snowflake_t guild_id, const struct discord_role *role)#
-
typedef void (*discord_on_guild_role_delete)(struct discord *client, u64_snowflake_t guild_id, u64_snowflake_t role_id)#
-
typedef void (*discord_on_guild_member)(struct discord *client, u64_snowflake_t guild_id, const struct discord_guild_member *member)#
-
typedef void (*discord_on_guild_member_remove)(struct discord *client, u64_snowflake_t guild_id, const struct discord_user *user)#
-
typedef void (*discord_on_guild_ban)(struct discord *client, u64_snowflake_t guild_id, const struct discord_user *user)#
-
typedef void (*discord_on_interaction)(struct discord *client, const struct discord_interaction *interaction)#
-
typedef void (*discord_on_message)(struct discord *client, const struct discord_message *message)#
-
typedef void (*discord_on_message_delete)(struct discord *client, u64_snowflake_t id, u64_snowflake_t channel_id, u64_snowflake_t guild_id)#
-
typedef void (*discord_on_message_delete_bulk)(struct discord *client, const u64_snowflake_t **ids, u64_snowflake_t channel_id, u64_snowflake_t guild_id)#
-
typedef void (*discord_on_message_reaction_add)(struct discord *client, u64_snowflake_t user_id, u64_snowflake_t channel_id, u64_snowflake_t message_id, u64_snowflake_t guild_id, const struct discord_guild_member *member, const struct discord_emoji *emoji)#
-
typedef void (*discord_on_message_reaction_remove)(struct discord *client, u64_snowflake_t user_id, u64_snowflake_t channel_id, u64_snowflake_t message_id, u64_snowflake_t guild_id, const struct discord_emoji *emoji)#
-
typedef void (*discord_on_message_reaction_remove_all)(struct discord *client, u64_snowflake_t channel_id, u64_snowflake_t message_id, u64_snowflake_t guild_id)#
-
typedef void (*discord_on_message_reaction_remove_emoji)(struct discord *client, u64_snowflake_t channel_id, u64_snowflake_t message_id, u64_snowflake_t guild_id, const struct discord_emoji *emoji)#
-
typedef void (*discord_on_voice_state_update)(struct discord *client, const struct discord_voice_state *voice_state)#
-
typedef void (*discord_on_voice_server_update)(struct discord *client, const char *token, u64_snowflake_t guild_id, const char *endpoint)#
-
typedef void (*discord_on_application_command)(struct discord *client, const struct discord_application_command *app_cmd)#