Add wait message.

This commit is contained in:
AZ Huang 2014-03-13 19:33:34 +00:00
parent c5de892685
commit 898f2ddf26

View File

@ -175,10 +175,14 @@ class SyncBot(Tox):
def on_friend_message(self, friendid, message): def on_friend_message(self, friendid, message):
if message == 'invite': if message == 'invite':
print('Inviting %s' % self.get_name(friendid)) if not self.tox_group_id is None:
self.invite_friend(friendid, self.tox_group_id) print('Inviting %s' % self.get_name(friendid))
else: self.invite_friend(friendid, self.tox_group_id)
self.ensure_exe(self.send_message, (friendid, message)) return
else:
message = 'Waiting for GroupBot, please try again in 1 min.'
self.ensure_exe(self.send_message, (friendid, message))
def send_both(self, content): def send_both(self, content):
self.ensure_exe(self.group_message_send, (self.tox_group_id, content)) self.ensure_exe(self.group_message_send, (self.tox_group_id, content))
@ -188,6 +192,8 @@ class SyncBot(Tox):
cmd = cmd[1:] cmd = cmd[1:]
if cmd in ['syncbot', 'echobot']: if cmd in ['syncbot', 'echobot']:
self.send_both(self.get_address()) self.send_both(self.get_address())
elif cmd == 'resync':
sys.exit(0)
elif cmd.startswith('remember '): elif cmd.startswith('remember '):
args = cmd[9:].split(' ') args = cmd[9:].split(' ')
subject = args[0] subject = args[0]