static void
{
if (guild) {
printf(
"message received in guild '%s'\n", guild->
name);
}
if (cached_message) {
.content = cached_message->content,
},
NULL);
}
}
int
main(int argc, char *argv[])
{
const char *const config_file = argc > 1 ? argv[1] : "../config.json";
}
CCORDcode ccord_global_init()
Initialize global shared-resources not API-specific.
void ccord_global_cleanup()
Cleanup global shared-resources.
Public functions and datatypes.
CCORDcode discord_create_message(struct discord *client, u64snowflake channel_id, struct discord_create_message *params, struct discord_ret_message *ret)
Post a message to a guild text or DM channel.
const struct discord_message * discord_cache_get_channel_message(struct discord *client, u64snowflake channel_id, u64snowflake message_id)
Get a message from cache, only if locally available in RAM.
void discord_cache_enable(struct discord *client, enum discord_cache_options options)
const struct discord_guild * discord_cache_get_guild(struct discord *client, u64snowflake guild_id)
Get a guild from cache, only if locally available in RAM.
@ DISCORD_CACHE_GUILDS
Definition: discord-cache.h:17
@ DISCORD_CACHE_MESSAGES
Definition: discord-cache.h:16
void discord_cleanup(struct discord *client)
Free a Discord Client handle.
CCORDcode discord_run(struct discord *client)
Start a connection to the Discord Gateway.
void discord_unclaim(struct discord *client, const void *data)
Unclaim ownership of a resource provided by Concord.
struct discord * discord_config_init(const char config_file[])
Create a Discord Client handle by a config.json file.
void discord_add_intents(struct discord *client, uint64_t code)
Subscribe to Discord Events.
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.
#define DISCORD_GATEWAY_MESSAGE_CONTENT
Definition: gateway.h:41
Definition: channel.h:683
char * name
Definition: guild.h:93
Definition: channel.h:195
u64snowflake guild_id
Definition: channel.h:201
u64snowflake id
Definition: channel.h:197
struct discord_user * author
Definition: channel.h:203
u64snowflake channel_id
Definition: channel.h:199
bool bot
Definition: user.h:79
The Discord client handler.
Definition: discord-internal.h:1190