Skip to content

feat(send_message): add Discord media attachment support#10193

Closed
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:feat/discord-media-send-message
Closed

feat(send_message): add Discord media attachment support#10193
sprmn24 wants to merge 1 commit into
NousResearch:mainfrom
sprmn24:feat/discord-media-send-message

Conversation

@sprmn24

@sprmn24 sprmn24 commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds native media delivery to send_message for Discord, bringing it to parity with Telegram.

Before this PR, any MEDIA tag in a Discord-targeted send_message call was silently dropped with a warning. Now images, videos, audio, and documents are uploaded via Discord's multipart/form-data API.

Type of Change

  • New feature

Changes Made

  • _send_discord(): added media_files parameter; uploads each file as a separate files[0] multipart POST
  • _send_to_platform(): Discord now has its own pre-loop block (same pattern as Telegram) so media_files are passed only on the last chunk
  • Updated error/warning strings from "only supported for telegram" to "telegram and discord"
  • Upload failures collected as warnings, not hard errors — consistent with Telegram behavior

How to Test

Ask the agent to send an image to a Discord channel via send_message. Previously the image would be omitted; now it appears as an attachment.

Checklist

  • Follows existing Telegram media handling pattern
  • No new dependencies (aiohttp already required)

Previously send_message only supported media delivery for Telegram.
Discord users received a warning that media was omitted.

- Add media_files parameter to _send_discord()
- Upload media via Discord multipart/form-data API (files[0] field)
- Handle Discord in _send_to_platform() same way as Telegram block
- Remove Discord from generic chunk loop (now handled above)
- Update error/warning strings to mention telegram and discord
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #10246. Your commit was cherry-picked onto current main with your authorship preserved in git log. Follow-up fixes added: file handle bug (POST was outside the with open() block), warning text accuracy, and 8 unit tests. Thanks for the contribution!

@sprmn24

sprmn24 commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the fixes and the detailed follow-up 🙏

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.

2 participants