Fewer log methods is better

This commit is contained in:
Firepup Sixfifty 2023-11-05 20:24:43 -06:00
parent 91161a15f9
commit cd2e54e7d8
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA

7
bot.py
View file

@ -47,7 +47,7 @@ class bot:
self.np = re.compile(npbase.replace("MAX", f"{nicklen}")) self.np = re.compile(npbase.replace("MAX", f"{nicklen}"))
self.log(f"NICKLEN set to {nicklen}") self.log(f"NICKLEN set to {nicklen}")
elif ircmsg.find("Nickname") != -1: elif ircmsg.find("Nickname") != -1:
self.warn("Nickname in use") self.log("Nickname in use", "WARN")
self.botnick = f"{botnick}{r.randint(0,1000)}" self.botnick = f"{botnick}{r.randint(0,1000)}"
self.send(f"NICK {botnick}\n") self.send(f"NICK {botnick}\n")
self.log(f"botnick is now {botnick}") self.log(f"botnick is now {botnick}")
@ -73,12 +73,9 @@ class bot:
return bytes(self.queue.pop(0)) return bytes(self.queue.pop(0))
return data return data
def log(self, message: object) -> None: def log(self, message: object, level: str = "LOG") -> None:
log(message, self.server) log(message, self.server)
def warn(self, message: object) -> None:
log(message, self.server, "WARN")
def exit(message: object) -> NoReturn: def exit(message: object) -> NoReturn:
log(message, self.server, "EXIT") log(message, self.server, "EXIT")
exit(1) exit(1)