Exemplo n.º 1
0
 def handle_privmsg(self, msg):
     if not self.auth(msg):
         self.parent.privmsg(msg.replyto, "%s: I don't know you." % (msg.nick))
         return
     argv = msg.data_segment.split(" ")
     if self.m.group(2) == "reload":
         status = self.parent.reload_modules()
         if status:
             self.parent.privmsg(msg.replyto, "%s: Reload Complete." % (msg.nick))
         else:
             t = WriteThing(self.parent, msg.nick)
             self.parent.privmsg(msg.replyto, "%s: Reload Failed! (pm for stackdump)" % (msg.nick))
             # TODO- this isn't actually the error in question. Lol.
             #traceback.print_tb(status, file=t)
             traceback.print_exception(*status.args, file=t)
     elif self.m.group(2) == "update":
         self.parent.privmsg(msg.replyto, ourgit.update_modules())
     elif self.m.group(2) == "system-update":
         self.parent.privmsg(msg.replyto, ourgit.update_git())
     elif self.m.group(2) == "version":
         self.parent.privmsg(msg.replyto, "%(nick)s: %(version)s on %(branch)s" %
                 {   "nick": msg.nick,
                     "version": ourgit.version(),
                     "branch": ourgit.current_branch()})
     elif self.m.group(2) == "checkout":
         self.parent.privmsg(msg.replyto, "Not implemented LOL!")
Exemplo n.º 2
0
 def handle_privmsg(self, msg):
     if not self.auth(msg):
         self.parent.privmsg(msg.replyto, "%s: I don't know you." % (msg.nick))
         return
     argv = msg.data_segment.split(" ")
     # TODO - Second argument for channel.
     if argv[0] == "!version":
         self.parent.privmsg(msg.replyto, "Modules: %(modv)s, Global: %(gvs)s" % {
                     'modv': VERSION,
                     'gvs': ourgit.version()
                     })
     elif argv[0] == "!nick":
         self.parent.privmsg(msg.replyto, "%s: As far as I know, my nick is %s" % (msg.nick, self.parent.nick))
     elif argv[0] == "!uname":
         self.parent.privmsg(msg.replyto, " ".join(os.uname()))
     elif argv[0] == "!dumpchans":
         for i in self.parent.dump_channel_data():
             self.parent.privmsg(msg.replyto, i)
     elif argv[0] == "!argv":
         self.parent.privmsg(msg.replyto, str(sys.argv))
     else:
         self.parent.privmsg(msg.replyto, "I have NFI how you managed this.")