Ejemplo n.º 1
0
Archivo: bot.py Proyecto: LuccoJ/phenny
    def call(self, func, origin, phenny, input):
        def report(text):
            for admin in phenny.admins:
                self.msg(admin, text)

        try:
            rephrase_errors(func, phenny, input)
        except GrumbleError as e:
            report(str(e))
        except Exception as e:
            self.error(report)
Ejemplo n.º 2
0
def module_control(phenny, module, func):
    if not hasattr(module, func):
        return True

    try:
        rephrase_errors(getattr(module, func), phenny)
        return True
    except GrumbleError as e:
        desc = str(e)
    except Exception as e:
        desc = traceback.format_exc()

    name = os.path.basename(module.__file__)
    logger.error("Error during %s of %s module:\n%s" % (func, name, desc))
    return False
Ejemplo n.º 3
0
    def call(self, func, origin, phenny, input):
        def report(*lines, verbose=True):
            for admin in self.config.admins:
                if verbose:
                    self.msg(admin, "Error in '{}/{}' with input '{}'"
                                    .format(func.__module__, func.__name__, input.bytes))
                for line in lines:
                    self.msg(admin, line)

        try:
            rephrase_errors(func, phenny, input)
        except GrumbleError as e:
            report(str(e), verbose=False)
        except Exception as e: 
            self.error(report)