Skip to content

fix(qqbot): support C2C DM and group messages for non-guild chat_ids - #16937

Closed
lengxii wants to merge 1 commit into
NousResearch:mainfrom
lengxii:fix/qqbot-c2c-dm-support
Closed

fix(qqbot): support C2C DM and group messages for non-guild chat_ids#16937
lengxii wants to merge 1 commit into
NousResearch:mainfrom
lengxii:fix/qqbot-c2c-dm-support

Conversation

@lengxii

@lengxii lengxii commented Apr 28, 2026

Copy link
Copy Markdown

Problem

_send_qqbot() is hardcoded to use the guild channel API (/channels/{chat_id}/messages), which returns {"message":"频道不存在","code":11263} when chat_id is a QQ user open_id (32-char hex string) instead of a numeric guild channel ID.

Fix

Detect chat_id format and route to the correct QQ Bot Open Platform endpoint:

chat_id format Target Endpoint
32-char hex C2C DM (user) /v2/users/{open_id}/messages
32-char hex + chat_type=group Group /v2/groups/{open_id}/messages
Short numeric Guild channel /channels/{channel_id}/messages

Also checks channel_directory for explicit chat_type hints.

Testing

Verified locally with QQ Bot (app_id 1903058601) — message sent successfully to a C2C DM target that previously failed with "频道不存在".

The _send_qqbot() function was hardcoded to use the guild channel API
(`/channels/{chat_id}/messages`), which fails when chat_id is a QQ
user open_id (32-char hex string) rather than a numeric guild channel ID.

This fix detects the chat_id format and routes to the correct endpoint:

- 32-char hex → C2C DM via `/v2/users/{open_id}/messages`
- 32-char hex with chat_type=group → `/v2/groups/{open_id}/messages`
- Short numeric → Guild channel via `/channels/{channel_id}/messages`

Also checks channel_directory for explicit chat_type hints.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/qqbot QQ Bot adapter labels Apr 28, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #15215 — same fix: route QQBot sends to C2C/group REST endpoints based on chat_id format.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #15215

@teknium1

teknium1 commented May 5, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded — tools/send_message_tool.py::_send_qqbot on current main already handles C2C DM and group endpoints (lines 1712, 1720, 1728). It uses a try-all-three-endpoints approach (channel → users → groups) rather than format-detection, but the same capability landed independently. Thanks for catching the missing routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists platform/qqbot QQ Bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants