command
This commit is contained in:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user