소스 검색

Not parting homechannel & command list crash for superops fix

tBKwtWS 7 년 전
부모
커밋
2fe667974d
2개의 변경된 파일25개의 추가작업 그리고 11개의 파일을 삭제
  1. BIN
      commands/__pycache__/admin.cpython-36.pyc
  2. 25 11
      commands/admin.py

BIN
commands/__pycache__/admin.cpython-36.pyc


+ 25 - 11
commands/admin.py

@@ -20,17 +20,25 @@ def do_command(self, connection, event):
     
     if command == "cmd" or command == "commands":
         if cmdtype == "cmd":
-            message = str(
-                grey + "Admin: "
-                + CH.ccc(self, "channelfunctions",  {"homechan": "oper", "chan": "oper"}, event)
-                + CH.ccc(self, "join", {"homechan": "oper",  "chan": None}, event)
-                + CH.ccc(self, "part", {"homechan": "oper",  "chan": None}, event)
-                + CH.ccc(self, "die",  {"homechan": "admin",  "chan": None}, event)
-                + CH.ccc(self, "reconnect", {"homechan": "oper",  "chan": None}, event)
-                + CH.ccc(self, "recovernick",  {"homechan": "oper",  "chan": None}, event)
-                + CH.ccc(self, "msg",  {"homechan": "oper",  "chan": "oper"}, event)
-                + CH.ccc(self, "act", {"homechan": "oper",  "chan": "oper"}, event)
-            )
+            message = grey + "Admin: "
+            if CH.ccc(self, "channelfunctions",  {"homechan": "oper", "chan": "oper"}, event):
+                message += CH.ccc(self, "channelfunctions",  {"homechan": "oper", "chan": "oper"}, event)
+            if CH.ccc(self, "join", {"homechan": "oper",  "chan": None}, event):
+                message += CH.ccc(self, "join", {"homechan": "oper",  "chan": None}, event)
+            if CH.ccc(self, "part", {"homechan": "oper",  "chan": None}, event):
+                message += CH.ccc(self, "part", {"homechan": "oper",  "chan": None}, event)
+            if CH.ccc(self, "die",  {"homechan": "admin",  "chan": None}, event):
+                message += CH.ccc(self, "die",  {"homechan": "admin",  "chan": None}, event)
+            if CH.ccc(self, "reconnect", {"homechan": "oper",  "chan": None}, event):
+                message += CH.ccc(self, "reconnect", {"homechan": "oper",  "chan": None}, event)
+            if CH.ccc(self, "recovernick",  {"homechan": "oper",  "chan": None}, event):
+                message += CH.ccc(self, "recovernick",  {"homechan": "oper",  "chan": None}, event)
+            if CH.ccc(self, "msg",  {"homechan": "oper",  "chan": "oper"}, event):
+                message += CH.ccc(self, "msg",  {"homechan": "oper",  "chan": "oper"}, event)
+            if CH.ccc(self, "act", {"homechan": "oper",  "chan": "oper"}, event):
+                message += CH.ccc(self, "act", {"homechan": "oper",  "chan": "oper"}, event)
+            if message == grey + "Admin: ": # No commands to display.
+                return
             connection.privmsg(replyto, message[:-2] + ".")
     
     elif command.split()[0] == "channelfunctions":
@@ -132,6 +140,9 @@ def do_command(self, connection, event):
                     if not homeadmin and not targetadmin:   # Insufficient rights:
                         connection.privmsg(replyto, "Denied. You need to have at least operator status in " + red + self.homechan + reset + " or " + red + event.target + reset + ".")
                         return
+                    if event.target == self.homechannel:
+                        connection.action("shall not abandon it's home channel!")
+                        return
                     connection.part(event.target, event.source.nick)
                 else:   # It's a PM.
                     connection.privmsg(replyto, "Specify a channel to part. For help type " + blue + self.helpchar + "part" + reset + ".")
@@ -142,6 +153,9 @@ def do_command(self, connection, event):
                 if not homeadmin and not self.channels[command.split()[1]].is_owner(event.source.nick) and not self.channels[command.split()[1]].is_admin(event.source.nick) and not self.channels[command.split()[1]].is_oper(event.source.nick):  # Insufficient rights.
                     connection.privmsg(replyto, "Denied. You need to have at least operator status in " + red + self.homechan + reset + " or " + red + command.split()[1] + reset + ".")
                     return
+                if command.split()[1] == self.homechannel:
+                    connection.action("shall not abandon it's home channel!")
+                    return
                 try:
                     connection.part(command.split()[1], command.split(maxsplit=2)[2])
                 except: