discordjson.h (598B)
1 #ifndef DISCORDJSON_H 2 #define DISCORDJSON_H 3 4 #include <stdbool.h> 5 6 #define ID_MAX 64 7 #define DISCORD_MESSAGE_MAX 256 8 9 typedef struct 10 { 11 int op; 12 long seq; 13 long heartbeat_ms; 14 bool heartbeat_requested; 15 bool ready; 16 bool has_message; 17 char message_id[ID_MAX]; 18 char channel_id[ID_MAX]; 19 char content[DISCORD_MESSAGE_MAX]; 20 char timestamp[64]; 21 } DiscordEvent; 22 23 char * build_identify_json(const char *token, const int intents); 24 char * build_heartbeat_json(const long seq); 25 char * build_message_json(const char *content); 26 bool parse_gateway_json(const char *json_string, DiscordEvent *event); 27 28 #endif