Skip to content

feat:add onebotv11 face send and accept but some face no name. #1543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

fdc310
Copy link
Contributor

@fdc310 fdc310 commented Jun 18, 2025

概述 / Overview

增加了onbotv11适配器的接受和发送表情的功能,新增了face消息类,将超级表情骰子和划拳一同归为face,但是有部分古老表情在消息中拿不到face_name,如需要需要需插件或者后续将表情表适配?

检查清单 / Checklist

PR 作者完成 / For PR author

请在方括号间写x以打勾 / Please tick the box with x

  • 阅读仓库贡献指引了吗? / Have you read the contribution guide?
  • 与项目所有者沟通过了吗? / Have you communicated with the project maintainer?
  • 我确定已自行测试所作的更改,确保功能符合预期。 / I have tested the changes and ensured they work as expected.

项目维护者完成 / For project maintainer

  • 相关 issues 链接了吗? / Have you linked the related issues?
  • 配置项写好了吗?迁移写好了吗?生效了吗? / Have you written the configuration items? Have you written the migration? Has it taken effect?
  • 依赖加到 pyproject.toml 和 core/bootutils/deps.py 了吗 / Have you added the dependencies to pyproject.toml and core/bootutils/deps.py?
  • 文档编写了吗? / Have you written the documentation?

@RockChinQ RockChinQ requested a review from Copilot June 18, 2025 13:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for handling face messages in the onbotv11 adapter, grouping certain emoji types—including dice and rock-paper-scissors—under the new Face message class. Key changes include:

  • Updating the File message component to initialize size as an integer.
  • Adding a new Face message class with dedicated str and rps_data methods.
  • Enhancing message conversion in aiocqhttp to process face, rps, and dice messages.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/platform/types/message.py Updated File component and introduced new Face message class.
pkg/platform/sources/aiocqhttp.py Implemented conversion logic for face, rps, and dice messages.

2 : "剪刀",
3 : "石头",
}
return rps_dict[face_id]
Copy link
Preview

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using dictionary get() with a default value or handling the missing key explicitly to avoid a potential KeyError if an unexpected face_id is passed.

Suggested change
return rps_dict[face_id]
return rps_dict.get(face_id, "未知")

Copilot uses AI. Check for mistakes.

face_id = msg.data['id']
face_name = msg.data['raw']['faceText']
if not face_name:
face_name = get_face_name(face_id)
Copy link
Preview

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Face IDs in the face_code_dict are specified as strings; consider converting face_id to a string (or updating the dictionary keys) to ensure a successful lookup.

Suggested change
face_name = get_face_name(face_id)
face_name = get_face_name(str(face_id))

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant