From 4d18f729c6e03abc1293066de096b32f157a95a9 Mon Sep 17 00:00:00 2001 From: PinLin Date: Thu, 31 Aug 2017 01:12:57 +0800 Subject: [PATCH] effective way to keep alive --- bot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index ce2518d..d496bd6 100644 --- a/bot.py +++ b/bot.py @@ -144,9 +144,13 @@ with open('users.json', 'r') as f: MessageLoop(bot, on_chat).run_as_thread() print("Started! Service is available.") - +count = 0 while True: time.sleep(1) + count += 1 + if count == 5: + bot.getMe() + count = 0 # backup users_backup = {}