mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 09:08:38 +00:00
refactor: share discord trailing media delivery
This commit is contained in:
@@ -336,6 +336,18 @@ export async function deliverDiscordReply(params: {
|
|||||||
if (!firstMedia) {
|
if (!firstMedia) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
const sendRemainingMedia = () =>
|
||||||
|
sendAdditionalDiscordMedia({
|
||||||
|
cfg: params.cfg,
|
||||||
|
target: params.target,
|
||||||
|
token: params.token,
|
||||||
|
rest: params.rest,
|
||||||
|
accountId: params.accountId,
|
||||||
|
mediaUrls: mediaList.slice(1),
|
||||||
|
mediaLocalRoots: params.mediaLocalRoots,
|
||||||
|
resolveReplyTo,
|
||||||
|
retryConfig,
|
||||||
|
});
|
||||||
|
|
||||||
// Voice message path: audioAsVoice flag routes through sendVoiceMessageDiscord.
|
// Voice message path: audioAsVoice flag routes through sendVoiceMessageDiscord.
|
||||||
if (payload.audioAsVoice) {
|
if (payload.audioAsVoice) {
|
||||||
@@ -367,17 +379,7 @@ export async function deliverDiscordReply(params: {
|
|||||||
retryConfig,
|
retryConfig,
|
||||||
});
|
});
|
||||||
// Additional media items are sent as regular attachments (voice is single-file only).
|
// Additional media items are sent as regular attachments (voice is single-file only).
|
||||||
await sendAdditionalDiscordMedia({
|
await sendRemainingMedia();
|
||||||
cfg: params.cfg,
|
|
||||||
target: params.target,
|
|
||||||
token: params.token,
|
|
||||||
rest: params.rest,
|
|
||||||
accountId: params.accountId,
|
|
||||||
mediaUrls: mediaList.slice(1),
|
|
||||||
mediaLocalRoots: params.mediaLocalRoots,
|
|
||||||
resolveReplyTo,
|
|
||||||
retryConfig,
|
|
||||||
});
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,17 +394,7 @@ export async function deliverDiscordReply(params: {
|
|||||||
replyTo,
|
replyTo,
|
||||||
});
|
});
|
||||||
deliveredAny = true;
|
deliveredAny = true;
|
||||||
await sendAdditionalDiscordMedia({
|
await sendRemainingMedia();
|
||||||
cfg: params.cfg,
|
|
||||||
target: params.target,
|
|
||||||
token: params.token,
|
|
||||||
rest: params.rest,
|
|
||||||
accountId: params.accountId,
|
|
||||||
mediaUrls: mediaList.slice(1),
|
|
||||||
mediaLocalRoots: params.mediaLocalRoots,
|
|
||||||
resolveReplyTo,
|
|
||||||
retryConfig,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binding && deliveredAny) {
|
if (binding && deliveredAny) {
|
||||||
|
|||||||
Reference in New Issue
Block a user