diff options
author | Matt Arnold <matt@thegnuguru.org> | 2022-03-20 14:40:12 -0400 |
---|---|---|
committer | Matt Arnold <matt@thegnuguru.org> | 2022-03-20 14:40:12 -0400 |
commit | 6acd507b2b425920b35572fc3bf087e925385f02 (patch) | |
tree | e57853a9343f23d5bd02a80c5d275228a99825ea | |
parent | a0b1f7f4c53eb0c7423f457ea617e687ca09bc1f (diff) |
Make bot empty the queue on every ping piusbird_public
-rw-r--r-- | client.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/client.py b/client.py index 78fb8dc..d821445 100644 --- a/client.py +++ b/client.py @@ -35,6 +35,8 @@ with open('config.json') as f: jld = f.read() config = json.loads(jld) +NODEAMON = config['nodaemon'] + uds_addr = config['uds'] try: @@ -58,7 +60,7 @@ def uds_thread(in_q): connection.sendall(bytes("ACK" + LINEEND, 'UTF-8')) in_q.put_nowait(data) else: - connection.sendall(bytes("NACK" + LINEEND)) + connection.sendall(bytes("NACK" + LINEEND, 'UTF-8')) continue except Exception as e: logging.exception(str(e)) @@ -127,12 +129,12 @@ def do_main_loop(): r = generate_response(text[0],text[2][1]) if r is not None: irc.send_privmsg(config['channel'],r) - try: - d = q.get_nowait() - irc.send_privmsg(config['channel'], d.decode("UTF-8")) - except Empty: - printred("Empty") - + + if text[1] == "PING": + while not q.empty(): + d = q.get_nowait() + irc.send_privmsg(config['channel'], d.decode("UTF-8")) + except IRCError as e: |