From 9a330c99fcb4d82b67fa7cf1cc8f1aeee00e1148 Mon Sep 17 00:00:00 2001 From: CMHopeSunshine <277073121@qq.com> Date: Tue, 6 Sep 2022 22:33:17 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=96=B0=E5=A2=9E`=E5=85=A5?= =?UTF-8?q?=E7=BE=A4=E6=AC=A2=E8=BF=8E`=E5=92=8C`=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=A5=BD=E5=8F=8B=E3=80=81=E7=BE=A4=E8=AF=B7?= =?UTF-8?q?=E6=B1=82`=EF=BC=8C=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/plugin_manager/manager.py | 4 +- .../plugins/NoticeAndRequest/__init__.py | 10 ++-- LittlePaimon/utils/message.py | 2 +- README.md | 56 +++++++++++++++---- 4 files changed, 55 insertions(+), 17 deletions(-) diff --git a/LittlePaimon/manager/plugin_manager/manager.py b/LittlePaimon/manager/plugin_manager/manager.py index 9cc3476..2a0b24c 100644 --- a/LittlePaimon/manager/plugin_manager/manager.py +++ b/LittlePaimon/manager/plugin_manager/manager.py @@ -18,7 +18,9 @@ hidden_plugins = [ 'nonebot_plugin_imageutils', 'plugin_manager', 'database_manager', - 'admin' + 'admin', + 'NoticeAndRequest', + 'bot_manager' ] diff --git a/LittlePaimon/plugins/NoticeAndRequest/__init__.py b/LittlePaimon/plugins/NoticeAndRequest/__init__.py index ad0bcaa..5040d35 100644 --- a/LittlePaimon/plugins/NoticeAndRequest/__init__.py +++ b/LittlePaimon/plugins/NoticeAndRequest/__init__.py @@ -148,10 +148,12 @@ async def _(bot: Bot, event: GroupIncreaseNoticeEvent): async def _(event: MessageEvent, regex_dict: dict = RegexDict()): type = regex_dict['type'] target = regex_dict['target'].split(' ') - if not target: - target = [str(event.group_id)] if any(i in target for i in {'全部', 'all', '所有'}): target = ['全部'] + else: + target = list(map(int, target)) + if not target: + target = [event.group_id] for t in target: if not t.isdigit() and t != '全部': await ban_greet.finish('请输入要禁用|启用群欢迎的正确的群号') @@ -159,9 +161,9 @@ async def _(event: MessageEvent, regex_dict: dict = RegexDict()): config.group_ban = ['全部'] if type in {'禁用', '关闭'} else [] elif type in {'禁用', '关闭'}: if t not in config.group_ban: - config.group_ban.append(int(t)) + config.group_ban.append(t) elif t in config.group_ban: - config.group_ban.remove(int(t)) + config.group_ban.remove(t) config.save() await ban_greet.finish(f'已{type}群{" ".join(target)}的群欢迎') diff --git a/LittlePaimon/utils/message.py b/LittlePaimon/utils/message.py index 12af349..7a9e49e 100644 --- a/LittlePaimon/utils/message.py +++ b/LittlePaimon/utils/message.py @@ -369,7 +369,7 @@ def format_message(text: str, **kwargs) -> Message: for text in texts: if text == '{nickname}': msg += MessageSegment.text(NICKNAME) - elif text in '{at_user}': + elif text == '{at_user}': msg += MessageSegment.at(kwargs['user_id']) if 'user_id' in kwargs else MessageSegment.text('{at_user}') elif text.startswith(('{img', '{voice', '{video')): url = text.split(':', 1)[1].strip('}') diff --git a/README.md b/README.md index 0b661f2..4822580 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@
@@ -15,22 +15,56 @@ 原神多功能机器人,通过米游社接口查询uid的游戏信息,并提供WIKI查询和各种各样的好玩的功能。 -该分支正在积极**开发中**,核心功能基本完成,欢迎帮助测试! +该分支正在积极**开发中**,尚未发布正式版本,欢迎帮助测试和提出宝贵意见! -## | 新特性 -> 相较于主分支而言 -- 1、全新风格UI,好看! -- 2、代码结构更优美,更高性能! -- 3、集成插件权限管理器、自动帮助图生成 -- 4、可用Web UI添加私人Cookie -- 5、须弥支持! +## | 功能示例 +