Skip to content

feat(qq): Add QQ bot support to the message channel.#2411

Closed
wm7799 wants to merge 2 commits into
NousResearch:mainfrom
wm7799:fix-qq-timestamp-indentation
Closed

feat(qq): Add QQ bot support to the message channel.#2411
wm7799 wants to merge 2 commits into
NousResearch:mainfrom
wm7799:fix-qq-timestamp-indentation

Conversation

@wm7799

@wm7799 wm7799 commented Mar 22, 2026

Copy link
Copy Markdown

Problem

QQ Bot crashes when receiving C2C messages:

Error parsing event: invalid literal for int() with base 10: '2026-03-22T08:55:03+08:00'

Additionally, gateway fails to restart due to indentation errors.

Root Cause

  • QQ API changed timestamp from integer milliseconds to ISO 8601 string.
  • _handle_c2c_message and _handle_group_message called int() directly on the timestamp.
  • Mixed indentation caused IndentationError on gateway restart.
  • gateway/run.py lacked Platform.QQ in env maps, preventing per-user allowlist.

Changes

  1. gateway/platforms/qq.py
    • Compatible timestamp parsing: supports both integer strings and ISO 8601
    • Rewrote both handlers with uniform indentation
  2. gateway/run.py (optional)
    • Added Platform.QQ to platform_env_map and platform_allow_all_map

Testing

  • ✅ QQ private messages received and replied
  • ✅ Logs show clean processing flow without errors
  • ✅ Gateway restart successful

Notes

  • QQ C2C requires friendship and C2C_MESSAGE_CREATE subscription.
  • Group messages require @bot and GROUP_AT_MESSAGE_CREATE.

Co-authored-by: Hermes Agent agent@hermes

- Fix _handle_c2c_message and _handle_group_message to support ISO 8601 timestamp format
- Rewrite both handlers with uniform indentation to prevent IndentationError
- Add Platform.QQ to platform_env_map and platform_allow_all_map

This resolves the crash when receiving C2C messages and enables per-user allowlist control.

Co-authored-by: Hermes Agent <agent@hermes>
@wm7799

wm7799 commented Mar 22, 2026

Copy link
Copy Markdown
Author

前几天我看你们添加了钉钉的支持。QQ用户比钉钉用户更多,所以写了这个。希望合并分支,添加对QQ机器人支持。 已经充分测试,发送接收消息正常。

@wm7799 wm7799 changed the title feat(qq): support ISO 8601 timestamp and fix indentation feat(qq): Add QQ bot support to the message channel. Mar 22, 2026
QQ platform requires aiohttp for HTTP/WebSocket. Add to main deps.

Co-authored-by: Hermes Agent <agent@hermes>
@wm7799 wm7799 force-pushed the fix-qq-timestamp-indentation branch from f8b0cc3 to 8ccdeba Compare March 22, 2026 03:08
@Readon Readon mentioned this pull request Mar 30, 2026
23 tasks
@lhear

lhear commented Apr 11, 2026

Copy link
Copy Markdown

不支持markdown吗?

teknium1 added a commit that referenced this pull request Apr 14, 2026
- Add Platform.QQBOT to _UPDATE_ALLOWED_PLATFORMS (enables /update command)
- Add 'qqbot' to webhook cross-platform delivery routing
- Add 'qqbot' to hermes dump platform detection
- Fix test_name_property casing: 'QQBot' not 'QQBOT'
- Add _parse_qq_timestamp() for ISO 8601 + integer ms compatibility
  (QQ API changed timestamp format — from PR #2411 finding)
- Wire timestamp parsing into all 4 message handlers
teknium1 added a commit that referenced this pull request Apr 14, 2026
- Add Platform.QQBOT to _UPDATE_ALLOWED_PLATFORMS (enables /update command)
- Add 'qqbot' to webhook cross-platform delivery routing
- Add 'qqbot' to hermes dump platform detection
- Fix test_name_property casing: 'QQBot' not 'QQBOT'
- Add _parse_qq_timestamp() for ISO 8601 + integer ms compatibility
  (QQ API changed timestamp format — from PR #2411 finding)
- Wire timestamp parsing into all 4 message handlers
@teknium1

Copy link
Copy Markdown
Contributor

Superseded by PR #9364 (now merged), which ships the QQ Bot platform adapter based on #7616's raw Official API v2 implementation. Thank you for your contribution — insights from your PR informed the final adapter.

@teknium1 teknium1 closed this Apr 14, 2026
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
- Add Platform.QQBOT to _UPDATE_ALLOWED_PLATFORMS (enables /update command)
- Add 'qqbot' to webhook cross-platform delivery routing
- Add 'qqbot' to hermes dump platform detection
- Fix test_name_property casing: 'QQBot' not 'QQBOT'
- Add _parse_qq_timestamp() for ISO 8601 + integer ms compatibility
  (QQ API changed timestamp format — from PR NousResearch#2411 finding)
- Wire timestamp parsing into all 4 message handlers
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
- Add Platform.QQBOT to _UPDATE_ALLOWED_PLATFORMS (enables /update command)
- Add 'qqbot' to webhook cross-platform delivery routing
- Add 'qqbot' to hermes dump platform detection
- Fix test_name_property casing: 'QQBot' not 'QQBOT'
- Add _parse_qq_timestamp() for ISO 8601 + integer ms compatibility
  (QQ API changed timestamp format — from PR NousResearch#2411 finding)
- Wire timestamp parsing into all 4 message handlers
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
- Add Platform.QQBOT to _UPDATE_ALLOWED_PLATFORMS (enables /update command)
- Add 'qqbot' to webhook cross-platform delivery routing
- Add 'qqbot' to hermes dump platform detection
- Fix test_name_property casing: 'QQBot' not 'QQBOT'
- Add _parse_qq_timestamp() for ISO 8601 + integer ms compatibility
  (QQ API changed timestamp format — from PR NousResearch#2411 finding)
- Wire timestamp parsing into all 4 message handlers
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
- Add Platform.QQBOT to _UPDATE_ALLOWED_PLATFORMS (enables /update command)
- Add 'qqbot' to webhook cross-platform delivery routing
- Add 'qqbot' to hermes dump platform detection
- Fix test_name_property casing: 'QQBot' not 'QQBOT'
- Add _parse_qq_timestamp() for ISO 8601 + integer ms compatibility
  (QQ API changed timestamp format — from PR NousResearch#2411 finding)
- Wire timestamp parsing into all 4 message handlers
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
- Add Platform.QQBOT to _UPDATE_ALLOWED_PLATFORMS (enables /update command)
- Add 'qqbot' to webhook cross-platform delivery routing
- Add 'qqbot' to hermes dump platform detection
- Fix test_name_property casing: 'QQBot' not 'QQBOT'
- Add _parse_qq_timestamp() for ISO 8601 + integer ms compatibility
  (QQ API changed timestamp format — from PR NousResearch#2411 finding)
- Wire timestamp parsing into all 4 message handlers
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.

3 participants