change concord starter code to my style

This commit is contained in:
sam 2024-03-01 11:56:39 +13:00
parent ae59db9673
commit 46c887b19a

View file

@ -6,11 +6,11 @@
sqlite3* db; sqlite3* db;
void on_ready(struct discord *client, const struct discord_ready *msg) { void on_ready(struct discord* client, const struct discord_ready* event) {
log_info("Logged in as %s!", msg->user->username); log_info("Logged in as %s!", event->user->username);
} }
void on_message(struct discord *client, const struct discord_message *msg) { void on_message(struct discord* client, const struct discord_message* msg) {
if(msg->type == DISCORD_MESSAGE_REPLY && msg->content != NULL) { if(msg->type == DISCORD_MESSAGE_REPLY && msg->content != NULL) {
char* error; char* error;
if(sqlite3_exec(db, sqlite3_mprintf( if(sqlite3_exec(db, sqlite3_mprintf(
@ -36,7 +36,7 @@ int main(void) {
log_error(error); log_error(error);
} }
struct discord *client = discord_config_init("config.json"); struct discord* client = discord_config_init("config.json");
discord_add_intents(client, DISCORD_GATEWAY_MESSAGE_CONTENT); discord_add_intents(client, DISCORD_GATEWAY_MESSAGE_CONTENT);
discord_set_on_ready(client, &on_ready); discord_set_on_ready(client, &on_ready);
discord_set_on_message_create(client, &on_message); discord_set_on_message_create(client, &on_message);