need to respond to ping

This commit is contained in:
AZ Huang 2013-12-01 23:24:33 +08:00
parent 6e9d160d00
commit 750ffa71b9

View file

@ -62,8 +62,8 @@ class SyncBot(Tox):
checked = False checked = False
if not self.joined: if not self.joined:
tid = self.get_friend_id(GROUP_BOT)
try: try:
tid = self.get_friend_id(GROUP_BOT)
self.send_message(tid, 'invite') self.send_message(tid, 'invite')
except: pass except: pass
@ -85,6 +85,10 @@ class SyncBot(Tox):
if self.tox_group_id != None: if self.tox_group_id != None:
self.group_message_send(self.tox_group_id, msg) self.group_message_send(self.tox_group_id, msg)
l = line.rstrip().split()
if l[0] == "PING":
self.irc.send("PONG %s\r\n" % l[1])
self.do() self.do()
except KeyboardInterrupt: except KeyboardInterrupt:
self.save_to_file('data') self.save_to_file('data')