Skip to content

feat(qqbot): add media attachment support for voice/image/video/file - #18321

Closed
Allonz wants to merge 2 commits into
NousResearch:mainfrom
Allonz:feat/qqbot-voice-send
Closed

feat(qqbot): add media attachment support for voice/image/video/file#18321
Allonz wants to merge 2 commits into
NousResearch:mainfrom
Allonz:feat/qqbot-voice-send

Conversation

@Allonz

@Allonz Allonz commented May 1, 2026

Copy link
Copy Markdown

Summary

Add native media attachment support for QQ Bot platform, enabling voice, image, video, and file sending via send_message tool.

Changes

  • Media upload support: Upload media files via QQ Bot v2 REST API before sending
  • Chat type detection: Support c2c:<openid> (private chat) and group:<group_openid> (group chat) target formats
  • File type mapping: Automatically detect file type from extension:
    • 1 = image (png/jpg/jpeg/gif)
    • 2 = video (mp4/mov/avi)
    • 3 = voice (mp3/wav/flac/silk/amr)
    • 4 = file (default)
  • API endpoints:
    • C2C upload: POST /v2/users/{openid}/files
    • Group upload: POST /v2/groups/{group_openid}/files
  • Message payload: Include media.file_info field when media is attached

Usage

# Send voice message to QQ user
send_message(target="qqbot:c2c:USER_OPENID", message="MEDIA:/path/to/voice.mp3")

# Send image to QQ group  
send_message(target="qqbot:group:GROUP_OPENID", message="Check this out! MEDIA:/path/to/image.png")

Notes

  • Guild channel media upload not yet supported (uses different API)
  • Uses same media_files parameter pattern as other platforms (telegram, discord, yuanbao, etc.)

- Add media file upload support to _send_qqbot function
- Support chat_type detection from target format (c2c:/group:/guild:)
- Upload media via QQ Bot v2 API (/v2/users/{openid}/files, /v2/groups/{group_openid}/files)
- Map file extensions to QQ Bot file_type (1=image, 2=video, 3=voice, 4=file)
- Include media in message payload via 'file_info' field
- Update error messages to include qqbot in supported platforms
- Update schema description with qqbot target format examples
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have platform/qqbot QQ Bot adapter labels May 1, 2026
@Allonz Allonz closed this May 1, 2026
@Allonz

Allonz commented May 1, 2026

Copy link
Copy Markdown
Author

where is some bugs in this PR,sorry,I will fix them and commit new PR up

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

Labels

P3 Low — cosmetic, nice to have platform/qqbot QQ Bot adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants