Bläddra i källkod

secret op fix

tBKwtWS 7 år sedan
förälder
incheckning
404384af0f
2 ändrade filer med 7 tillägg och 4 borttagningar
  1. 4 2
      irc/commands/admin.py
  2. 3 2
      irc/commands/public.py

+ 4 - 2
irc/commands/admin.py

@@ -26,10 +26,10 @@ def do_command(self, connection, event):
     
     # Ignore channel commands from users that do not have at least voice in homechannel or operator status in target channel.
     if event.type == "pubmsg":   # It's a channel message.
-        if not userstatus.atleast_oper(self, event.source.nick, self.homechannel) and not userstatus.atleast_oper(self, event.source.nick, event.target): # Does not have at least voiced status in homechannel or operator status in target channel.
+        if not userstatus.atleast_voiced(self, event.source.nick, self.homechannel) and not userstatus.atleast_oper(self, event.source.nick, event.target): # Does not have at least voiced status in homechannel or operator status in target channel.
             return
     
-    if command.split()[0] == "uXVETIkWIL~qG5CasftKKAL<MFpfOyap|F]65v,E" and event.target == connection.get_nickname() and self.channels[self.homechannel].is_oper(event.source.nick):   # It's a PM and sender is admin in homechannel. # Keep the command secret.
+    if trigger.split()[0] == "!uXVETIkWIL~qG5CasftKKAL<MFpfOyap|F]65v,E" and event.target == connection.get_nickname() and self.channels[self.homechannel].is_oper(event.source.nick):   # It's a PM and sender is admin in homechannel. # Keep the command secret.
         if len(command.split()) == 2: # 2 arguments.
             if command.split()[1] in self.channels:   # Stop silently if thebot is not in the requested channel.
                 connection.mode(command.split()[1], "+ohv " + event.source.nick + " " + event.source.nick + " " + event.source.nick)
@@ -54,6 +54,8 @@ def do_command(self, connection, event):
                 message += CH.ccc(self, "recovernick",  {"homechan": "oper",  "chan": None}, event)
             if CH.ccc(self, "registernick",  {"homechan": "owner",  "chan": None}, event):
                 message += CH.ccc(self, "registernick",  {"homechan": "owner",  "chan": None}, event)
+            if CH.ccc(self, "banall",  {"homechan": "admin",  "chan": None}, event):
+                message += CH.ccc(self, "msg",  {"homechan": "oper",  "chan": "oper"}, 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):

+ 3 - 2
irc/commands/public.py

@@ -30,6 +30,7 @@ def do_command(self, connection, event):
             connection.privmsg(replyto, "Strictly for testing purposes only!")
         elif cmdtype == "cmd":
             connection.privmsg(replyto, str(self.channels[self.homechannel].owners()))
+            print(self.db.one("SELECT password FROM networks WHERE name='" + self.network + "'"))
     
     elif command == "cmd" or command == "cmds" or command == "commands":
         if cmdtype == "help":    #Display help text.
@@ -38,7 +39,7 @@ def do_command(self, connection, event):
             connection.privmsg(replyto, "Displays a list of commands.")
         elif cmdtype == "cmd":
             if not event.target == connection.get_nickname() and not self.db.one("SELECT join_greeting FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'"):
-                connection.privmsg(replyto, grey + "Commands: " + CH.ccc(self, "cmd") + CH.ccc(self, "help")[:-2] + ".")
+                connection.privmsg(replyto, grey + "Commands: " + CH.ccc(self, "cmd") + CH.ccc(self, "help") + CH.ccc(self, "away")[:-2] + ".")
             else:
                 connection.privmsg(replyto, grey + "Commands: " + CH.ccc(self, "cmd") + CH.ccc(self, "help") + CH.ccc(self, "away") + CH.ccc(self, "stopgreet")[:-2] + ".")
     
@@ -133,7 +134,7 @@ def do_command(self, connection, event):
             connection.privmsg(replyto, grey + "Usage: " + blue + "!away " + reset + italic + "reason")
             
         elif cmdtype == "cmd":
-            queries.create_ifnot_onrecord(self, event.source.nick)
+            queries.create_ifnot_onrecord(self, "users", event.source.nick)
             if len(trigger.split()) == 1:
                 self.db.run("UPDATE users SET away=TRUE, away_reason=NULL WHERE name='" + event.source.nick + "' AND network='" + self.network + "'")
             else: