Example #1
0
def test_strip():
    s = ":\x01\x02test\x02\x01"
    s = strip(s)
    assert s == "\x01\x02test\x02\x01"

    s = ":\x01\x02test\x02\x01"
    s = strip(s, color=True)
    assert s == "test"
Example #2
0
def test_strip():
    s = ":\x01\x02test\x02\x01"
    s = strip(s)
    assert s == "\x01\x02test\x02\x01"

    s = ":\x01\x02test\x02\x01"
    s = strip(s, color=True)
    assert s == "test"
Example #3
0
    def _on_wapi_event(self, event, *args, **kwargs):
        if event.channels != (self.channel,):
            return

        command = event.name

        if command not in self.parent.bot.command:
            yield log("Unknown Command: {0:s}", command)
        else:
            args = " ".join(args)
            event = cmd.create(command, None, None, args)

            try:
                value = yield self.call(event, "commands")
                yield "\n".join(
                    escape(strip(msg))
                    for msg in wrapvalue(command, event, value.value)
                )
            except Exception as error:
                message = "{0:s} {1:s}".format(command, " ".join(args))
                yield log("ERROR: {0:s}: ({1:s})", error, repr(message))
                log(format_exc())