diff --git a/README.md b/README.md index 63e478db..c37ec3a7 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,11 @@ python bot.py ## 更新 +### 2021/12/26 + +* 修复群词条问题 空格 会被录入导致不断回复 +* 修复米游社app替换api导致无法正常查询 + ### 2021/12/24 * 支持国际疫情数据查询 [@pull/99](https://github.com/HibiKier/zhenxun_bot/pull/99) diff --git a/plugins/genshin/query_user/bind/__init__.py b/plugins/genshin/query_user/bind/__init__.py index ebf75495..355553c5 100644 --- a/plugins/genshin/query_user/bind/__init__.py +++ b/plugins/genshin/query_user/bind/__init__.py @@ -16,7 +16,7 @@ usage: 原神绑定uid [uid] 原神绑定米游社id [mys_id] 原神绑定cookie [cookie] # 该绑定请私聊 - 原神解绑 [uid] + 原神解绑 示例:原神绑定uid 92342233 如果不明白怎么获取cookie请输入“原神绑定cookie”。 """.strip() @@ -63,7 +63,7 @@ async def _(bot: Bot, event: MessageEvent, state: T_State): else: if not msg: await bind.finish( - "私聊发送!!\n打开https://bbs.mihoyo.com/ys/登录后按F12点击控制台输入document.cookie复制输出的内容即可" + "私聊发送!!\n打开https://bbs.mihoyo.com/ys/\n登录后按F12点击控制台输入document.cookie复制输出的内容即可" ) if isinstance(event, GroupMessageEvent): await bind.finish("请立即撤回你的消息并私聊发送!") diff --git a/plugins/genshin/query_user/models/__init__.py b/plugins/genshin/query_user/models/__init__.py index fc5820ae..5b54ba1b 100644 --- a/plugins/genshin/query_user/models/__init__.py +++ b/plugins/genshin/query_user/models/__init__.py @@ -111,10 +111,8 @@ class Genshin(db.Model): :param flag:必须使用自己的cookie """ cookie = await cls._get_user_data(None, uid, "cookie") - print(uid, cookie) if not cookie and not flag: cookie = await cls.get_query_cookie(uid) - print(uid, cookie) return cookie @classmethod diff --git a/plugins/genshin/query_user/query_memo/data_source.py b/plugins/genshin/query_user/query_memo/data_source.py index 686da4c8..229f006d 100644 --- a/plugins/genshin/query_user/query_memo/data_source.py +++ b/plugins/genshin/query_user/query_memo/data_source.py @@ -55,7 +55,7 @@ async def get_user_memo(user_id: int, uid: int, uname: str) -> Optional[Union[st async def get_memo(uid: str, server_id: str) -> "Union[str, dict], int": try: req = await AsyncHttpx.get( - url=f"https://api-takumi.mihoyo.com/game_record/app/genshin/api/dailyNote?server={server_id}&role_id={uid}", + url=f"https://api-takumi-record.mihoyo.com/game_record/app/genshin/api/dailyNote?server={server_id}&role_id={uid}", headers={ "DS": get_ds(f"role_id={uid}&server={server_id}"), "x-rpc-app_version": Config.get_config("genshin", "mhyVersion"), diff --git a/plugins/genshin/query_user/query_role/data_source.py b/plugins/genshin/query_user/query_role/data_source.py index 76b11265..0e8b3cbd 100644 --- a/plugins/genshin/query_user/query_role/data_source.py +++ b/plugins/genshin/query_user/query_role/data_source.py @@ -99,7 +99,7 @@ b=body q=query async def get_info(uid_: str, server_id: str) -> "Optional[Union[dict, str]], int": try: req = await AsyncHttpx.get( - url=f"https://api-takumi.mihoyo.com/game_record/app/genshin/api/index?server={server_id}&role_id={uid_}", + url=f"https://api-takumi-record.mihoyo.com/game_record/app/genshin/api/index?server={server_id}&role_id={uid_}", headers={ "Accept": "application/json, text/plain, */*", "DS": get_ds(f"role_id={uid_}&server={server_id}"), diff --git a/plugins/word_bank/model.py b/plugins/word_bank/model.py index 34bc0e40..06e8af9a 100644 --- a/plugins/word_bank/model.py +++ b/plugins/word_bank/model.py @@ -209,3 +209,4 @@ class WordBank(db.Model): if q: return [(x.answer, x.format.split("")[:-1]) for x in q] return False + diff --git a/plugins/word_bank/word_hanlde.py b/plugins/word_bank/word_hanlde.py index 5bbcb77c..0a0ceb9b 100644 --- a/plugins/word_bank/word_hanlde.py +++ b/plugins/word_bank/word_hanlde.py @@ -63,6 +63,8 @@ async def _(bot: Bot, event: GroupMessageEvent, state: T_State): if not r: await add_word.finish("未检测到词条问题...") problem = r.group(1).strip() + if not problem: + await add_word.finish("未检测到词条问题...") answer = msg.split('答', maxsplit=1)[-1] if not answer: await add_word.finish("未检测到词条回答...") diff --git a/update_info.json b/update_info.json index 54aedb5a..7569e0f5 100644 --- a/update_info.json +++ b/update_info.json @@ -6,7 +6,6 @@ "utils", "services", "configs/utils", - "bot.py" ], "add_file": ["resources/img/genshin/genshin_card", "resources/img/genshin/genshin_memo"], "delete_file": []