From 175ea61edaa05451c15de4406710b26b1ea1efdf Mon Sep 17 00:00:00 2001 From: corolin Date: Tue, 18 Mar 2025 23:23:23 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E6=A3=80=E6=9F=A5=E4=BB=A5=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此更改引入了一种新的方式来通过检查特定的环境变量是否被设置来确认最终用户许可协议(EULA)和隐私政策。如果 `EULA_AGREE` 或 `PRIVACY_AGREE` 与各自的新哈希值匹配,则认为这些协议已被确认,用户将不会被再次提示确认。此外,提示消息也已更新,告知用户这一新选项。 --- bot.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index e8f3ae806..e4726f14a 100644 --- a/bot.py +++ b/bot.py @@ -205,6 +205,9 @@ def check_eula(): if eula_new_hash == confirmed_content: eula_confirmed = True eula_updated = False + if eula_new_hash == os.getenv("EULA_AGREE"): + eula_confirmed = True + eula_updated = False # 检查隐私条款确认文件是否存在 if privacy_confirm_file.exists(): @@ -213,11 +216,14 @@ def check_eula(): if privacy_new_hash == confirmed_content: privacy_confirmed = True privacy_updated = False + if privacy_new_hash == os.getenv("PRIVACY_AGREE"): + privacy_confirmed = True + privacy_updated = False # 如果EULA或隐私条款有更新,提示用户重新确认 if eula_updated or privacy_updated: print("EULA或隐私条款内容已更新,请在阅读后重新确认,继续运行视为同意更新后的以上两款协议") - print('输入"同意"或"confirmed"继续运行') + print(f'输入"同意"或"confirmed"或设置环境变量"EULA_AGREE={eula_new_hash}"和"PRIVACY_AGREE={privacy_new_hash}"继续运行') while True: user_input = input().strip().lower() if user_input in ['同意', 'confirmed']: From 609aaa9be532b117f60ca36ad66da949d8aea0a0 Mon Sep 17 00:00:00 2001 From: Corolin Date: Wed, 19 Mar 2025 10:26:34 +0800 Subject: [PATCH 2/7] Update docker-image.yml --- .github/workflows/docker-image.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c06d967ca..e88dbf63b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,18 +22,18 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKERHUB_USERNAME }} + username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Determine Image Tags id: tags run: | if [[ "${{ github.ref }}" == refs/tags/* ]]; then - echo "tags=${{ secrets.DOCKERHUB_USERNAME }}/maimbot:${{ github.ref_name }},${{ secrets.DOCKERHUB_USERNAME }}/maimbot:latest" >> $GITHUB_OUTPUT + echo "tags=${{ vars.DOCKERHUB_USERNAME }}/maimbot:${{ github.ref_name }},${{ vars.DOCKERHUB_USERNAME }}/maimbot:latest" >> $GITHUB_OUTPUT elif [ "${{ github.ref }}" == "refs/heads/main" ]; then - echo "tags=${{ secrets.DOCKERHUB_USERNAME }}/maimbot:main,${{ secrets.DOCKERHUB_USERNAME }}/maimbot:latest" >> $GITHUB_OUTPUT + echo "tags=${{ vars.DOCKERHUB_USERNAME }}/maimbot:main,${{ vars.DOCKERHUB_USERNAME }}/maimbot:latest" >> $GITHUB_OUTPUT elif [ "${{ github.ref }}" == "refs/heads/main-fix" ]; then - echo "tags=${{ secrets.DOCKERHUB_USERNAME }}/maimbot:main-fix" >> $GITHUB_OUTPUT + echo "tags=${{ vars.DOCKERHUB_USERNAME }}/maimbot:main-fix" >> $GITHUB_OUTPUT fi - name: Build and Push Docker Image @@ -44,5 +44,5 @@ jobs: platforms: linux/amd64,linux/arm64 tags: ${{ steps.tags.outputs.tags }} push: true - cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maimbot:buildcache - cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maimbot:buildcache,mode=max + cache-from: type=registry,ref=${{ vars.DOCKERHUB_USERNAME }}/maimbot:buildcache + cache-to: type=registry,ref=${{ vars.DOCKERHUB_USERNAME }}/maimbot:buildcache,mode=max From 6b24cdd45a62c86a83077485c44cf3b931772596 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Wed, 19 Mar 2025 18:28:52 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=BE=A4?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5f8f75627..0c635a523 100644 --- a/README.md +++ b/README.md @@ -128,11 +128,11 @@ MaiMBot是一个开源项目,我们非常欢迎你的参与。你的贡献,无论是提交bug报告、功能需求还是代码pr,都对项目非常宝贵。我们非常感谢你的支持!🎉 但无序的讨论会降低沟通效率,进而影响问题的解决速度,因此在提交任何贡献前,请务必先阅读本项目的[贡献指南](CONTRIBUTE.md) ### 💬交流群 -- [一群](https://qm.qq.com/q/VQ3XZrWgMs) 766798517 ,建议加下面的(开发和建议相关讨论)不一定有空回复,会优先写文档和代码 -- [二群](https://qm.qq.com/q/RzmCiRtHEW) 571780722 (开发和建议相关讨论)不一定有空回复,会优先写文档和代码 -- [三群](https://qm.qq.com/q/wlH5eT8OmQ) 1035228475(开发和建议相关讨论)不一定有空回复,会优先写文档和代码 -- [四群](https://qm.qq.com/q/wlH5eT8OmQ) 729957033(开发和建议相关讨论)不一定有空回复,会优先写文档和代码 - +- [五群](https://qm.qq.com/q/JxvHZnxyec) 1022489779(开发和建议相关讨论)不一定有空回复,会优先写文档和代码 +- [一群](https://qm.qq.com/q/VQ3XZrWgMs) 766798517 【已满】(开发和建议相关讨论)不一定有空回复,会优先写文档和代码 +- [二群](https://qm.qq.com/q/RzmCiRtHEW) 571780722 【已满】(开发和建议相关讨论)不一定有空回复,会优先写文档和代码 +- [三群](https://qm.qq.com/q/wlH5eT8OmQ) 1035228475【已满】(开发和建议相关讨论)不一定有空回复,会优先写文档和代码 +- [四群](https://qm.qq.com/q/wlH5eT8OmQ) 729957033【已满】(开发和建议相关讨论)不一定有空回复,会优先写文档和代码
From e0d766611b20588a1dbf7ec8527af4b5fb5d86f4 Mon Sep 17 00:00:00 2001 From: Maple127667 <98679702+Maple127667@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:21:57 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=90=88=E5=B9=B6=E8=BD=AC=E5=8F=91?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加了合并转发消息的处理,目前可以处理简单的合并转发,暂不支持嵌套转发,不支持转发内图片识别(我觉得转发内图片不该识别 --- src/plugins/chat/__init__.py | 7 ++-- src/plugins/chat/bot.py | 63 ++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/src/plugins/chat/__init__.py b/src/plugins/chat/__init__.py index 7a4f4c6f6..a54f781a0 100644 --- a/src/plugins/chat/__init__.py +++ b/src/plugins/chat/__init__.py @@ -92,8 +92,11 @@ async def _(bot: Bot): @msg_in.handle() async def _(bot: Bot, event: MessageEvent, state: T_State): - await chat_bot.handle_message(event, bot) - + #处理合并转发消息 + if "forward" in event.message: + await chat_bot.handle_forward_message(event , bot) + else : + await chat_bot.handle_message(event, bot) @notice_matcher.handle() async def _(bot: Bot, event: NoticeEvent, state: T_State): diff --git a/src/plugins/chat/bot.py b/src/plugins/chat/bot.py index 04d0dd27f..0e4553c5f 100644 --- a/src/plugins/chat/bot.py +++ b/src/plugins/chat/bot.py @@ -411,6 +411,69 @@ class ChatBot: await self.message_process(message_cq) + async def handle_forward_message(self, event: MessageEvent, bot: Bot) -> None: + """专用于处理合并转发的消息处理器""" + # 获取合并转发消息的详细信息 + forward_info = await bot.get_forward_msg(message_id=event.message_id) + messages = forward_info["messages"] + + # 构建合并转发消息的文本表示 + processed_messages = [] + for node in messages: + # 提取发送者昵称 + nickname = node["sender"].get("nickname", "未知用户") + + # 处理消息内容 + message_content = [] + for seg in node["message"]: + if seg["type"] == "text": + message_content.append(seg["data"]["text"]) + elif seg["type"] == "image": + message_content.append("[图片]") + elif seg["type"] =="face": + message_content.append("[表情]") + elif seg["type"] == "at": + message_content.append(f"@{seg['data'].get('qq', '未知用户')}") + else: + message_content.append(f"[{seg['type']}]") + + # 拼接为【昵称】+ 内容 + processed_messages.append(f"【{nickname}】{''.join(message_content)}") + + # 组合所有消息 + combined_message = "\n".join(processed_messages) + combined_message = f"合并转发消息内容:\n{combined_message}" + + # 构建用户信息(使用转发消息的发送者) + user_info = UserInfo( + user_id=event.user_id, + user_nickname=event.sender.nickname, + user_cardname=event.sender.card if hasattr(event.sender, "card") else None, + platform="qq", + ) + + # 构建群聊信息(如果是群聊) + group_info = None + if isinstance(event, GroupMessageEvent): + group_info = GroupInfo( + group_id=event.group_id, + group_name= None, + platform="qq" + ) + + # 创建消息对象 + message_cq = MessageRecvCQ( + message_id=event.message_id, + user_info=user_info, + raw_message=combined_message, + group_info=group_info, + reply_message=event.reply, + platform="qq", + ) + + # 进入标准消息处理流程 + await self.message_process(message_cq) + # 创建全局ChatBot实例 chat_bot = ChatBot() From 0b0bfdb48dacd36d56844756af6f89595b79a325 Mon Sep 17 00:00:00 2001 From: Maple127667 <98679702+Maple127667@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:25:53 +0800 Subject: [PATCH 5/7] bug-fix --- src/plugins/chat/bot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/chat/bot.py b/src/plugins/chat/bot.py index 0e4553c5f..e39d29f42 100644 --- a/src/plugins/chat/bot.py +++ b/src/plugins/chat/bot.py @@ -5,6 +5,7 @@ from nonebot.adapters.onebot.v11 import ( Bot, MessageEvent, PrivateMessageEvent, + GroupMessageEvent, NoticeEvent, PokeNotifyEvent, GroupRecallNoticeEvent, @@ -474,6 +475,6 @@ class ChatBot: # 进入标准消息处理流程 await self.message_process(message_cq) - + # 创建全局ChatBot实例 chat_bot = ChatBot() From f8b67747dd3054d7f371cbf39b5be132b7bd7aea Mon Sep 17 00:00:00 2001 From: Oct_Autumn <53611887+Oct-autumn@users.noreply.github.com> Date: Thu, 20 Mar 2025 12:34:52 +0800 Subject: [PATCH 6/7] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仓库迁移到组织后,更新Readme中相应的链接。 --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9558deb0d..c3939598d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 关于项目分支调整与贡献指南的重要通知 +![image](https://github.com/user-attachments/assets/d275bda7-84cc-474d-a18d-265819c64687)# 关于项目分支调整与贡献指南的重要通知
- 📂 致所有为麦麦提交过贡献,以及想要为麦麦提交贡献的朋友们! @@ -251,10 +251,12 @@ SengokuCola~~纯编程外行,面向cursor编程,很多代码写得不好多 感谢各位大佬! - - + + +**也感谢每一位给麦麦发展提出宝贵意见与建议的用户,感谢陪伴麦麦走到现在的你们** + ## Stargazers over time -[![Stargazers over time](https://starchart.cc/SengokuCola/MaiMBot.svg?variant=adaptive)](https://starchart.cc/SengokuCola/MaiMBot) +[![Stargazers over time](https://starchart.cc/MaiM-with-u/MaiBot.svg?variant=adaptive)](https://starchart.cc/MaiM-with-u/MaiBot) From 493525faa629a24850bff1886a556e3d745bf948 Mon Sep 17 00:00:00 2001 From: Oct_Autumn <53611887+Oct-autumn@users.noreply.github.com> Date: Thu, 20 Mar 2025 12:35:34 +0800 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c3939598d..8dea5bc15 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![image](https://github.com/user-attachments/assets/d275bda7-84cc-474d-a18d-265819c64687)# 关于项目分支调整与贡献指南的重要通知 +# 关于项目分支调整与贡献指南的重要通知
- 📂 致所有为麦麦提交过贡献,以及想要为麦麦提交贡献的朋友们!