|
Concord - C Discord API library
A Discord API wrapper library written in C
|
Client functions and datatypes. More...
Modules | |
| Caching | |
| Caching API supported by Concord. | |
| Commands | |
| Requests made by the client to the Gateway socket. | |
| Events | |
| Events sent over the Gateway socket to the client. | |
| Timer | |
| Schedule callbacks to be called in the future. | |
Data Structures | |
| struct | discord |
| The Discord client handler. More... | |
Macros | |
| #define | discord_claim(client, data) (__discord_claim(client, data), data) |
| Claim ownership of a resource provided by Concord. More... | |
Functions | |
| void | __discord_claim (struct discord *client, const void *data) |
| void | discord_unclaim (struct discord *client, const void *data) |
| Unclaim ownership of a resource provided by Concord. More... | |
| struct discord * | discord_init (const char token[]) |
| Create a Discord Client handle by its token. More... | |
| struct discord * | discord_config_init (const char config_file[]) |
Create a Discord Client handle by a config.json file. More... | |
| struct ccord_szbuf_readonly | discord_config_get_field (struct discord *client, char *const path[], unsigned depth) |
| Get the contents from the config file field. More... | |
| struct discord * | discord_clone (const struct discord *orig) |
| Clone a discord client. More... | |
| void | discord_cleanup (struct discord *client) |
| Free a Discord Client handle. More... | |
| const struct discord_user * | discord_get_self (struct discord *client) |
| Get the client's cached user. More... | |
| CCORDcode | discord_run (struct discord *client) |
| Start a connection to the Discord Gateway. More... | |
| void | discord_shutdown (struct discord *client) |
| Gracefully shutdown an ongoing Discord connection. More... | |
| void | discord_reconnect (struct discord *client, bool resume) |
| Gracefully reconnects an ongoing Discord connection. More... | |
| void * | discord_set_data (struct discord *client, void *data) |
| Store user arbitrary data that can be retrieved by discord_get_data() More... | |
| void * | discord_get_data (struct discord *client) |
| Receive user arbitrary data stored with discord_set_data() More... | |
| int | discord_get_ping (struct discord *client) |
| Get the client WebSockets ping. More... | |
| uint64_t | discord_timestamp (struct discord *client) |
| Get the current timestamp (in milliseconds) More... | |
| uint64_t | discord_timestamp_us (struct discord *client) |
| Get the current timestamp (in microseconds) More... | |
| struct logconf * | discord_get_logconf (struct discord *client) |
| Retrieve client's logging module for configuration purposes. More... | |
| struct io_poller * | discord_get_io_poller (struct discord *client) |
| get the io_poller used by the discord client More... | |
Client functions and datatypes.
| #define discord_claim | ( | client, | |
| data | |||
| ) | (__discord_claim(client, data), data) |
Claim ownership of a resource provided by Concord.
| client | the client initialized with discord_init() |
| data | a resource provided by Concord |
data (for one-liners) | void __discord_claim | ( | struct discord * | client, |
| const void * | data | ||
| ) |
| void discord_unclaim | ( | struct discord * | client, |
| const void * | data | ||
| ) |
Unclaim ownership of a resource provided by Concord.
| client | the client initialized with discord_init() |
| data | a resource provided by Concord, that has been previously claimed with discord_claim() |
| struct discord * discord_init | ( | const char | token[] | ) |
Create a Discord Client handle by its token.
| token | the bot token |
| struct discord * discord_config_init | ( | const char | config_file[] | ) |
Create a Discord Client handle by a config.json file.
| config_file | the config.json file name |
| struct ccord_szbuf_readonly discord_config_get_field | ( | struct discord * | client, |
| char *const | path[], | ||
| unsigned | depth | ||
| ) |
Get the contents from the config file field.
| client | the client created with discord_config_init() |
| path | the JSON key path |
| depth | the path depth |
Clone a discord client.
Should be called before entering a thread, to ensure each thread has its own client instance with unique buffers, url and headers
| orig | the original client created with discord_init() |
| void discord_cleanup | ( | struct discord * | client | ) |
Free a Discord Client handle.
| client | the client created with discord_init() |
| const struct discord_user * discord_get_self | ( | struct discord * | client | ) |
Get the client's cached user.
| client | the client created with discord_init() |
Start a connection to the Discord Gateway.
| client | the client created with discord_init() |
| void discord_shutdown | ( | struct discord * | client | ) |
Gracefully shutdown an ongoing Discord connection.
| client | the client created with discord_init() |
| void discord_reconnect | ( | struct discord * | client, |
| bool | resume | ||
| ) |
Gracefully reconnects an ongoing Discord connection.
| client | the client created with discord_init() |
| resume | true to attempt to resume to previous session, false restart a fresh session |
| void * discord_set_data | ( | struct discord * | client, |
| void * | data | ||
| ) |
Store user arbitrary data that can be retrieved by discord_get_data()
| client | the client created with discord_init() |
| data | user arbitrary data |
| void * discord_get_data | ( | struct discord * | client | ) |
Receive user arbitrary data stored with discord_set_data()
| client | the client created with discord_init() |
| int discord_get_ping | ( | struct discord * | client | ) |
Get the client WebSockets ping.
| client | the client created with discord_init() |
| uint64_t discord_timestamp | ( | struct discord * | client | ) |
Get the current timestamp (in milliseconds)
| client | the client created with discord_init() |
| uint64_t discord_timestamp_us | ( | struct discord * | client | ) |
Get the current timestamp (in microseconds)
| client | the client created with discord_init() |
Retrieve client's logging module for configuration purposes.
| client | the client created with discord_init() |
| struct io_poller * discord_get_io_poller | ( | struct discord * | client | ) |
get the io_poller used by the discord client
| client | the client created with discord_init() |