diff --git a/README.md b/README.md index 8fa50503..20bfb13f 100644 --- a/README.md +++ b/README.md @@ -242,6 +242,11 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__ ## 更新 +### 2022/5/9 + +* 替换了疫情API +* 修复了私聊.ban/.unban出错 + ### 2022/5/5 * 修改bilibili_sub插件在windows平台下报错 [@pull/153](https://github.com/HibiKier/zhenxun_bot/pull/153) @@ -252,12 +257,13 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__ * 添加商品注册装饰器shop_register * 修复商品函数kwargs无法获取参数值 + ### 2022/5/1 * 删除了`group_last_chat`插件(该功能可由`chat_history`替代 * 新增敏感词检测(全新反击系统,是时候重拳出击了 -### 2022/4/26 \[v0.5.1.0] +### 2022/4/26 * 修复了群白名单无法正确添加 * 优化了管理员帮助图片,背景图层将位于最下层 diff --git a/__version__ b/__version__ index bcc51b76..ac0eeee1 100644 --- a/__version__ +++ b/__version__ @@ -1 +1 @@ -__version__: v0.1.5.1 \ No newline at end of file +__version__: v0.1.5.3 \ No newline at end of file diff --git a/basic_plugins/ban/__init__.py b/basic_plugins/ban/__init__.py index 2ca32ee8..43fd23bb 100755 --- a/basic_plugins/ban/__init__.py +++ b/basic_plugins/ban/__init__.py @@ -125,11 +125,13 @@ async def _( msg = arg.extract_plain_text().strip() if msg: if str(event.user_id) in bot.config.superusers: - if is_number(arg.extract_plain_text().strip().split()[0]): - qq = int(msg[0]) - msg = msg[1:] + msg_splt = msg.split() + if is_number(msg_splt[0]): + + qq = int(msg_splt[0]) + msg = msg_splt[1:] if cmd in [".ban", "/ban"]: - time = parse_ban_time(msg) + time = parse_ban_time(" ".join(msg)) if isinstance(time, str): await ban.finish(time) result = await a_ban(qq, time, str(qq), event, 9) diff --git a/basic_plugins/ban/data_source.py b/basic_plugins/ban/data_source.py index 17efa578..4121d2e9 100644 --- a/basic_plugins/ban/data_source.py +++ b/basic_plugins/ban/data_source.py @@ -25,7 +25,9 @@ def parse_ban_time(msg: str) -> Union[int, str]: return int(msg[0]) * 60 * 60 + int(msg[1]) * 60 -async def a_ban(qq: int, time: int, user_name: str, event: MessageEvent, ban_level: int = None) -> str: +async def a_ban( + qq: int, time: int, user_name: str, event: MessageEvent, ban_level: int = None +) -> str: """ ban :param qq: qq @@ -38,7 +40,8 @@ async def a_ban(qq: int, time: int, user_name: str, event: MessageEvent, ban_lev ban_level = await LevelUser.get_user_level(event.user_id, event.group_id) if await BanUser.ban(qq, ban_level, time): logger.info( - f"USER {event.user_id} GROUP {event.group_id} 将 USER {qq} 封禁 时长 {time / 60} 分钟" + f"USER {event.user_id} GROUP" + f" {event.group_id if isinstance(event, GroupMessageEvent) else ''} 将 USER {qq} 封禁 时长 {time / 60} 分钟" ) result = f"已经将 {user_name} 加入{NICKNAME}的黑名单了!" if time != -1: @@ -57,13 +60,3 @@ async def a_ban(qq: int, time: int, user_name: str, event: MessageEvent, ban_lev time += " 分钟" result = f"{user_name} 已在黑名单!预计 {time}后解封" return result - - - - - - - - - - diff --git a/basic_plugins/shop/use/data_source.py b/basic_plugins/shop/use/data_source.py index 58629de5..bc5e43c5 100644 --- a/basic_plugins/shop/use/data_source.py +++ b/basic_plugins/shop/use/data_source.py @@ -69,7 +69,7 @@ class GoodsUseFuncManager: ) else: return self._data[goods_name]["func"]( - **kwargs, + *parse_args(args) ) else: if asyncio.iscoroutinefunction(self._data[goods_name]["func"]): diff --git a/plugins/bilibili_sub/__init__.py b/plugins/bilibili_sub/__init__.py index 98834f4d..012c46a3 100755 --- a/plugins/bilibili_sub/__init__.py +++ b/plugins/bilibili_sub/__init__.py @@ -38,7 +38,7 @@ usage: __plugin_des__ = "非常便利的B站订阅通知" __plugin_cmd__ = ["添加订阅 [主播/UP/番剧] [id/链接/番名]", "删除订阅 [id]", "查看订阅"] __plugin_version__ = 0.1 -__plugin_author__ = "HibiKier" +__plugin_author__ = "HibiKier & NumberSir" __plugin_settings__ = { "level": 5, "default_status": True, diff --git a/plugins/word_bank/word_hanlde.py b/plugins/word_bank/word_hanlde.py index 71df8455..d0900982 100644 --- a/plugins/word_bank/word_hanlde.py +++ b/plugins/word_bank/word_hanlde.py @@ -49,7 +49,7 @@ __plugin_cmd__ = [ "查看词条 ?[问题/下标]", ] __plugin_version__ = 0.2 -__plugin_author__ = "HibiKier" +__plugin_author__ = "HibiKier & yajiwa" __plugin_settings__ = { "admin_level": Config.get_config("word_bank", "WORD_BANK_LEVEL [LEVEL]"), "cmd": ["词库问答", "添加词条", "删除词条", "修改词条", "查看词条"], diff --git a/plugins/yiqing/data_source.py b/plugins/yiqing/data_source.py index 540c343c..14c3fc70 100755 --- a/plugins/yiqing/data_source.py +++ b/plugins/yiqing/data_source.py @@ -11,7 +11,7 @@ china_city = TEXT_PATH / "china_city.json" data = {} -url = "https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5" +url = "https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=diseaseh5Shelf" async def get_yiqing_data(area: str) -> Union[str, MessageSegment]: @@ -37,7 +37,7 @@ async def get_yiqing_data(area: str) -> Union[str, MessageSegment]: if area in data[p]: province = p city = area - epidemic_data = json.loads((await AsyncHttpx.get(url)).json()["data"]) + epidemic_data = (await AsyncHttpx.get(url)).json()["data"]["diseaseh5Shelf"] last_update_time = epidemic_data["lastUpdateTime"] if area == "中国": data_ = epidemic_data["areaTree"][0] @@ -59,12 +59,12 @@ async def get_yiqing_data(area: str) -> Union[str, MessageSegment]: add_confirm = data_["today"]["confirm"] # 新增确诊 grade = "" _grade_color = "" - if data_["total"].get("grade"): - grade = data_["total"]["grade"] - if "中风险" in grade: - _grade_color = "#fa9424" - else: - _grade_color = "red" + # if data_["total"].get("grade"): + # grade = data_["total"]["grade"] + # if "中风险" in grade: + # _grade_color = "#fa9424" + # else: + # _grade_color = "red" dead_rate = f"{dead / confirm * 100:.2f}" # 死亡率 heal_rate = f"{heal / confirm * 100:.2f}" # 治愈率