tBKwtWS 7 роки тому
батько
коміт
7a57c47bb0
4 змінених файлів з 34 додано та 8 видалено
  1. 7 1
      irc/commands/admin.py
  2. 10 2
      irc/commands/games.py
  3. 7 3
      irc/commands/public.py
  4. 10 2
      irc/commands/statistics.py

+ 7 - 1
irc/commands/admin.py

@@ -15,8 +15,14 @@ grey = "\x0314"
 
 def do_command(self, connection, event):
     cmdtype, trigger, command, replyto = CH.disect_command(self, event)
+    
+    # Do nothing if there is no command.
     if not command:
-        return # Do nothing if there is no command.
+        return 
+    try:
+        command.split()[0]
+    except:
+        return
     
     # 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.

+ 10 - 2
irc/commands/games.py

@@ -14,10 +14,18 @@ grey = "\x0314"
 
 def do_command(self, connection, event):
     cmdtype, trigger, command, replyto = CH.disect_command(self, event)
+    
+    # Do nothing if there is no command.
     if not command:
-        return  # Do nothing if there is no command.
+        return
+    try:
+        command.split()[0]
+    except:
+        return
+    
+    # Do noting if the games channel function is off and it's a channel message.
     if not self.db.one("SELECT games FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'") and not event.target == connection.get_nickname():
-        return  # Do noting if the games channel function is off and it's a channel message.
+        return
     
     if command == "cmd" or command == "cmds" or command == "commands":
         if cmdtype == "cmd":

+ 7 - 3
irc/commands/public.py

@@ -13,12 +13,16 @@ grey = "\x0314"
 
 def do_command(self, connection, event):
     cmdtype, trigger, command, replyto = CH.disect_command(self, event)
-    if not command: # Do nothing if there is no command.
+    
+    # Do nothing if there is no command.
+    if not command:
+        return
+    try:
+        command.split()[0]
+    except:
         return
     
     # The actual commands:
-    print(command)
-    print(command.split()[0])
     if command == "test":
         if cmdtype == "help":    #Display help text.
             if len(command.split()) is not 1:

+ 10 - 2
irc/commands/statistics.py

@@ -13,10 +13,18 @@ grey = "\x0314"
 
 def do_command(self, connection, event):
     cmdtype, trigger, command, replyto = CH.disect_command(self, event)
-    if not command: # Do nothing if there is no command.
+    
+    # Do nothing if there is no command.
+    if not command: 
+        return
+    try:
+        command.split()[0]
+    except:
         return
+    
+    # Do noting if the games channel function is off and it's a channel message.
     if not self.db.one("SELECT statistics_commands FROM channels WHERE name='" + event.target + "' AND network='" + self.network + "'") and not event.target == connection.get_nickname():
-        return  # Do noting if the games channel function is off and it's a channel message.
+        return
 
     if command == "cmd" or command == "cmds" or command == "commands":
         if cmdtype == "cmd":