This commit is contained in:
2026-08-28 23:01:03 +02:00
parent e6eba80150
commit ecc792bcb6
3 changed files with 6 additions and 7 deletions
+1
View File
@@ -2,6 +2,7 @@
#define HAMMY_COMMAND_H
#include <concord/discord.h>
#include <concord/log.h>
#include <stdbool.h>
#include <hammy/types.h>
-6
View File
@@ -17,12 +17,6 @@ hammy_bot_t* hammy_bot_create() {
return NULL;
}
if (vector_set_destructor(bot->commands, &hammy_command_destroy) < 0) {
vector_destroy(&bot->commands);
free(bot);
return NULL;
}
// Init the discord client - even though this is an owning reference, the main() and others may call functions on it (if we don't stay singlethread anymore then FIX THIS)
bot->client = discord_from_json("config.json");
if (!bot->client) {
+5 -1
View File
@@ -6,7 +6,11 @@
// Handlers live in src/hammy/commands/. Declared here rather than in a header
// so adding a command touches exactly two places: its own .c file and this
// table.
void hammy_cmd_ping(const hammy_job_t* job, struct discord* client);
void hammy_cmd_ping(const hammy_job_t* job, struct discord* client) {
(void)job;
(void)client;
log_info("[command] ping");
}
// The command table. Pure data - no allocation, no lifetime, no destructor.
// Copying an entry into the bot's vector is a plain struct copy, and the vector