Exemple #1
0
    def __init__(self, client):
        DefaultBotCommandHandler.__init__(self, client)

        working_set = getPkgResourcesWorkingSet()
        extendCommandClass(working_set, self, 'oyoyo_bot.commands', client)  

        for command, fnc in config['commands'].iteritems():
            ep = pkg_resources.EntryPoint.parse("%s = %s" % (command, fnc))
            if not ep.dist: 
                ep.dist = pkg_resources.get_distribution('oyoyo_bot')
            extendCommandClassWithEP(self, ep, client)
Exemple #2
0
    def run(self, command, sender, dest, *arg):
        log.info("running command sender=%s, dest=%s, command=%s, arg=%s",
            sender, dest, command, arg)

        if (hasattr(f, 'auth') and 
            not self.client.command_handler.auth(self, command, sender, dest, *arg)):
                helpers.msg(self.client, dest, 
                    "you do not have the required permissions")
                return

        try:
            DefaultBotCommandHandler.run(self, command, sender, dest, *arg)
        except CommandError, e:
            helpers.msg(self.client, dest, str(e))
Exemple #3
0
 def getVisibleCommands(self, obj=None):
     obj = obj or self
     cmds = DefaultBotCommandHandler.getVisibleCommands(self, obj)
     if config['help'].as_bool('hide_auth_commands'):
         return [c for c in cmds if not hasattr(getattr(obj, c), 'auth')]
     else:
         return ["@%s"%c if hasattr(getattr(obj, c), 'auth') else c
                 for c in cmds]