discord_set_data - save a pointer to user arbitrary data#
-
void *discord_set_data(struct discord *client, void *data)#
Store user arbitrary data that can be retrieved by discord_get_data()
Warning
the user should provide his own locking mechanism to protect his data from race conditions
- Parameters:
client – the client created with discord_init()
data – user arbitrary data
- Returns:
pointer to user data
Example#
void on_ready(struct discord *client)
{
char *text = discord_get_data(client);
log_trace("%s", text);
}
int main(void)
{
struct discord *client = discord_init(BOT_TOKEN);
discord_set_on_ready(client, &on_ready);
char text[] = "Hello world!";
discord_set_data(client, text);
discord_run(client);
discord_cleanup(client);
}