Эх сурвалжийг харах

privnotice if event.source

tBKwtWS 7 жил өмнө
parent
commit
91913c26d1
1 өөрчлөгдсөн 5 нэмэгдсэн , 4 устгасан
  1. 5 4
      irc/bot.py

+ 5 - 4
irc/bot.py

@@ -133,10 +133,11 @@ class PyRot(irc.bot.SingleServerIRCBot):
         commands.admin.do_command(self, connection, event)
         commands.statistics.do_command(self, connection, event)
         commands.games.do_command(self, connection, event)
-        if event.source.nick == "NickServ" and event.arguments[0].startswith("This nickname is registered"):
-            connection.privmsg("NickServ", "identify " + connection.nickname + " " + self.password) # Identify with NickServ.
-        if event.source.nick == "ChanServ" and event.arguments[0].startswith("Key for channel ") and len(event.arguments[0]) > 5:   # Received channel key.
-            connection.join(event.arguments[0].split(' ')[3], event.arguments[0].split(' ')[5][:-1])
+        if event.source.nick:
+            if event.source.nick == "NickServ" and event.arguments[0].startswith("This nickname is registered"):
+                connection.privmsg("NickServ", "identify " + connection.nickname + " " + self.password) # Identify with NickServ.
+            if event.source.nick == "ChanServ" and event.arguments[0].startswith("Key for channel ") and len(event.arguments[0]) > 5:   # Received channel key.
+                connection.join(event.arguments[0].split(' ')[3], event.arguments[0].split(' ')[5][:-1])
     
     def on_action(self, connection, event):
         events.on_action.process_event(self, connection, event)