discord_get_self - get the client’s cached user#

const struct discord_user *discord_get_self(struct discord *client)#

Get the client’s cached user.

Warning

the returned structure should NOT be modified

Parameters:

Example#

void on_ready(struct discord *client)
{
  const struct discord_user *bot = discord_get_self(client);
  log_info("Logged in as %s!", bot->username);
}

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