nixnest / scepter

Spiritual successor to Nixbot
https://discord.gg/g3gD5xd
MIT License
6 stars 5 forks source link

[WIP] Add join messages module #2

Closed tadeokondrak closed 4 years ago

ldelelis commented 5 years ago

What's missing here is handling the events export right?

tadeokondrak commented 5 years ago

That's what's blocking this, but the set join message isn't done yet either.

ldelelis commented 5 years ago

Copying the event loader snippet here before it gets buried in chat any further and we all forget about it:

--- a/scepter.js
+++ b/scepter.js
@@ -41,6 +41,11 @@ const loadedModules = {}

 const loadModule = name => {
   const module = require(`./modules/${name}`)
+  if (module.events != null) {
+    for (let event of module.events) {
+      client.on(event.trigger, event.run)
+    }
+  }
   loadedModules[name] = module
 }
ldelelis commented 5 years ago

Patch with the rewritten typescript module

ldelelis commented 5 years ago

This is now unblocked right? #20 added event handling.