From a45581bb0a6985da2058f24d253b30600aabcd1c Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Sat, 4 Nov 2023 21:45:21 -0500 Subject: [PATCH] Fixing loopholes --- ircbot.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ircbot.py b/ircbot.py index ce5470a..4b431bb 100644 --- a/ircbot.py +++ b/ircbot.py @@ -257,7 +257,7 @@ def op(name, chan): def main(): try: - global ircmsg, channels, e, gmode, prefix, rebt, gblrebt, lrebt, lgblrebt, blanks + global channels, e, gmode, prefix, rebt, gblrebt, lrebt, lgblrebt, blanks log("Starting connection..", server) joinserver() if "pass" in servers[server]: @@ -266,19 +266,19 @@ def main(): for chan in channels: joinchan(chan, "null", channels, False) while 1: - global ircmsg, gmode + global gmode raw = recv() ircmsg = raw.decode() if ircmsg == "": exit("Probably a netsplit") else: print(raw.lazy_decode(), sep="\n") - if ircmsg.find("PRIVMSG") != -1: - try: - ircmsg.split("PRIVMSG", 1)[1] - except IndexError: - log("Fake message recieved", server, "WARN") - continue + action = "Unknown" + try: + action = ircmsg.split(" ", 2)[1].strip() + except IndexError: + pass + if action == "PRIVMSG": # Format of ":[Nick]![ident]@[host|vhost] PRIVMSG [channel] :[message]” name = ircmsg.split("!", 1)[0][1:] helpErr = False