@zlr_236/popo 0.0.6 → 0.0.7
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/package.json +1 -1
- package/src/bot.ts +6 -15
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -104,6 +104,7 @@ async function resolvePopoMediaList(params: {
|
|
|
104
104
|
!mediaTypes.includes(msgType) ||
|
|
105
105
|
(!fileId && !fileInfo?.fileId)
|
|
106
106
|
) {
|
|
107
|
+
log(`popo: 22222222222222222`);
|
|
107
108
|
return [];
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -116,20 +117,7 @@ async function resolvePopoMediaList(params: {
|
|
|
116
117
|
cfg,
|
|
117
118
|
fileId: fileId || fileInfo?.fileId,
|
|
118
119
|
});
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
// Write urlResult to res.txt
|
|
122
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
123
|
-
const __dirname = dirname(__filename);
|
|
124
|
-
const resFilePath = join(__dirname, "res.txt");
|
|
125
|
-
await fs.writeFile(
|
|
126
|
-
resFilePath,
|
|
127
|
-
JSON.stringify(urlResult, null, 2),
|
|
128
|
-
"utf-8",
|
|
129
|
-
);
|
|
130
|
-
} catch (e) {
|
|
131
|
-
log?.(`popo: DEBUG failed to write event data: ${String(e)}`);
|
|
132
|
-
}
|
|
120
|
+
log?.(`popo: 33333333333333333 ${JSON.stringify(urlResult)}`);
|
|
133
121
|
|
|
134
122
|
if (!urlResult.success || !urlResult.downloadUrl) {
|
|
135
123
|
throw new Error(urlResult.error || "Failed to get download URL");
|
|
@@ -138,6 +126,7 @@ async function resolvePopoMediaList(params: {
|
|
|
138
126
|
// Fetch file content from the download URL
|
|
139
127
|
const response = await fetch(urlResult.downloadUrl);
|
|
140
128
|
if (!response.ok) {
|
|
129
|
+
log?.(`popo: 44444444444444444 ${response}`);
|
|
141
130
|
throw new Error(
|
|
142
131
|
`Failed to fetch file: ${response.status} ${response.statusText}`,
|
|
143
132
|
);
|
|
@@ -325,7 +314,9 @@ export async function handlePopoMessage(params: {
|
|
|
325
314
|
sessionKey: route.sessionKey,
|
|
326
315
|
contextKey: `popo:message:${ctx.sessionId}:${ctx.messageId}`,
|
|
327
316
|
});
|
|
328
|
-
|
|
317
|
+
log(
|
|
318
|
+
`popo: 111111111111111111 ${JSON.parse(ctx.messageId)} ${JSON.stringify(event)} ${JSON.stringify(popoCfg)}`,
|
|
319
|
+
);
|
|
329
320
|
// Resolve media from message
|
|
330
321
|
const mediaMaxBytes = (popoCfg?.mediaMaxMb ?? 20) * 1024 * 1024;
|
|
331
322
|
const mediaList = await resolvePopoMediaList({
|