Skip to content

chore: update version to 7.12.7#747

Merged
idranme merged 3 commits intomainfrom
dev
Apr 28, 2026
Merged

chore: update version to 7.12.7#747
idranme merged 3 commits intomainfrom
dev

Conversation

@idranme
Copy link
Copy Markdown
Collaborator

@idranme idranme commented Apr 28, 2026

由 Sourcery 提供的摘要

添加对以群公告变体形式发送和获取群组“新成员说明”的支持,增强成员信息获取的日志记录,并将项目版本升级到 7.12.7。

新功能:

  • 通过新增的 send_new_member 标记支持将群公告配置为以新成员说明的形式发送。
  • 在获取群公告时暴露 send_new_member 状态。

增强:

  • 在获取群成员详情时,记录所使用的用户详情 API 路径以及基础成员信息。
  • 根据公告类型,将公告发布路由到相应的 Web API 端点。

构建:

  • 为 7.12.7 版本更新已发布包的元数据。

文档:

  • 为新版本调整打包的文档资源。

杂项:

  • 将应用版本号从 7.12.6 提升到 7.12.7。
Original summary in English

Summary by Sourcery

Add support for sending and retrieving group instructions as a variant of group notices, enhance member info retrieval logging, and bump the project version to 7.12.7.

New Features:

  • Support configuring group notices to be sent as new-member instructions via a new send_new_member flag.
  • Expose the send_new_member state when fetching group notices.

Enhancements:

  • Log which user-detail API path is used and basic member info when retrieving group member details.
  • Route bulletin publishing to the appropriate web API endpoint depending on the notice type.

Build:

  • Update distributed package metadata for the 7.12.7 release.

Documentation:

  • Adjust bundled documentation assets for the new release.

Chores:

  • Bump the application version from 7.12.6 to 7.12.7.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 28, 2026

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

审阅者指南

实现对新的 “send_new_member” 群公告模式的支持,更新群成员信息拉取逻辑并增加日志记录,根据类型将特定群公告路由到不同的 Web API 端点,并将项目版本提升到 7.12.7。

使用 send_new_member 模式发送群公告的时序图

sequenceDiagram
  actor BotUser
  participant SendGroupNotice
  participant NTQQWebApi
  participant QQWebServerNotice
  participant QQWebServerInstruction

  BotUser->>SendGroupNotice: sendGroupNotice(payload)
  SendGroupNotice->>SendGroupNotice: validate payload
  SendGroupNotice->>SendGroupNotice: type = payload.send_new_member ? 20 : 1
  SendGroupNotice->>NTQQWebApi: publishGroupBulletin(groupCode, content, type, pinned, isShowEditCard, tipWindowType, confirmRequired, imgId, imgWidth, imgHeight)

  alt type == 20
    NTQQWebApi->>QQWebServerInstruction: POST /cgi-bin/announce/add_qun_instruction
  else type == 1
    NTQQWebApi->>QQWebServerNotice: POST /cgi-bin/announce/add_qun_notice
  end

  NTQQWebApi-->>SendGroupNotice: response
  SendGroupNotice-->>BotUser: success
Loading

更新后的 GetGroupMemberInfo 拉取与日志记录时序图

sequenceDiagram
  participant GetGroupMemberInfo
  participant NTQQUserApi as NTQQUserApi
  participant Logger

  GetGroupMemberInfo->>NTQQUserApi: getUserDetailInfoWithBizInfo(uid)
  alt primary call succeeds
    NTQQUserApi-->>GetGroupMemberInfo: info
    GetGroupMemberInfo->>Logger: info(info.simpleInfo.baseInfo)
    GetGroupMemberInfo->>GetGroupMemberInfo: map info to OB11GroupMember
  else primary call throws
    GetGroupMemberInfo->>NTQQUserApi: fetchUserDetailInfo(uid)
    alt fallback call succeeds
      NTQQUserApi-->>GetGroupMemberInfo: fetchInfo
      GetGroupMemberInfo->>GetGroupMemberInfo: info = fetchInfo.detail.get(uid)
      GetGroupMemberInfo->>Logger: info(fetchUserDetailInfo)
      GetGroupMemberInfo->>Logger: info(info.simpleInfo.baseInfo)
      GetGroupMemberInfo->>GetGroupMemberInfo: map info to OB11GroupMember
    else fallback call throws
      GetGroupMemberInfo->>GetGroupMemberInfo: return without updating
    end
  end
Loading

更新后的群公告动作与 NTQQWebApi 的类图

classDiagram

  class BaseAction {
  }

  class SendGroupNotice {
    +_handle(payload Payload) Promise~null~
  }
  SendGroupNotice --|> BaseAction

  class Payload {
    +number group_id
    +string content
    +boolean pinned
    +boolean confirm_required
    +boolean is_show_edit_card
    +boolean tip_window
    +boolean send_new_member
    +string image
  }

  class GetGroupNotice {
    +_handle(payload GetGroupNoticePayload) Promise~Notice[]~
  }
  GetGroupNotice --|> BaseAction

  class GetGroupNoticePayload {
    +number group_id
  }

  class Notice {
    +number group_id
    +string sender_id
    +NoticeSetting setting
  }

  class NoticeSetting {
    +boolean is_show_edit_card
    +boolean tip_window
    +boolean confirm_required
    +boolean pinned
    +boolean send_new_member
  }

  class NTQQWebApi {
    +publishGroupBulletin(groupCode string, content string, type number, pinned number, isShowEditCard number, tipWindowType number, confirmRequired number, imgId string, imgWidth string, imgHeight string) Promise~void~
  }

  class GetGroupMemberInfo {
    +_handle(payload GetGroupMemberInfoPayload) Promise~OB11GroupMember~
  }
  GetGroupMemberInfo --|> BaseAction

  class GetGroupMemberInfoPayload {
    +number group_id
    +number user_id
  }

  class OB11GroupMember {
  }

  SendGroupNotice ..> Payload
  GetGroupNotice ..> GetGroupNoticePayload
  GetGroupNotice ..> Notice
  Notice ..> NoticeSetting
  GetGroupMemberInfo ..> GetGroupMemberInfoPayload
  GetGroupMemberInfo ..> OB11GroupMember
  SendGroupNotice ..> NTQQWebApi
Loading

文件级变更

Change Details Files
为群公告创建与获取添加对 send_new_member 标志位的支持,将其串联到底层 Web API,并将其编码为特殊的公告类型。
  • 扩展群公告的 payload 与 schema,新增一个默认值为 false 的 send_new_member 布尔字段
  • 在 SendGroupNotice 处理器中透传 send_new_member,将其映射为公告类型 20,并在行内调整参数类型转换
  • 在 GetGroupNotice 返回值中暴露 send_new_member,通过 feed.type === 20 来推导该字段
  • 当公告类型为 20 时选择 add_qun_instruction 端点,否则继续使用 add_qun_notice
src/onebot11/action/go-cqhttp/SendGroupNotice.ts
src/onebot11/action/go-cqhttp/GetGroupNotice.ts
src/ntqqapi/api/webapi.ts
在拉取群成员详情时提升健壮性与可观测性,通过记录所使用的 API 路径以及返回的基础信息来实现。
  • 在 getUserDetailInfoWithBizInfo 调用成功时记录日志
  • 在回退路径中,始终使用 fetchUserDetailInfo.detail.get(member.uid),并记录已走该路径的日志
  • 在将成员信息映射为 OB11 字段前,记录 simpleInfo.baseInfo 这个基础信息对象
src/onebot11/action/group/GetGroupMemberInfo.ts
将项目版本元数据更新为 7.12.7,并相应调整发布/文档文件。
  • 将导出的版本常量从 7.12.6 提升到 7.12.7
  • 更新 package-dist.json 中的发布元数据
  • 在 doc 目录下重命名或移动一个文本文档文件
src/version.ts
package-dist.json
a/doc/淔战扫.txt
b/doc/淔战扫.txt

提示与命令

与 Sourcery 交互

  • 触发一次新的审查: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 在审查评论下回复,请求 Sourcery 从该评论创建一个 issue。你也可以回复审查评论 @sourcery-ai issue 来从该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写上 @sourcery-ai,即可在任意时间生成标题。你也可以在 pull request 中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文任意位置写上 @sourcery-ai summary,即可在任意时间在指定位置生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审阅者指南: 在 pull request 中评论 @sourcery-ai guide,即可在任意时间(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不希望再看到它们,这会很有用。
  • 关闭所有 Sourcery 审查: 在 pull request 中评论 @sourcery-ai dismiss,即可关闭所有现有的 Sourcery 审查。尤其适用于你希望从一次全新的审查开始的场景——别忘了再评论 @sourcery-ai review 触发新的审查!

自定义你的体验

访问你的 控制面板 以:

  • 启用或禁用诸如 Sourcery 生成的 pull request 摘要、审阅者指南等审查功能。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查指令。
  • 调整其他审查设置。

获取帮助

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

Reviewer's Guide

Implements support for a new "send_new_member" group notice mode, updates group member info fetching with logging, routes specific group notices to a different web API endpoint based on type, and bumps the project version to 7.12.7.

Sequence diagram for sending group notices with send_new_member mode

sequenceDiagram
  actor BotUser
  participant SendGroupNotice
  participant NTQQWebApi
  participant QQWebServerNotice
  participant QQWebServerInstruction

  BotUser->>SendGroupNotice: sendGroupNotice(payload)
  SendGroupNotice->>SendGroupNotice: validate payload
  SendGroupNotice->>SendGroupNotice: type = payload.send_new_member ? 20 : 1
  SendGroupNotice->>NTQQWebApi: publishGroupBulletin(groupCode, content, type, pinned, isShowEditCard, tipWindowType, confirmRequired, imgId, imgWidth, imgHeight)

  alt type == 20
    NTQQWebApi->>QQWebServerInstruction: POST /cgi-bin/announce/add_qun_instruction
  else type == 1
    NTQQWebApi->>QQWebServerNotice: POST /cgi-bin/announce/add_qun_notice
  end

  NTQQWebApi-->>SendGroupNotice: response
  SendGroupNotice-->>BotUser: success
Loading

Sequence diagram for updated GetGroupMemberInfo fetching and logging

sequenceDiagram
  participant GetGroupMemberInfo
  participant NTQQUserApi as NTQQUserApi
  participant Logger

  GetGroupMemberInfo->>NTQQUserApi: getUserDetailInfoWithBizInfo(uid)
  alt primary call succeeds
    NTQQUserApi-->>GetGroupMemberInfo: info
    GetGroupMemberInfo->>Logger: info(info.simpleInfo.baseInfo)
    GetGroupMemberInfo->>GetGroupMemberInfo: map info to OB11GroupMember
  else primary call throws
    GetGroupMemberInfo->>NTQQUserApi: fetchUserDetailInfo(uid)
    alt fallback call succeeds
      NTQQUserApi-->>GetGroupMemberInfo: fetchInfo
      GetGroupMemberInfo->>GetGroupMemberInfo: info = fetchInfo.detail.get(uid)
      GetGroupMemberInfo->>Logger: info(fetchUserDetailInfo)
      GetGroupMemberInfo->>Logger: info(info.simpleInfo.baseInfo)
      GetGroupMemberInfo->>GetGroupMemberInfo: map info to OB11GroupMember
    else fallback call throws
      GetGroupMemberInfo->>GetGroupMemberInfo: return without updating
    end
  end
Loading

Class diagram for updated group notice actions and NTQQWebApi

classDiagram

  class BaseAction {
  }

  class SendGroupNotice {
    +_handle(payload Payload) Promise~null~
  }
  SendGroupNotice --|> BaseAction

  class Payload {
    +number group_id
    +string content
    +boolean pinned
    +boolean confirm_required
    +boolean is_show_edit_card
    +boolean tip_window
    +boolean send_new_member
    +string image
  }

  class GetGroupNotice {
    +_handle(payload GetGroupNoticePayload) Promise~Notice[]~
  }
  GetGroupNotice --|> BaseAction

  class GetGroupNoticePayload {
    +number group_id
  }

  class Notice {
    +number group_id
    +string sender_id
    +NoticeSetting setting
  }

  class NoticeSetting {
    +boolean is_show_edit_card
    +boolean tip_window
    +boolean confirm_required
    +boolean pinned
    +boolean send_new_member
  }

  class NTQQWebApi {
    +publishGroupBulletin(groupCode string, content string, type number, pinned number, isShowEditCard number, tipWindowType number, confirmRequired number, imgId string, imgWidth string, imgHeight string) Promise~void~
  }

  class GetGroupMemberInfo {
    +_handle(payload GetGroupMemberInfoPayload) Promise~OB11GroupMember~
  }
  GetGroupMemberInfo --|> BaseAction

  class GetGroupMemberInfoPayload {
    +number group_id
    +number user_id
  }

  class OB11GroupMember {
  }

  SendGroupNotice ..> Payload
  GetGroupNotice ..> GetGroupNoticePayload
  GetGroupNotice ..> Notice
  Notice ..> NoticeSetting
  GetGroupMemberInfo ..> GetGroupMemberInfoPayload
  GetGroupMemberInfo ..> OB11GroupMember
  SendGroupNotice ..> NTQQWebApi
Loading

File-Level Changes

Change Details Files
Add support for a send_new_member flag in group bulletin creation and retrieval, wiring it through to the underlying web API and encoding it as a special bulletin type.
  • Extend group notice payload and schema to include a send_new_member boolean with default false
  • Pass send_new_member through SendGroupNotice handler by mapping it to bulletin type 20, and adjust parameter coercions inline
  • Expose send_new_member on GetGroupNotice responses by inferring it from feed.type === 20
  • Choose the add_qun_instruction endpoint when bulletin type is 20, otherwise keep using add_qun_notice
src/onebot11/action/go-cqhttp/SendGroupNotice.ts
src/onebot11/action/go-cqhttp/GetGroupNotice.ts
src/ntqqapi/api/webapi.ts
Improve robustness and observability when fetching group member details by logging which API path was used and the returned basic info.
  • Log when getUserDetailInfoWithBizInfo succeeds
  • On fallback, always use fetchUserDetailInfo.detail.get(member.uid) and log that this path was taken
  • Log the basic simpleInfo.baseInfo object when member info is available before mapping it to OB11 fields
src/onebot11/action/group/GetGroupMemberInfo.ts
Update the project version metadata to 7.12.7 and adjust distribution/doc files accordingly.
  • Bump exported version constant from 7.12.6 to 7.12.7
  • Update package distribution metadata in package-dist.json
  • Rename or move a documentation text file under the doc directory
src/version.ts
package-dist.json
a/doc/淔战扫.txt
b/doc/淔战扫.txt

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.

Hey - 我发现了 1 个问题,并给出了一些整体反馈:

  • GetGroupMemberInfo 中,目前在使用 fetchUserDetailInfo 的返回结果前,没有再检查其是否为 null/undefined;建议在访问 fetchInfo.detail.get(member.uid) 之前恢复原有的保护判断(或进行类型断言),以避免潜在的运行时错误。
  • SendGroupNoticeNTQQWebApi.publishGroupBulletin 中,将 20 作为 send_new_member 的特殊 type 使用,这是一个“魔法数字”;建议将其提取为具名常量或枚举,以使意图更清晰,并降低误用的风险。
  • GetGroupMemberInfo 中新增的 logger.info 调用会在每次请求时打印日志,在生产环境中可能会过于嘈杂;建议使用更细粒度的日志级别(例如 debug),或者在单条日志中增加更多上下文信息,而不是多次调用。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `GetGroupMemberInfo`, the `fetchUserDetailInfo` result is now used without checking for null/undefined; consider restoring a guard (or asserting its type) before accessing `fetchInfo.detail.get(member.uid)` to avoid potential runtime errors.
- The use of `20` as the special `type` for `send_new_member` (in both `SendGroupNotice` and `NTQQWebApi.publishGroupBulletin`) is a magic number; consider extracting it into a named constant or enum to make the intent clearer and reduce the chance of misuse.
- The new `logger.info` calls in `GetGroupMemberInfo` log on every request and may be noisy in production; consider using a more granular log level (e.g., debug) or including more contextual information in a single log line instead of multiple calls.

## Individual Comments

### Comment 1
<location path="src/onebot11/action/group/GetGroupMemberInfo.ts" line_range="41" />
<code_context>
       }
     }
     if (info) {
+      this.ctx.logger.info(info.simpleInfo.baseInfo)
       ret.sex = OB11Entities.sex(info.simpleInfo.baseInfo.sex)
       ret.qq_level = info.commonExt?.qqLevel && calcQQLevel(info.commonExt.qqLevel) || 0
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Consider lowering the log level or removing this log to avoid verbose/PII-heavy output.

This logs the full `info.simpleInfo.baseInfo` object at `info` level on every call, which can be large and may include sensitive user data. If this is primarily for debugging, please either lower the level (debug/trace) or log only a minimal identifier (e.g., UID) to reduce noise and privacy risk.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
帮我变得更有用!请在每条评论上点选 👍 或 👎,我会根据反馈来改进后续的代码审查。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • In GetGroupMemberInfo, the fetchUserDetailInfo result is now used without checking for null/undefined; consider restoring a guard (or asserting its type) before accessing fetchInfo.detail.get(member.uid) to avoid potential runtime errors.
  • The use of 20 as the special type for send_new_member (in both SendGroupNotice and NTQQWebApi.publishGroupBulletin) is a magic number; consider extracting it into a named constant or enum to make the intent clearer and reduce the chance of misuse.
  • The new logger.info calls in GetGroupMemberInfo log on every request and may be noisy in production; consider using a more granular log level (e.g., debug) or including more contextual information in a single log line instead of multiple calls.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `GetGroupMemberInfo`, the `fetchUserDetailInfo` result is now used without checking for null/undefined; consider restoring a guard (or asserting its type) before accessing `fetchInfo.detail.get(member.uid)` to avoid potential runtime errors.
- The use of `20` as the special `type` for `send_new_member` (in both `SendGroupNotice` and `NTQQWebApi.publishGroupBulletin`) is a magic number; consider extracting it into a named constant or enum to make the intent clearer and reduce the chance of misuse.
- The new `logger.info` calls in `GetGroupMemberInfo` log on every request and may be noisy in production; consider using a more granular log level (e.g., debug) or including more contextual information in a single log line instead of multiple calls.

## Individual Comments

### Comment 1
<location path="src/onebot11/action/group/GetGroupMemberInfo.ts" line_range="41" />
<code_context>
       }
     }
     if (info) {
+      this.ctx.logger.info(info.simpleInfo.baseInfo)
       ret.sex = OB11Entities.sex(info.simpleInfo.baseInfo.sex)
       ret.qq_level = info.commonExt?.qqLevel && calcQQLevel(info.commonExt.qqLevel) || 0
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Consider lowering the log level or removing this log to avoid verbose/PII-heavy output.

This logs the full `info.simpleInfo.baseInfo` object at `info` level on every call, which can be large and may include sensitive user data. If this is primarily for debugging, please either lower the level (debug/trace) or log only a minimal identifier (e.g., UID) to reduce noise and privacy risk.
</issue_to_address>

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.

}
}
if (info) {
this.ctx.logger.info(info.simpleInfo.baseInfo)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 suggestion (security): 建议降低该日志的级别或移除这条日志,以避免产生过于冗长或包含大量个人敏感信息(PII)的输出。

当前在每次调用时,会以 info 级别记录完整的 info.simpleInfo.baseInfo 对象,该对象可能较大,并可能包含敏感的用户数据。如果这主要用于调试,请考虑将级别降低到 debug/trace,或者只记录最小化的标识信息(例如 UID),以减少噪声并降低隐私风险。

Original comment in English

🚨 suggestion (security): Consider lowering the log level or removing this log to avoid verbose/PII-heavy output.

This logs the full info.simpleInfo.baseInfo object at info level on every call, which can be large and may include sensitive user data. If this is primarily for debugging, please either lower the level (debug/trace) or log only a minimal identifier (e.g., UID) to reduce noise and privacy risk.

@github-actions
Copy link
Copy Markdown

Test Report

Job Status
unit-test ✅ success
e2e-test ✅ success

✅ All tests passed

@idranme idranme merged commit 8b6079f into main Apr 28, 2026
6 checks 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.

1 participant