From b4f8450e7d5a59691ecae21e20e7844fab5ee64c Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Tue, 14 Nov 2023 16:13:26 -0600 Subject: [PATCH] SAFELY decode messages. (Silently ignore invalid bytes) --- bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bot.py b/bot.py index 9c2eecf..78c4b7a 100644 --- a/bot.py +++ b/bot.py @@ -50,7 +50,7 @@ class bot(bare.bot): self.send(f"NICK {self.nick}\n") ircmsg = "" while True: - ircmsg = self.recv().decode() + ircmsg = self.recv().safe_decode() if ircmsg != "": code = 0 try: @@ -100,7 +100,7 @@ class bot(bare.bot): return self.send(f"JOIN {chan}\n") while True: - ircmsg = self.recv().decode() + ircmsg = self.recv().safe_decode() if ircmsg != "": code = 0 try: @@ -203,7 +203,7 @@ class bot(bare.bot): self.join(chan, "null", False) while 1: raw = self.recv() - ircmsg = raw.decode() + ircmsg = raw.safe_decode() if ircmsg == "": self.exit("Probably a netsplit") else: