def run(self):
while True:
try:
text = irc.recv(2040)
if text.find('PING') != -1:
irc.send('PONG ' + text.split() [1] + '\r\n')
connected = True
elif text.find('PRIVMSG') != -1:
end = text.find('!')
username = text[1:end]
start = text.find(channel + ' :')
message = text[start + len(channel) + 2:]
log('recv', '<' + username + '> ' + message)
elif text.find('PART') != -1:
end = text.find('!')
username = text[1:end]
log('recv', '[' + username + '] left \n')
elif text.find('JOIN') != -1:
end = text.find('!')
username = text[1:end]
log('recv', '[' + username + ']' + ' joined \n')
else:
print(text)
except socket.error:
break
评论列表
文章目录