Example #1
0
 def list(self, c, e, args):
     if len(args) and args[0] == 'modules':
         ms = self.bot.modules.values()
         response = '\x02Active:\x0f ' + ', '.join(x.get_name() for x in ms if x.active)
         response += '. \x02Inactive:\x0f ' + ', '.join(x.get_name() for x in ms if not x.active)
         c.privmsg(get_target(c, e), response)
     elif len(args) and args[0] == 'channels':
         c.privmsg(get_target(c, e), '\x02Channels:\x0f ' + ', '.join(self.bot.channels.keys()) + '.')
Example #2
0
 def update(self, c, e, args):
     if not self.is_authorized(c, e, 5):
         c.privmsg(get_target(c, e), "You don't have permission to update!")
         return
     try:
         response = check_output(['git', 'pull'])
         for msg in response.decode('utf-8').split("\n"):
             c.privmsg(get_target(c, e), msg)
     except CalledProcessError as ex:
         c.privmsg(get_target(c, e), "Error on calling 'git pull': {}".format(ex.output))
Example #3
0
 def unload(self, c, e, args):
     if not self.is_authorized(c, e, 5):
         c.privmsg(get_target(c, e), "You don't have permission to unload modules!")
         return
     modules = itertools.chain.from_iterable([n.split(',') for n in args])
     for m in modules:
         try:
             self.bot.unload_module(m)
             c.privmsg(get_target(c, e), '\x02{}\x0f unloaded successfully!'.format(m))
         except SakariException as ex:
             c.privmsg(get_target(c, e), "Couldn't unload \x02{}\x0f: {}".format(m, ex.error))
Example #4
0
 def die(self, c, e, args):
     if not self.is_authorized(c, e, 5):
         c.privmsg(get_target(c, e), "You don't have permission to let me die!")
         return
     self.bot.die()