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