fix group fail-connecting bug
This commit is contained in:
32
bot.py
32
bot.py
@ -58,13 +58,13 @@ def on_chat(msg):
|
||||
bot.sendMessage(chat_id, "請先私訊我登入 kCOJ", reply_to_message_id=msg['message_id'])
|
||||
|
||||
elif command[0] == '/start' or command[0] == '首頁🏠':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.display_main(chat_id)
|
||||
|
||||
elif command[0] == '/question' or command[0] == '題庫📝' or command[0] == '更新🔃':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
if len(command) > 1:
|
||||
user.display_question(chat_id, command[1])
|
||||
user.display_question(command[1], chat_id)
|
||||
else:
|
||||
user.display_questions(chat_id)
|
||||
|
||||
@ -82,11 +82,11 @@ def on_chat(msg):
|
||||
|
||||
elif chat_type == 'private':
|
||||
if command[0] == '/help' or command[0] == '幫助📚':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.help_you()
|
||||
|
||||
elif command[0] == '/password' or command[0] == '改密碼💱':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.press_oldpassword()
|
||||
|
||||
elif command[0] == '/logout' or command[0] == '登出🚪':
|
||||
@ -95,44 +95,44 @@ def on_chat(msg):
|
||||
user.logout_system()
|
||||
|
||||
elif (command[0] == '/delete' or command[0] == '刪除作業⚔️') and user.question != '題外':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.delete_answer()
|
||||
|
||||
elif (command[0] == '/upload' or command[0] == '交作業📮') and user.question != '題外':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.upload_answer()
|
||||
|
||||
elif (command[0] == '/result' or command[0] == '看結果☑️') and user.question != '題外':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.list_results()
|
||||
|
||||
elif (command[0] == '/passer' or command[0] == '通過者🌐') and user.question != '題外':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.list_passers()
|
||||
|
||||
elif command[0] == '回題目📜' and user.question != '題外':
|
||||
if user.check_online() == True:
|
||||
user.display_question(chat_id ,user.question)
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.display_question(user.question, chat_id)
|
||||
|
||||
elif user.status == '舊的密碼':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.press_newpassword(msg['text'])
|
||||
|
||||
elif user.status == '修改密碼':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.change_password(msg['text'])
|
||||
|
||||
elif user.status == '上傳答案':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
user.send_answer(msg['text'], '')
|
||||
|
||||
else:
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
bot.sendMessage(chat_id, "(ˊ・ω・ˋ)")
|
||||
|
||||
elif content_type == 'document':
|
||||
if user.status == '上傳答案' or user.status == '查看題目':
|
||||
if user.check_online() == True:
|
||||
if user.check_online(chat_id, msg['message_id']) == True:
|
||||
if msg['document']['file_size'] > 167770000:
|
||||
user.fail_send()
|
||||
else:
|
||||
|
Reference in New Issue
Block a user