botnick -> nick

This commit is contained in:
Firepup Sixfifty 2023-11-05 21:08:47 -06:00
parent 26cbe67e6f
commit f29de567c0
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA

17
bot.py
View file

@ -18,13 +18,14 @@ class bot:
self.interval = (
servers[server]["interval"] if "interval" in servers[server] else 50
)
self.nick = "FireBot"
self.prefix = "."
self.rebt = "fire"
self.gblrebt = "all"
self.lrebt = 7 + len(rebt)
self.lgblrebt = 7 + len(gblrebt)
self.adminnames = servers[server]["admins"]
self.exitcode = f"bye {botnick.lower()}"
self.exitcode = f"bye {self.nick.lower()}"
self.np = re.compile(npbase.replace("MAX", f"{nicklen}"))
self.queue = []
self.sock = socket(AF_INET, SOCK_STREAM)
@ -33,11 +34,11 @@ class bot:
def connect(self) -> None:
self.log(f"Joining {server}...")
self.sock.connect((self.address, self.port))
self.send(f"USER {botnick} {botnick} {botnick} {botnick}\n")
self.send(f"NICK {botnick}\n")
self.send(f"USER {self.nick} {self.nick} {self.nick} {self.nick}\n")
self.send(f"NICK {self.nick}\n")
while (
ircmsg.find("MODE " + botnick) == -1
and ircmsg.find("PRIVMSG " + botnick) == -1
ircmsg.find("MODE " + self.nick) == -1
and ircmsg.find("PRIVMSG " + self.nick) == -1
):
ircmsg = self.recv().decode()
if ircmsg != "":
@ -48,9 +49,9 @@ class bot:
self.log(f"NICKLEN set to {nicklen}")
elif ircmsg.find("Nickname") != -1:
self.log("Nickname in use", "WARN")
self.botnick = f"{botnick}{r.randint(0,1000)}"
self.send(f"NICK {botnick}\n")
self.log(f"botnick is now {botnick}")
self.nick = f"{self.nick}{r.randint(0,1000)}"
self.send(f"NICK {self.nick}\n")
self.log(f"nick is now {self.nick}")
elif ircmsg.startswith("PING "):
self.ping(ircmsg)
elif len(ircmsg.split("\x01")) == 3: