try to fix suicide bug
This commit is contained in:
9
bot.py
9
bot.py
@ -6,12 +6,11 @@ from telepot.loop import MessageLoop
|
|||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
# kCOJ API
|
# kCOJ API
|
||||||
import access
|
import access
|
||||||
from interface import kuser
|
from interface import kuser, bot
|
||||||
# configurations
|
# configurations
|
||||||
import config
|
import config
|
||||||
|
|
||||||
users = {}
|
users = {}
|
||||||
bot = telepot.Bot(config.TOKEN)
|
|
||||||
|
|
||||||
def on_chat(msg):
|
def on_chat(msg):
|
||||||
content_type, chat_type, chat_id = telepot.glance(msg)
|
content_type, chat_type, chat_id = telepot.glance(msg)
|
||||||
@ -147,9 +146,13 @@ with open('users.json', 'r') as f:
|
|||||||
|
|
||||||
MessageLoop(bot, on_chat).run_as_thread()
|
MessageLoop(bot, on_chat).run_as_thread()
|
||||||
print("Started! Service is available.")
|
print("Started! Service is available.")
|
||||||
|
count = 0
|
||||||
while True:
|
while True:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
bot.getMe()
|
count += 1
|
||||||
|
if count == 5:
|
||||||
|
bot.getMe()
|
||||||
|
count = 0
|
||||||
|
|
||||||
# backup
|
# backup
|
||||||
users_backup = {}
|
users_backup = {}
|
||||||
|
Reference in New Issue
Block a user