forked from Firepup650/FireBot
botnick -> nick
This commit is contained in:
parent
26cbe67e6f
commit
f29de567c0
1 changed files with 9 additions and 8 deletions
17
bot.py
17
bot.py
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue