aboutsummaryrefslogtreecommitdiffstats
path: root/example
diff options
context:
space:
mode:
authorturret <turret@duck.com>2024-03-30 20:35:30 -0500
committerturret <turret@duck.com>2024-03-30 20:35:30 -0500
commit2fb619ed6eac19afd7ed3b2c7baa4adc253f418e (patch)
tree521d3ec070fa39c398ec2d5835cac22bcd95190a /example
parent80a67b7d20393a29aa5d2cb92197f3381be7fd96 (diff)
downloaddiscord-bot-skeleton-2fb619ed6eac19afd7ed3b2c7baa4adc253f418e.tar.gz
discord-bot-skeleton-2fb619ed6eac19afd7ed3b2c7baa4adc253f418e.tar.bz2
discord-bot-skeleton-2fb619ed6eac19afd7ed3b2c7baa4adc253f418e.zip
net: event handler
in subsys.h: include init.h to ensure l5_initcall availability also: add example/ directory to provide some user-code in the skeleton (will likely be made defunct as i make the remainder of the skeleton, such as a /ping command and user action and maybe some buttons, which will require more organisation)
Diffstat (limited to 'example')
-rw-r--r--example/hello.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/example/hello.c b/example/hello.c
new file mode 100644
index 0000000..f192a52
--- /dev/null
+++ b/example/hello.c
@@ -0,0 +1,17 @@
+#include <stdlib.h>
+
+#include <cJSON.h>
+
+#include <dbs/event.h>
+#include <dbs/log.h>
+
+int hello(cJSON *data)
+{
+ char *string = cJSON_Print(data);
+ print("hello, world!");
+ print("hello data: %s", string);
+ free(string);
+
+ return 0;
+}
+declare_event(HELLO, hello);