add config

This commit is contained in:
HibiKier 2022-05-28 18:12:08 +08:00
parent 7ab185f7d7
commit a7d61b1f2b
2 changed files with 7 additions and 1 deletions

View File

@ -249,6 +249,7 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
* 修复原神玩家查询层岩巨渊地下矿区没开时报错 * 修复原神玩家查询层岩巨渊地下矿区没开时报错
* 修复 ```休息吧``` 无法阻断戳一戳 * 修复 ```休息吧``` 无法阻断戳一戳
* 当图库无图片时,戳一戳将略过发送图片 * 当图库无图片时,戳一戳将略过发送图片
* 新增搜图提供配置项ALLOW_GROUP_R18允许在群聊中使用r18参数
### 2022/5/26 ### 2022/5/26

View File

@ -71,6 +71,11 @@ __plugin_configs__ = {
"value": 20, "value": 20,
"help": "作品最大页数限制,超过的作品会被略过", "help": "作品最大页数限制,超过的作品会被略过",
"default_value": 20 "default_value": 20
},
"ALLOW_GROUP_R18": {
"value": False,
"help": "允许群聊中使用 r18 参数",
"default_value": False
} }
} }
Config.add_plugin_config( 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()): async def _(bot: Bot, event: MessageEvent, arg: Message = CommandArg()):
msg = arg.extract_plain_text().strip() msg = arg.extract_plain_text().strip()
if isinstance(event, GroupMessageEvent): 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) await pixiv_keyword.finish("(脸红#) 你不会害羞的 八嘎!", at_sender=True)
r18 = 0 if "r18" in msg else 1 r18 = 0 if "r18" in msg else 1
msg = msg.replace("r18", "").strip().split() msg = msg.replace("r18", "").strip().split()