Fix admin check, and fix a un-updated line

This commit is contained in:
Firepup Sixfifty 2023-11-07 09:19:57 -06:00
parent 1b48269d17
commit 374ff215d6
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA

12
bot.py
View file

@ -196,7 +196,7 @@ class bot:
def sendraw(self, command: str) -> int: def sendraw(self, command: str) -> int:
self.log(f"RAW sending {command}") self.log(f"RAW sending {command}")
command = f"{command}\n" command = f"{command}\n"
return self.send(command.replace("$BOTNICK", botnick)) return self.send(command.replace("$BOTNICK", self.nick))
def mainloop(self) -> NoReturn: def mainloop(self) -> NoReturn:
self.log("Starting connection..") self.log("Starting connection..")
@ -269,7 +269,10 @@ class bot:
triggers, triggers,
cmds.data[cmd]["prefix"], cmds.data[cmd]["prefix"],
): ):
cmds.call[cmd](self, chan, name, message) if ("admin" in cmds.data[cmd] and cmds.data[cmd]["admin"]) and name not in self.adminnames:
self.msg(f"Sorry {name}, you don't have permission to use {cmd}.", chan)
else:
cmds.call[cmd](self, chan, name, message)
handled = True handled = True
break break
if not handled: if not handled:
@ -280,10 +283,7 @@ class bot:
), ),
message, message,
): ):
if ("admin" in cmds.data[cmd] and cmds.data[cmd]["admin"]) and name not in self.adminnames: cmds.call[check](self, chan, name, message)
self.msg(f"Sorry {name}, you don't have permission to use {cmd}.", chan)
else:
cmds.call[check](self, chan, name, message)
handled = True handled = True
break break
if not handled and mfind(message, ["reload"]): if not handled and mfind(message, ["reload"]):