Example #1
0
 def __init__(self, pollobj, **kwargs):
     IRCClient.__init__(self, **kwargs)
     self.pollobj = pollobj
     self.add_dispatch_in(numerics.RPL_WELCOME, 1000, self.on_welcome)
     self.add_dispatch_in('PRIVMSG', 1000, self.respond)
Example #2
0
    try:
        generator = irc.get_lines()
        for line in generator:
            if line and line.command == 'PRIVMSG':
                user_check(irc, line)
    except Exception as e:
        if not irc.connected:
            print("Disconnected", str(e))
            sleep(5)
        else:
            # Blargh
            print("Probable non-fatal exception received:")
            traceback.print_exc()
            if recurse >= 10:
                print("Recursion depth exceeded for errors")
                irc.close()
                raise
            recurse += 1
            run_irc(irc, recurse)

irc = IRCClient(nick=config.nick, user=config.user, host=config.server,
                port=config.port, realname=config.realname,
                channels=config.channels)
irc.connect()

g1 = spawn(run_irc, irc)
g2 = spawn(exception_wrapper, irc=irc)

joinall((g1, g2))