fix(discord): raise default media cap

This commit is contained in:
Peter Steinberger
2026-04-06 03:21:58 +01:00
parent c45f1ac8ce
commit 134d309571
6 changed files with 11 additions and 5 deletions

View File

@@ -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

View File

@@ -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`

View File

@@ -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,

View File

@@ -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,
});

View File

@@ -67,6 +67,8 @@ type DiscordSendOpts = {
type DiscordClientRequest = ReturnType<typeof createDiscordClient>["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,

View File

@@ -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 }),
);
});