diff --git a/bot.py b/bot.py index eca3bab..6b80937 100644 --- a/bot.py +++ b/bot.py @@ -58,7 +58,7 @@ class bot(bare.bot): except (IndexError, ValueError): self.log("Err - No code") print(bytes(ircmsg).lazy_decode()) - if ircmsg.find("NICKLEN=") != -1: + if "NICKLEN" in ircmsg: self.nicklen = int(ircmsg.split("NICKLEN=")[1].split(" ")[0]) self.log(f"NICKLEN set to {self.nicklen}") if code == 433: @@ -69,14 +69,14 @@ class bot(bare.bot): if code in [376, 422]: self.log(f"Success by code: {code}") break - if ircmsg.find(f"MODE {self.nick}") >= 0 or ircmsg.find(f"PRIVMSG {self.nick}") >= 0: + if "MODE" in ircmsg or "PRIVMSG" in ircmsg: self.log(f"Success by MSG/MODE") break if ircmsg.startswith("PING "): self.ping(ircmsg) if len(ircmsg.split("\x01")) == 3: handlers.CTCP(self, ircmsg) - if ircmsg.find("Closing Link") != -1: + if "Closing link" in ircmsg: self.exit("Closing Link") else: self.exit("Lost connection to the server") diff --git a/commands.py b/commands.py index de40e6c..c69f842 100644 --- a/commands.py +++ b/commands.py @@ -60,7 +60,7 @@ def help(bot: bare.bot, chan: str, name: str, message: str) -> None: if (name.startswith("saxjax") and bot.server == "efnet") or ( name == "ReplIRC" and bot.server == "replirc" ): - if message.find("<") != -1 and message.find(">") != -1: + if "<" in message and "<" in message: helpErr = True elif name.endswith("dsc"): helpErr = True diff --git a/handlers.py b/handlers.py index 0f3d898..80dde6d 100644 --- a/handlers.py +++ b/handlers.py @@ -47,7 +47,7 @@ def PRIVMSG(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str] if (name.startswith("saxjax") and bot.server == "efnet") or ( name == "ReplIRC" and bot.server == "replirc" ) or (name == "FirePyLink_" and bot.server == "ircnow"): - if msg.find("<") != -1 and msg.find(">") != -1: + if "<" in msg and ">" in msg: Nname = msg.split("<", 1)[1].split(">", 1)[0].strip() if name == "ReplIRC": name = Nname[4:]