openclaw-quiubo 2.6.27 → 2.6.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -5
- package/dist/index.js.map +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14232,8 +14232,29 @@ async function routeInboundMessage(opts) {
|
|
|
14232
14232
|
const imageAttachments = (msg.attachments ?? []).filter(
|
|
14233
14233
|
(att) => att.storageUrl && att.mimeType?.startsWith("image/")
|
|
14234
14234
|
);
|
|
14235
|
-
const
|
|
14236
|
-
const mediaTypes =
|
|
14235
|
+
const mediaPaths = [];
|
|
14236
|
+
const mediaTypes = [];
|
|
14237
|
+
if (imageAttachments.length > 0) {
|
|
14238
|
+
const mediaDir = join2(process.env.HOME ?? process.env.USERPROFILE ?? "", ".openclaw", "media", "inbound");
|
|
14239
|
+
await mkdir2(mediaDir, { recursive: true });
|
|
14240
|
+
for (const att of imageAttachments) {
|
|
14241
|
+
try {
|
|
14242
|
+
const resp = await fetch(att.storageUrl);
|
|
14243
|
+
if (!resp.ok) {
|
|
14244
|
+
log?.warn?.(`[${accountId}] Failed to download attachment ${att.filename}: ${resp.status}`);
|
|
14245
|
+
continue;
|
|
14246
|
+
}
|
|
14247
|
+
const buffer = Buffer.from(await resp.arrayBuffer());
|
|
14248
|
+
const ext = att.filename?.split(".").pop() || "png";
|
|
14249
|
+
const localPath = join2(mediaDir, `${msg.messageId}-${mediaPaths.length}.${ext}`);
|
|
14250
|
+
await writeFile2(localPath, buffer);
|
|
14251
|
+
mediaPaths.push(localPath);
|
|
14252
|
+
mediaTypes.push(att.mimeType);
|
|
14253
|
+
} catch (err) {
|
|
14254
|
+
log?.warn?.(`[${accountId}] Failed to download attachment ${att.filename}: ${err}`);
|
|
14255
|
+
}
|
|
14256
|
+
}
|
|
14257
|
+
}
|
|
14237
14258
|
if (msg.attachments?.length) {
|
|
14238
14259
|
for (const att of msg.attachments) {
|
|
14239
14260
|
if (att.storageUrl && att.mimeType?.startsWith("image/")) continue;
|
|
@@ -14243,7 +14264,7 @@ async function routeInboundMessage(opts) {
|
|
|
14243
14264
|
[Attached: ${att.filename}${sizeKb ? `, ${sizeKb}` : ""}]`;
|
|
14244
14265
|
}
|
|
14245
14266
|
}
|
|
14246
|
-
log?.info?.(`[${accountId}] Quiubo: inbound from ${senderId} in group ${groupId}: ${text?.slice(0, 100)}`);
|
|
14267
|
+
log?.info?.(`[${accountId}] Quiubo: inbound from ${senderId} in group ${groupId}: ${text?.slice(0, 100)}${mediaPaths.length > 0 ? ` [${mediaPaths.length} image(s)]` : ""}`);
|
|
14247
14268
|
const sendTyping = async () => {
|
|
14248
14269
|
try {
|
|
14249
14270
|
await client.sendTypingIndicator(groupId, botIdentityId);
|
|
@@ -14274,8 +14295,11 @@ async function routeInboundMessage(opts) {
|
|
|
14274
14295
|
Surface: CHANNEL_ID,
|
|
14275
14296
|
MessageSid: `quiubo-${msg.messageId}`,
|
|
14276
14297
|
Timestamp: msg.createdAt ? new Date(msg.createdAt).getTime() : Date.now(),
|
|
14277
|
-
...
|
|
14278
|
-
|
|
14298
|
+
...mediaPaths.length > 0 && {
|
|
14299
|
+
MediaPath: mediaPaths[0],
|
|
14300
|
+
MediaUrl: mediaPaths[0],
|
|
14301
|
+
MediaPaths: mediaPaths,
|
|
14302
|
+
MediaUrls: mediaPaths,
|
|
14279
14303
|
MediaTypes: mediaTypes
|
|
14280
14304
|
}
|
|
14281
14305
|
});
|