summaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
authorMatthieuCoder <matthieu@matthieu-dev.xyz>2023-01-05 01:40:50 +0400
committerMatthieuCoder <matthieu@matthieu-dev.xyz>2023-01-05 01:40:50 +0400
commit3fd9efd18867cdf7452e7d0b3cbc3f33d508e699 (patch)
tree7117e4cc69affee70c7b933590cca55c3ddcd21a /src/index.ts
parent9337745c2771aff4a9ec8250fd13021a929fef97 (diff)
documentation and internals overhaul
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/index.ts b/src/index.ts
index 62cfdcb..c95e664 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,23 +1,34 @@
-import { EventClient } from "./events/index";
-import { buildHandler } from "./handler";
+import { Client } from "./sys/events";
+import { buildHandler } from "./sys/handler";
import { commands } from "./commands";
-import { rest } from "./rest";
/**
- * We instanciate our nova broken client.
+ * We instanciate our nova broker client.
*/
-const emitter = new EventClient(rest);
-
-// We register our slash command handler.
-emitter.on("interactionCreate", buildHandler(commands));
-
-// We connect ourselves to the nova nats broker.
-emitter
- .start({
+const emitter = new Client({
+ transport: {
additionalEvents: [],
nats: {
servers: ["localhost:4222"],
},
queue: "nova-worker-common",
- })
- .catch(console.log);
+ },
+ rest: {
+ api: "http://localhost:8090/api",
+ },
+});
+
+// We register our slash command handler.
+emitter.on("interactionCreate", buildHandler(commands));
+
+// Simple message handler
+emitter.on("messageCreate", (message) => {
+ if (message.content === "~ping") {
+ message.client.channels.createMessage(message.channel_id, {
+ content: `Bonjour! <@${message.author.id}>`,
+ });
+ }
+});
+
+// We connect ourselves to the nova nats broker.
+emitter.start().catch(console.log);