From a7d61b1f2b248c9b2df7d26e155d8e6ba5c205f7 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Sat, 28 May 2022 18:12:08 +0800 Subject: [PATCH] add config --- README.md | 1 + plugins/pixiv_rank_search/__init__.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a47d476c..0d02a5eb 100644 --- a/README.md +++ b/README.md @@ -249,6 +249,7 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__ * 修复原神玩家查询层岩巨渊地下矿区没开时报错 * 修复 ```休息吧``` 无法阻断戳一戳 * 当图库无图片时,戳一戳将略过发送图片 +* 新增搜图提供配置项ALLOW_GROUP_R18:允许在群聊中使用r18参数 ### 2022/5/26 diff --git a/plugins/pixiv_rank_search/__init__.py b/plugins/pixiv_rank_search/__init__.py index bace5be7..1c546ed8 100755 --- a/plugins/pixiv_rank_search/__init__.py +++ b/plugins/pixiv_rank_search/__init__.py @@ -71,6 +71,11 @@ __plugin_configs__ = { "value": 20, "help": "作品最大页数限制,超过的作品会被略过", "default_value": 20 + }, + "ALLOW_GROUP_R18": { + "value": False, + "help": "允许群聊中使用 r18 参数", + "default_value": False } } Config.add_plugin_config( @@ -154,7 +159,7 @@ async def _(bot: Bot, event: MessageEvent, arg: Message = CommandArg()): async def _(bot: Bot, event: MessageEvent, arg: Message = CommandArg()): msg = arg.extract_plain_text().strip() if isinstance(event, GroupMessageEvent): - if "r18" in msg.lower(): + if "r18" in msg.lower() and not Config.get_config("pixiv_rank_search", "ALLOW_GROUP_R18"): await pixiv_keyword.finish("(脸红#) 你不会害羞的 八嘎!", at_sender=True) r18 = 0 if "r18" in msg else 1 msg = msg.replace("r18", "").strip().split()