discord_init - create a Discord client handle#

struct discord *discord_init(const char token[])#

Create a Discord Client handle by its token.

See also

discord_get_logconf() to configure logging behavior

Parameters:
  • token – the bot token

Returns:

the newly created Discord Client handle

Example#

void on_ready(struct discord *client)
{
  log_info("Up and running!");
}

int main(void)
{
  struct discord *client = discord_init(BOT_TOKEN);
  discord_set_on_ready(client, &on_ready);
  discord_run(client);
  discord_cleanup(client);
}