Skip to content

fix: GetMsg returns group_name when message's type is Group.#609

Merged
linyuchen merged 1 commit into
LLOneBot:mainfrom
HLfromZ:main
Aug 21, 2025
Merged

fix: GetMsg returns group_name when message's type is Group.#609
linyuchen merged 1 commit into
LLOneBot:mainfrom
HLfromZ:main

Conversation

@HLfromZ
Copy link
Copy Markdown
Contributor

@HLfromZ HLfromZ commented Aug 21, 2025

GetMsg返回群消息时没有返回群名,本修改增加了此信息的返回。
方便做日志记录,展示信息…

Sourcery 总结

错误修复:

  • 在群聊返回的消息对象中包含 group_name。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Include group_name in returned message object for group chats.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Aug 21, 2025

审阅者指南(在小型 PRs 上折叠)

审阅者指南

通过将 peerName 分配给新字段并更新消息类型定义,增强 GetMsg 以在返回群组消息时包含群组名称。

GetMsg 在群组消息中返回 group_name 的序列图

sequenceDiagram
participant GetMsg
participant Message
participant Response
GetMsg->>Message: Fetch message
Message-->>GetMsg: Return message object
GetMsg->>Response: Set group_name = peerName (if message_type is 'group')
Response-->>GetMsg: Return message with group_name
Loading

更新后的 OB11Message 结构类图

classDiagram
class OB11Message {
  real_id?: number
  user_id: number
  group_id?: number
  group_name?: string
  message_type: 'private' | 'group'
  sub_type?: 'friend' | 'group' | 'normal'
  sender: OB11Sender
}
class OB11Sender
OB11Message --> OB11Sender
Loading

文件级别变更

变更项 详情 文件
GetMsg 返回的群组消息中添加 group_name 字段
  • chatTypeGroup 时,将 resMsg.group_namemsg.peerName 赋值
  • OB11Message 接口中声明可选的 group_name 属性
src/onebot11/entities.ts
src/onebot11/types.ts

可能关联的问题

  • #0: 此 PR 为群组消息添加了 group_name 字段,直接解决了该问题的请求。

提示与命令

与 Sourcery 互动

  • 触发新审阅: 在拉取请求上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub 问题: 通过回复审阅评论,要求 Sourcery 从中创建问题。您也可以回复审阅评论并添加 @sourcery-ai issue 来创建问题。
  • 生成拉取请求标题: 随时在拉取请求标题的任意位置写入 @sourcery-ai 以生成标题。您也可以在拉取请求上评论 @sourcery-ai title 以随时(重新)生成标题。
  • 生成拉取请求摘要: 随时在拉取请求正文的任意位置写入 @sourcery-ai summary 以在您想要的位置生成 PR 摘要。您也可以在拉取请求上评论 @sourcery-ai summary 以随时(重新)生成摘要。
  • 生成审阅者指南: 在拉取请求上评论 @sourcery-ai guide 以随时(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在拉取请求上评论 @sourcery-ai resolve 以解决所有 Sourcery 评论。如果您已解决所有评论且不想再看到它们,这会很有用。
  • 驳回所有 Sourcery 审阅: 在拉取请求上评论 @sourcery-ai dismiss 以驳回所有现有 Sourcery 审阅。如果您想从头开始进行新审阅,这尤其有用——别忘了评论 @sourcery-ai review 来触发新审阅!

自定义您的体验

访问您的 仪表盘 以:

  • 启用或禁用审阅功能,例如 Sourcery 生成的拉取请求摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Enhance GetMsg to include the group’s name when returning group messages by assigning the peerName to a new field and updating the message type definition.

Sequence diagram for GetMsg returning group_name in group messages

sequenceDiagram
participant GetMsg
participant Message
participant Response
GetMsg->>Message: Fetch message
Message-->>GetMsg: Return message object
GetMsg->>Response: Set group_name = peerName (if message_type is 'group')
Response-->>GetMsg: Return message with group_name
Loading

Class diagram for updated OB11Message structure

classDiagram
class OB11Message {
  real_id?: number
  user_id: number
  group_id?: number
  group_name?: string
  message_type: 'private' | 'group'
  sub_type?: 'friend' | 'group' | 'normal'
  sender: OB11Sender
}
class OB11Sender
OB11Message --> OB11Sender
Loading

File-Level Changes

Change Details Files
Add group_name field to group messages returned by GetMsg
  • Assign resMsg.group_name from msg.peerName when chatType is Group
  • Declare optional group_name property in OB11Message interface
src/onebot11/entities.ts
src/onebot11/types.ts

Possibly linked issues

  • #0: The PR adds the group_name field to group messages, directly addressing the issue's request.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

你好 - 我已经审查了你的更改,它们看起来很棒!


Sourcery 对开源免费 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我更有用!请在每条评论上点击 👍 或 👎,我将利用这些反馈改进你的评论。
Original comment in English

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@linyuchen linyuchen merged commit 0ba1b61 into LLOneBot:main Aug 21, 2025
1 check passed
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.

2 participants