瀏覽代碼

privnotice try event.source

tBKwtWS 7 年之前
父節點
當前提交
087c05594b
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      irc/bot.py

+ 3 - 1
irc/bot.py

@@ -133,11 +133,13 @@ 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:
+        try:
             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])
+        except:
+            pass
     
     def on_action(self, connection, event):
         events.on_action.process_event(self, connection, event)