version.py 592 B

12345678910111213141516171819202122
  1. import version
  2. from event import Event
  3. try:
  4. from basemodule import BaseModule
  5. except ImportError:
  6. from modules.basemodule import BaseModule
  7. class Version(BaseModule):
  8. def post_init(self):
  9. version_event = Event("__.version__")
  10. version_event.define(msg_definition="^\.version")
  11. version_event.subscribe(self)
  12. # register ourself to our new custom event
  13. self.bot.register_event(version_event, self)
  14. def handle(self, event):
  15. self._version(event.channel)
  16. def _version(self, channel):
  17. self.say(channel,"I'm running pybot version " + version.__version__)