From 11269b2a5a2d129784be1400773cac41cbe9e011 Mon Sep 17 00:00:00 2001 From: passthem Date: Thu, 23 Oct 2025 23:32:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E7=BD=97=E6=96=87=E8=A2=AB=E5=BF=B5?= =?UTF-8?q?=E9=94=99=E6=97=B6=E6=8F=90=E9=86=92=E4=BB=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- konabot/plugins/no_luowen.py | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 konabot/plugins/no_luowen.py diff --git a/konabot/plugins/no_luowen.py b/konabot/plugins/no_luowen.py new file mode 100644 index 0000000..b5eb03c --- /dev/null +++ b/konabot/plugins/no_luowen.py @@ -0,0 +1,44 @@ +import nonebot + +from nonebot.adapters.onebot.v11.bot import Bot +from nonebot.adapters.onebot.v11.event import GroupMessageEvent +from nonebot_plugin_alconna import UniMsg, UniMessage +from pydantic import BaseModel + + +class NoLuowenConfig(BaseModel): + plugin_noluowen_qqid: int = -1 + plugin_noluowen_enable_group: list[int] = [] + +config = nonebot.get_plugin_config(NoLuowenConfig) + + +async def is_luowen_mentioned(evt: GroupMessageEvent, msg: UniMsg) -> bool: + if config.plugin_noluowen_qqid <= 0: + return False + if evt.user_id == config.plugin_noluowen_qqid: + return False + if evt.group_id not in config.plugin_noluowen_enable_group: + return False + txt = msg.extract_plain_text() + if "洛温" not in txt: + return False + if "罗文" in txt: + return False + if "阿特金森" in txt: + return False + return True + +evt_luowen_mentioned = nonebot.on_message(rule=is_luowen_mentioned) + + +@evt_luowen_mentioned.handle() +async def _(evt: GroupMessageEvent, bot: Bot): + msg = ( + UniMessage() + .reply(str(evt.message_id)) + .at(str(config.plugin_noluowen_qqid)) + .text(" 好像有人念错了你的 ID") + ) + await evt_luowen_mentioned.send(await msg.export(bot=bot)) +