MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / getMessageContent

Function getMessageContent

packages/parser/src/formats/instagram-native.ts:190–222  ·  view source on GitHub ↗

* 获取消息内容

(msg: InstagramMessage)

Source from the content-addressed store, hash-verified

188 * 获取消息内容
189 */
190function getMessageContent(msg: InstagramMessage): string | null {
191 // 文本内容
192 if (msg.content) {
193 return decodeInstagramText(msg.content)
194 }
195
196 // 图片
197 if (msg.photos?.length) {
198 return `[图片] ${msg.photos[0].uri}`
199 }
200
201 // 视频
202 if (msg.videos?.length) {
203 return `[视频] ${msg.videos[0].uri}`
204 }
205
206 // 语音
207 if (msg.audio_files?.length) {
208 return `[语音] ${msg.audio_files[0].uri}`
209 }
210
211 // 分享
212 if (msg.share) {
213 const link = msg.share.link || ''
214 if (link.includes('giphy.com')) {
215 return `[GIF] ${link}`
216 }
217 return `[链接] ${link}`
218 }
219
220 // 空消息
221 return '[未知消息]'
222}
223
224// ==================== 解析器实现 ====================
225

Callers 1

parseInstagramFunction · 0.70

Calls 1

decodeInstagramTextFunction · 0.85

Tested by

no test coverage detected