Skip to content

feat(platform): enrich group metadata across adapters - #9851

Open
Soulter wants to merge 1 commit into
AstrBotDevs:masterfrom
Soulter:codex/group-info-adapters
Open

feat(platform): enrich group metadata across adapters#9851
Soulter wants to merge 1 commit into
AstrBotDevs:masterfrom
Soulter:codex/group-info-adapters

Conversation

@Soulter

@Soulter Soulter commented Aug 27, 2026

Copy link
Copy Markdown
Member

Motivation

Group metadata support was inconsistent across platform adapters. Many incoming group messages only exposed an ID, while AstrMessageEvent.get_group() either returned no data or platform-specific partial results. This prevented conversation aliases and plugins from reliably displaying human-readable group information.

Modifications / 改动点

  • Add Group.member_count and make the base get_group() return inbound or ID-only metadata as a safe fallback.

  • Attach available group names to incoming messages without adding network requests to the hot path.

  • Enrich group name, avatar, owner, administrators, member count, and members where supported by aiocqhttp, QQ Official, Lark, Discord, Telegram, Slack, Mattermost, KOOK, LINE, Misskey, and Satori.

  • Preserve basic metadata when optional platform APIs fail, and avoid exposing incomplete member lists as complete results.

  • Resolve Lark private-message sender names through Contact v3 with bounded positive and negative caches, a five-second lookup timeout, and documented Contact scopes.

  • Use guild-channel display names for Discord group sessions.

  • Use group-topic display names for Telegram forum topics when the Bot API has exposed the topic name through creation, edit, or root service messages. Unknown topic names safely fall back to the parent group name because the Bot API has no topic-by-ID lookup.

  • Add adapter and fallback regression coverage without introducing new dependencies.

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

Verification commands:

git diff --name-only origin/master...HEAD | rg "^tests/.*[.]py$" | xargs uv run pytest -q
uv run ruff format --check .
uv run ruff check .
git diff --check origin/master...HEAD

Results:

  • 225 affected tests passed.
  • Ruff format and lint checks passed for the full repository.
  • Diff whitespace validation passed.

Checklist / 检查清单

  • 😊 This feature was discussed with the project maintainer before implementation.
  • 👀 The changes are covered by regression tests and verification steps are provided above.
  • 🤓 No new dependencies are introduced.
  • 😮 The changes do not introduce malicious code.

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Aug 27, 2026

@sourcery-ai sourcery-ai Bot left a comment

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.

Sorry @Soulter, your pull request is larger than the review limit of 150,000 diff characters

@dosubot dosubot Bot added the area:platform The bug / feature is about IM platform adapter, such as QQ, Lark, Telegram, WebChat and so on. label Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:platform The bug / feature is about IM platform adapter, such as QQ, Lark, Telegram, WebChat and so on. size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant