【发布时间】:2011-10-06 17:56:30
【问题描述】:
代码:
while True:
data = irc.recv(4096)
if data.find('PING') != -1:
irc.send('PONG '+ data.split() [1] +' \r\n')
if data.find('!latest') != -1:
irc.send('PRIVMSG #PwnMyI :\x02Latest Article:\x02 %s, \x02written by\x02 %s \r\n' % (art_name, art_auth))
irc.send('PRIVMSG #PwnMyI :\x02Description:\x02 %s \r\n' % art_desc)
irc.send('PRIVMSG #PwnMyI :\x02View Article:\x02 %s \r\n' % art_link)
这是我的机器人的一个 sn-p 代码。其余代码是自定义构建,并拆分为不同的文件,反正你不需要它们。
irc 是套接字连接,send 通过套接字发送数据。我想要做的是实现一个计时功能,这样它每 5 分钟只工作一次。只是为了停止滥用。谁能指出我正确的方向?谢谢。
【问题讨论】: