forked from Firepup650/FireBot
Fewer log methods is better
This commit is contained in:
parent
91161a15f9
commit
cd2e54e7d8
1 changed files with 2 additions and 5 deletions
7
bot.py
7
bot.py
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue