繁体   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