restart on non-login status

This commit is contained in:
2017-08-31 00:39:56 +08:00
parent 360f6b820b
commit c93b3c20b3

15
bot.py
View File

@ -35,8 +35,14 @@ def on_chat(msg):
if msg['text'].startswith('/'):
command = msg['text'].replace(config.NAME, '').replace('_', ' ').lower().split(' ')
if command[0] == '/restart' and str(from_id) in config.ADMIN:
bot.sendMessage(chat_id, "即將更新並重新啟動")
print("Restarting...")
time.sleep(1)
os._exit(0)
# first-time user
if user.status == '第一次用':
elif user.status == '第一次用':
if chat_type == 'private':
user.new_user()
elif msg['text'].startswith('/'):
@ -67,13 +73,6 @@ def on_chat(msg):
else:
user.display_questions(chat_id)
elif command[0] == '/restart':
if str(from_id) in config.ADMIN:
bot.sendMessage(chat_id, "即將更新並重新啟動")
print("Restarting...")
time.sleep(1)
os._exit(0)
elif command[0] == '/ping':
bot.sendMessage(chat_id, "*PONG*",
parse_mode='Markdown',