feat(bot-echo): make it pop threads to test race-condition
@@ -88,6 +88,16 @@ void on_message_delete_bulk(
discord_create_message(client, channel_id, &params, NULL);
}
+enum discord_event_handling_mode
+on_any_event(
+ struct discord *client,
+ struct discord_user *bot,
+ struct sized_buffer *event_data,
+ enum discord_gateway_events event)
+{
+ return DISCORD_EVENT_CHILD_THREAD;
+}
+
int main(int argc, char *argv[])
{
const char *config_file;
@@ -101,6 +111,9 @@ int main(int argc, char *argv[])
struct discord *client = discord_config_init(config_file);
assert(NULL != client && "Couldn't initialize client");
+ /* trigger event callbacks in a multi-threaded fashion */
+ discord_set_event_handler(client, &on_any_event);
+
discord_set_on_ready(client, &on_ready);
discord_set_on_message_create(client, &on_message_create);
discord_set_on_message_update(client, &on_message_update);
