command
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#define HAMMY_COMMAND_H
|
#define HAMMY_COMMAND_H
|
||||||
|
|
||||||
#include <concord/discord.h>
|
#include <concord/discord.h>
|
||||||
|
#include <concord/log.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <hammy/types.h>
|
#include <hammy/types.h>
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ hammy_bot_t* hammy_bot_create() {
|
|||||||
return NULL;
|
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)
|
// 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");
|
bot->client = discord_from_json("config.json");
|
||||||
if (!bot->client) {
|
if (!bot->client) {
|
||||||
|
|||||||
+5
-1
@@ -6,7 +6,11 @@
|
|||||||
// Handlers live in src/hammy/commands/. Declared here rather than in a header
|
// 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
|
// so adding a command touches exactly two places: its own .c file and this
|
||||||
// table.
|
// 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.
|
// 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
|
// Copying an entry into the bot's vector is a plain struct copy, and the vector
|
||||||
|
|||||||
Reference in New Issue
Block a user