Beispiel #1
0
    def wrapped(self, origin, text, match):
        sender = origin.sender or text
        delegate = {
            'reply': lambda msg, target=origin.nick: self.msg(sender, msg, target=target),
            'say': lambda msg, target=None: self.msg(sender, msg, target=target),
            'do': lambda msg: self.action(sender, msg),
        }

        return decorate(self, delegate)
Beispiel #2
0
    def __init__(self, nick, name, channels, password=None):
        asynchat.async_chat.__init__(self)
        self.set_terminator(b'\n')
        self.buffer = b''

        self.nick = nick
        self.user = nick
        self.name = name
        self.password = password

        self.verbose = True
        self.channels = channels or []
        self.stack = []

        self.sending = threading.RLock()

        proto_func = lambda attr: functools.partial(proto.commands[attr], self)
        proto_map = {attr: proto_func(attr) for attr in proto.commands}
        self.proto = decorate(object(), proto_map)