fixbug:解决抢答和获取任务的问题

This commit is contained in:
Liu
2025-02-21 20:00:43 +08:00
parent 17c44d2c22
commit 8954fc5a7f
3 changed files with 36 additions and 7 deletions

View File

@@ -241,6 +241,7 @@ def submit_answer(group_id, player_id, task_id, answer):
# 调用内部方法校验答案
answer_json = {"question": question, "top_score": str(top_score), "answer": answer}
result = game_answer_json(answer_json)
print(result)
points = int(result["score"])
description = result["description"]
is_correct = points > 0
@@ -297,7 +298,8 @@ def submit_answer(group_id, player_id, task_id, answer):
conn.commit()
return message
except ValueError:
except ValueError as e:
print(f"submit_answer:{e}")
return (
f"😅 哎呀,小调皮\n"
f"🌟 任务ID格式不对哦\n"
@@ -474,8 +476,8 @@ def setup_schedule():
# 主程序
if __name__ == "__main__":
# 测试抢答功能
print(game_process_message("47530198896@chatroom", "player1001", "/start", "玩家1"))
print(game_process_message("47530198896@chatroom", "player1002", "/start", "玩家2"))
print(game_process_message("47530198896@chatroom", "player1001", "/gettask"))
# print(game_process_message("47530198896@chatroom", "player1001", "/start", "玩家1"))
# print(game_process_message("47530198896@chatroom", "player1002", "/start", "玩家2"))
# print(game_process_message("47530198896@chatroom", "player1001", "/gettask"))
# 玩家2 抢答玩家1的任务
print(game_process_message("47530198896@chatroom", "player1002", "/answer 1 珠穆朗玛峰"))
print(game_process_message("45317011307@chatroom", "Jyunere", "/answer 18 罗马斗兽场"))