Formatting

This commit is contained in:
Firepup Sixfifty 2024-04-20 02:48:43 -05:00
parent b6c58e66fc
commit b0cd9c36f1
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
2 changed files with 17 additions and 11 deletions

24
bot.py
View file

@ -45,7 +45,11 @@ class bot(bare.bot):
if "interval" in conf.servers[server] if "interval" in conf.servers[server]
else 50 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.queue: list[bbytes] = [] # pyright: ignore [reportInvalidTypeForm]
self.sock = socket(AF_INET, SOCK_STREAM) self.sock = socket(AF_INET, SOCK_STREAM)
self.current = "user" self.current = "user"
@ -53,13 +57,19 @@ class bot(bare.bot):
conf.servers[server]["threads"] if "threads" in conf.servers[server] else [] conf.servers[server]["threads"] if "threads" in conf.servers[server] else []
) )
self.onIdntCmds = ( 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 = ( 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 = ( 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.lastfmLink = conf.lastfmLink
self.log(f"Start init for {self.server}") self.log(f"Start init for {self.server}")
@ -67,14 +77,12 @@ class bot(bare.bot):
def connect(self) -> None: def connect(self) -> None:
self.log(f"Joining {self.server}...") self.log(f"Joining {self.server}...")
self.sock.connect((self.address, self.port)) self.sock.connect((self.address, self.port))
self.send("\n") # Just for sanity self.send("\n") # Just for sanity
if self.onStrtCmds: if self.onStrtCmds:
for cmd in self.onStrtCmds: for cmd in self.onStrtCmds:
self.send(cmd + "\n") self.send(cmd + "\n")
if "serverPass" in conf.servers[self.server]: if "serverPass" in conf.servers[self.server]:
self.send( self.send(f"PASS {conf.servers[self.server]['serverPass']}\n")
f"PASS {conf.servers[self.server]['serverPass']}\n"
)
self.send(f"USER {self.nick} {self.nick} {self.nick} {self.nick}\n") self.send(f"USER {self.nick} {self.nick} {self.nick} {self.nick}\n")
self.send(f"NICK {self.nick}\n") self.send(f"NICK {self.nick}\n")
ircmsg = "" ircmsg = ""

View file

@ -54,9 +54,7 @@ servers: dict[str, dict[str, Any]] = {
"169.254.253.107", "169.254.253.107",
"2600-6c5a-637f-1a85-0000-0000-0000-6667.inf6.spectrum.com", "2600-6c5a-637f-1a85-0000-0000-0000-6667.inf6.spectrum.com",
], ],
"onIdntCmds": [ "onIdntCmds": ["OPER e e"],
"OPER e e"
],
}, },
"twitch": { "twitch": {
"nick": "fireschatbot", "nick": "fireschatbot",