mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
fix(adapters): restructure sendPayload media loop to avoid uninitialized lastResult
This commit is contained in:
committed by
Peter Steinberger
parent
d06ee86292
commit
ebe54e6903
@@ -525,15 +525,19 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
|
||||
? [ctx.payload.mediaUrl]
|
||||
: [];
|
||||
if (urls.length > 0) {
|
||||
let lastResult;
|
||||
for (let i = 0; i < urls.length; i++) {
|
||||
let lastResult = await zalouserPlugin.outbound!.sendMedia!({
|
||||
...ctx,
|
||||
text: ctx.payload.text ?? "",
|
||||
mediaUrl: urls[0],
|
||||
});
|
||||
for (let i = 1; i < urls.length; i++) {
|
||||
lastResult = await zalouserPlugin.outbound!.sendMedia!({
|
||||
...ctx,
|
||||
text: i === 0 ? (ctx.payload.text ?? "") : "",
|
||||
text: "",
|
||||
mediaUrl: urls[i],
|
||||
});
|
||||
}
|
||||
return lastResult!;
|
||||
return lastResult;
|
||||
}
|
||||
return zalouserPlugin.outbound!.sendText!({ ...ctx });
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user