@zlr_236/popo 0.0.2 → 0.0.3
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 +14 -4
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -31,6 +31,12 @@ export type PopoMessageEvent = {
|
|
|
31
31
|
fileId?: string; // File message ID
|
|
32
32
|
timestamp?: number;
|
|
33
33
|
groupId?: string;
|
|
34
|
+
fileInfo?: {
|
|
35
|
+
size: number;
|
|
36
|
+
name: string;
|
|
37
|
+
fileId: string;
|
|
38
|
+
md5: string;
|
|
39
|
+
};
|
|
34
40
|
groupName?: string;
|
|
35
41
|
};
|
|
36
42
|
};
|
|
@@ -81,7 +87,7 @@ async function resolvePopoMediaList(params: {
|
|
|
81
87
|
log?: (msg: string) => void;
|
|
82
88
|
}): Promise<PopoMediaInfo[]> {
|
|
83
89
|
const { cfg, event, maxBytes, log } = params;
|
|
84
|
-
const { msgType, fileId } = event.eventData;
|
|
90
|
+
const { msgType, fileId, fileInfo } = event.eventData;
|
|
85
91
|
// Write urlResult to res.txt
|
|
86
92
|
const __filename = fileURLToPath(import.meta.url);
|
|
87
93
|
const __dirname = dirname(__filename);
|
|
@@ -92,8 +98,12 @@ async function resolvePopoMediaList(params: {
|
|
|
92
98
|
"utf-8",
|
|
93
99
|
);
|
|
94
100
|
// Only process media message types
|
|
95
|
-
const mediaTypes = ["image", "file", "audio", "video"];
|
|
96
|
-
if (
|
|
101
|
+
const mediaTypes = ["image", "file", "audio", "video", 171];
|
|
102
|
+
if (
|
|
103
|
+
!msgType ||
|
|
104
|
+
!mediaTypes.includes(msgType) ||
|
|
105
|
+
(!fileId && !fileInfo.fileId)
|
|
106
|
+
) {
|
|
97
107
|
return [];
|
|
98
108
|
}
|
|
99
109
|
|
|
@@ -104,7 +114,7 @@ async function resolvePopoMediaList(params: {
|
|
|
104
114
|
// First, get download URL using downloadMessageFilePopo
|
|
105
115
|
const urlResult = await downloadMessageFilePopo({
|
|
106
116
|
cfg,
|
|
107
|
-
fileId,
|
|
117
|
+
fileId: fileId || fileInfo.fileId,
|
|
108
118
|
});
|
|
109
119
|
|
|
110
120
|
// Write urlResult to res.txt
|