test.py 386 B

1234567891011121314
  1. from event import Event
  2. from basemodule import BaseModule
  3. class Test(BaseModule):
  4. def post_init(self):
  5. custom = Event("__.custom__")
  6. custom.define(msg_definition="^\.custom")
  7. custom.subscribe(self)
  8. # register ourself to our new custom event
  9. self.bot.register_event(custom, self)
  10. def handle(self, event):
  11. self.say(event.channel, "custom event caught!")