@yaoyuanchao/dingtalk 1.4.5 → 1.4.6
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/monitor.ts +30 -1
package/package.json
CHANGED
package/src/monitor.ts
CHANGED
|
@@ -168,6 +168,7 @@ async function extractMessageContent(
|
|
|
168
168
|
senderNick?: string;
|
|
169
169
|
msgType?: string;
|
|
170
170
|
content?: string;
|
|
171
|
+
downloadCode?: string; // For media messages (picture, video, file)
|
|
171
172
|
createAt?: number;
|
|
172
173
|
}>;
|
|
173
174
|
|
|
@@ -214,7 +215,35 @@ async function extractMessageContent(
|
|
|
214
215
|
}
|
|
215
216
|
sender = sender || '未知';
|
|
216
217
|
|
|
217
|
-
|
|
218
|
+
// Handle different message types in chatRecord
|
|
219
|
+
let msgContent: string;
|
|
220
|
+
switch (record.msgType) {
|
|
221
|
+
case 'text':
|
|
222
|
+
msgContent = record.content || '[空消息]';
|
|
223
|
+
break;
|
|
224
|
+
case 'picture':
|
|
225
|
+
case 'image':
|
|
226
|
+
msgContent = '[图片]';
|
|
227
|
+
break;
|
|
228
|
+
case 'video':
|
|
229
|
+
msgContent = '[视频]';
|
|
230
|
+
break;
|
|
231
|
+
case 'file':
|
|
232
|
+
msgContent = '[文件]';
|
|
233
|
+
break;
|
|
234
|
+
case 'voice':
|
|
235
|
+
case 'audio':
|
|
236
|
+
msgContent = '[语音]';
|
|
237
|
+
break;
|
|
238
|
+
case 'richText':
|
|
239
|
+
msgContent = record.content || '[富文本消息]';
|
|
240
|
+
break;
|
|
241
|
+
case 'markdown':
|
|
242
|
+
msgContent = record.content || '[Markdown消息]';
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
msgContent = record.content || `[${record.msgType || '未知'}消息]`;
|
|
246
|
+
}
|
|
218
247
|
const time = record.createAt ? new Date(record.createAt).toLocaleString('zh-CN') : '';
|
|
219
248
|
return `[${idx + 1}] ${sender}${time ? ` (${time})` : ''}: ${msgContent}`;
|
|
220
249
|
});
|