簡體   English   中英

讀取IRC服務器命令返回的數據的Python IRC機器人

[英]Python IRC bot that reads data returned from a command of the IRC server

我有一個與PHP IRC bot類似的問題, 它讀取IRC服務器命令返回的數據

我正在使用一個用Python編寫的IRC機器人,它在網絡上廣泛存在。

我必須發送一個“名稱”命令到IRC服務器,然后返回當前在該機器人是在通道用戶名的列表,但我似乎無法趕上名單,NOR從得到消息返回服務器-機器人接收並打印其他用戶發送的消息,但不是他本人也不是命令輸出。

要打印數據,我使用以下方法:

while True:
    data = irc.recv ( 4096 )
    (...)
    print data

要發送NAMES命令,我嘗試了以下操作:

irc.send ( 'NAMES #channel\r\n' )

和:

irc.send ( 'PRIVMSG #channel :/names\r\n' )

pastebin dot com上的完整代碼: http : //pastebin.com/xjymEjPu

我只是能夠在腳本輸出中看到NAMES列表

:botty!~botty@durrrrrrrrr JOIN :#channel
:retribution.sg.as.irchighway.net 353 botty = #channel :botty IlPalazzo-ojiisan @Nibelung 
:retribution.sg.as.irchighway.net 366 botty #channel :End of /NAMES list.
:retribution.sg.as.irchighway.net 353 botty = #channel :botty IlPalazzo-ojiisan @Nibelung 
:retribution.sg.as.irchighway.net 366 botty #channel :End of /NAMES list.

雖然這不是最后彈出的內容。 也許您錯過了? 它是最后一組返回的全局通知上方的一組通知。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM