1
我已經在Python中完成了一個IRC-Bot。 我想創建一個關機命令。 它看起來像這樣:從套接字上的客戶端關閉和關閉的Python Irc-Bot EOF
self.SendMessage("Bye!", self.connectedchannel) # Send bye to the connected channel
self.connection.shutdown(socket.SHUT_RDWR) # Shutdown the socket
self.connection.close() # Close the socket
sys.exit() # Exit the program
但在IRC與「從客戶EOF」機器人斷開,它不正確斷開。 如何更改我的代碼呢?
您必須發送QUIT信息,然後關閉連接。 (不是'PRIVMSG',我的意思是'QUIT:Bye!') –
謝謝,這個工作!你能補充一點嗎? – Thor77