From 134d3095716e97ffbd9df95d789f21b9c42d781b Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 6 Apr 2026 03:21:58 +0100 Subject: [PATCH] fix(discord): raise default media cap --- CHANGELOG.md | 1 + docs/channels/discord.md | 2 +- docs/gateway/configuration-reference.md | 2 +- extensions/discord/src/monitor/provider.ts | 5 ++++- extensions/discord/src/send.outbound.ts | 4 +++- .../discord/src/send.sends-basic-channel-messages.test.ts | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02547896264..8ca2d40e380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -235,6 +235,7 @@ Docs: https://docs.openclaw.ai - Matrix/streaming: add a quiet preview mode for streamed Matrix replies, keep legacy `partial` preview-first behavior, and finalize quiet media captions correctly so previews stop notifying early without dropping final text semantics. (#61450) Thanks @gumadeiras. - Gateway/shutdown: bound websocket-server shutdown even when no tracked clients remain, so gateway restarts stop hanging until the watchdog kills the process. (#61565) Thanks @mbelinky. - Control UI/multilingual: localize the remaining shared channel, instances, nodes, and gateway-confirmation strings so the dashboard stops mixing translated UI with hardcoded English labels. Thanks @vincentkoc. +- Discord/media: raise the default inbound and outbound media cap to `100MB` so Discord matches Telegram more closely and larger attachments stop failing on the old low default. ## 2026.4.2 diff --git a/docs/channels/discord.md b/docs/channels/discord.md index 7fa098d45ce..2d8bcd881fe 100644 --- a/docs/channels/discord.md +++ b/docs/channels/discord.md @@ -1237,7 +1237,7 @@ High-signal Discord fields: - delivery: `textChunkLimit`, `chunkMode`, `maxLinesPerMessage` - streaming: `streaming` (legacy alias: `streamMode`), `draftChunk`, `blockStreaming`, `blockStreamingCoalesce` - media/retry: `mediaMaxMb`, `retry` - - `mediaMaxMb` caps outbound Discord uploads (default: `8MB`) + - `mediaMaxMb` caps outbound Discord uploads (default: `100MB`) - actions: `actions.*` - presence: `activity`, `status`, `activityType`, `activityUrl` - UI: `ui.components.accentColor` diff --git a/docs/gateway/configuration-reference.md b/docs/gateway/configuration-reference.md index 40fc863492c..1d752fb9571 100644 --- a/docs/gateway/configuration-reference.md +++ b/docs/gateway/configuration-reference.md @@ -220,7 +220,7 @@ WhatsApp runs through the gateway's web channel (Baileys Web). It starts automat discord: { enabled: true, token: "your-bot-token", - mediaMaxMb: 8, + mediaMaxMb: 100, allowBots: false, actions: { reactions: true, diff --git a/extensions/discord/src/monitor/provider.ts b/extensions/discord/src/monitor/provider.ts index 1beca6028dd..99bb61bc171 100644 --- a/extensions/discord/src/monitor/provider.ts +++ b/extensions/discord/src/monitor/provider.ts @@ -94,6 +94,8 @@ export type MonitorDiscordOpts = { setStatus?: DiscordMonitorStatusSink; }; +const DEFAULT_DISCORD_MEDIA_MAX_MB = 100; + type DiscordVoiceManager = import("../voice/manager.js").DiscordVoiceManager; type DiscordVoiceRuntimeModule = typeof import("../voice/manager.runtime.js"); @@ -613,7 +615,8 @@ export async function monitorDiscordProvider(opts: MonitorDiscordOpts = {}) { log: (message) => runtime.log?.(warn(message)), }); let allowFrom = discordCfg.allowFrom ?? dmConfig?.allowFrom; - const mediaMaxBytes = (opts.mediaMaxMb ?? discordCfg.mediaMaxMb ?? 8) * 1024 * 1024; + const mediaMaxBytes = + (opts.mediaMaxMb ?? discordCfg.mediaMaxMb ?? DEFAULT_DISCORD_MEDIA_MAX_MB) * 1024 * 1024; const textLimit = resolveTextChunkLimit(cfg, "discord", account.accountId, { fallbackLimit: 2000, }); diff --git a/extensions/discord/src/send.outbound.ts b/extensions/discord/src/send.outbound.ts index c0e8f387d5a..ca13d9a5b64 100644 --- a/extensions/discord/src/send.outbound.ts +++ b/extensions/discord/src/send.outbound.ts @@ -67,6 +67,8 @@ type DiscordSendOpts = { type DiscordClientRequest = ReturnType["request"]; +const DEFAULT_DISCORD_MEDIA_MAX_MB = 100; + type DiscordChannelMessageResult = { id?: string | null; channel_id?: string | null; @@ -155,7 +157,7 @@ export async function sendMessageDiscord( const mediaMaxBytes = typeof accountInfo.config.mediaMaxMb === "number" ? accountInfo.config.mediaMaxMb * 1024 * 1024 - : 8 * 1024 * 1024; + : DEFAULT_DISCORD_MEDIA_MAX_MB * 1024 * 1024; const textWithTables = convertMarkdownTables(text ?? "", tableMode); const textWithMentions = rewriteDiscordKnownMentions(textWithTables, { accountId: accountInfo.accountId, diff --git a/extensions/discord/src/send.sends-basic-channel-messages.test.ts b/extensions/discord/src/send.sends-basic-channel-messages.test.ts index a60b98d023a..8adfd877967 100644 --- a/extensions/discord/src/send.sends-basic-channel-messages.test.ts +++ b/extensions/discord/src/send.sends-basic-channel-messages.test.ts @@ -316,7 +316,7 @@ describe("sendMessageDiscord", () => { ); expect(loadWebMedia).toHaveBeenCalledWith( "file:///tmp/photo.jpg", - expect.objectContaining({ maxBytes: 8 * 1024 * 1024 }), + expect.objectContaining({ maxBytes: 100 * 1024 * 1024 }), ); });