forked from Firepup650/FireBot
Formatting
This commit is contained in:
parent
b6c58e66fc
commit
b0cd9c36f1
2 changed files with 17 additions and 11 deletions
24
bot.py
24
bot.py
|
@ -45,7 +45,11 @@ class bot(bare.bot):
|
|||
if "interval" in conf.servers[server]
|
||||
else 50
|
||||
)
|
||||
self.nick = conf.servers[server]["nick"] if "nick" in conf.servers[server] else "FireBot"
|
||||
self.nick = (
|
||||
conf.servers[server]["nick"]
|
||||
if "nick" in conf.servers[server]
|
||||
else "FireBot"
|
||||
)
|
||||
self.queue: list[bbytes] = [] # pyright: ignore [reportInvalidTypeForm]
|
||||
self.sock = socket(AF_INET, SOCK_STREAM)
|
||||
self.current = "user"
|
||||
|
@ -53,13 +57,19 @@ class bot(bare.bot):
|
|||
conf.servers[server]["threads"] if "threads" in conf.servers[server] else []
|
||||
)
|
||||
self.onIdntCmds = (
|
||||
conf.servers[server]["onIdntCmds"] if "onIdntCmds" in conf.servers[server] else []
|
||||
conf.servers[server]["onIdntCmds"]
|
||||
if "onIdntCmds" in conf.servers[server]
|
||||
else []
|
||||
)
|
||||
self.onJoinCmds = (
|
||||
conf.servers[server]["onJoinCmds"] if "onJoinCmds" in conf.servers[server] else []
|
||||
conf.servers[server]["onJoinCmds"]
|
||||
if "onJoinCmds" in conf.servers[server]
|
||||
else []
|
||||
)
|
||||
self.onStrtCmds = (
|
||||
conf.servers[server]["onStrtCmds"] if "onStrtCmds" in conf.servers[server] else []
|
||||
conf.servers[server]["onStrtCmds"]
|
||||
if "onStrtCmds" in conf.servers[server]
|
||||
else []
|
||||
)
|
||||
self.lastfmLink = conf.lastfmLink
|
||||
self.log(f"Start init for {self.server}")
|
||||
|
@ -67,14 +77,12 @@ class bot(bare.bot):
|
|||
def connect(self) -> None:
|
||||
self.log(f"Joining {self.server}...")
|
||||
self.sock.connect((self.address, self.port))
|
||||
self.send("\n") # Just for sanity
|
||||
self.send("\n") # Just for sanity
|
||||
if self.onStrtCmds:
|
||||
for cmd in self.onStrtCmds:
|
||||
self.send(cmd + "\n")
|
||||
if "serverPass" in conf.servers[self.server]:
|
||||
self.send(
|
||||
f"PASS {conf.servers[self.server]['serverPass']}\n"
|
||||
)
|
||||
self.send(f"PASS {conf.servers[self.server]['serverPass']}\n")
|
||||
self.send(f"USER {self.nick} {self.nick} {self.nick} {self.nick}\n")
|
||||
self.send(f"NICK {self.nick}\n")
|
||||
ircmsg = ""
|
||||
|
|
|
@ -54,9 +54,7 @@ servers: dict[str, dict[str, Any]] = {
|
|||
"169.254.253.107",
|
||||
"2600-6c5a-637f-1a85-0000-0000-0000-6667.inf6.spectrum.com",
|
||||
],
|
||||
"onIdntCmds": [
|
||||
"OPER e e"
|
||||
],
|
||||
"onIdntCmds": ["OPER e e"],
|
||||
},
|
||||
"twitch": {
|
||||
"nick": "fireschatbot",
|
||||
|
|
Loading…
Reference in a new issue