mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 04:40:23 +00:00
fix(discord): raise default media cap
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 }),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user