MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / parseMessage

Function parseMessage

apps/web/services/discord/messages.ts:290–316  ·  view source on GitHub ↗
(
  channel: channels,
  message: DiscordMessage,
  users: users[],
  threadId?: string
)

Source from the content-addressed store, hash-verified

288}
289
290async function parseMessage(
291 channel: channels,
292 message: DiscordMessage,
293 users: users[],
294 threadId?: string
295) {
296 const mentions = getMentions(message.mentions, users);
297 const authorId = users.find(
298 (user) => user.externalUserId === message.author.id
299 )?.id as string;
300
301 const attachments =
302 message.attachments && message.attachments.length
303 ? await handleAttachments(message.attachments, channel)
304 : [];
305
306 return {
307 authorId,
308 body: message.content,
309 channelId: channel.id,
310 sentAt: message.timestamp,
311 externalMessageId: message.id,
312 threadId,
313 mentions,
314 attachments,
315 };
316}

Callers 2

processMessagesChunkFunction · 0.70
createMessagesFunction · 0.70

Calls 3

getMentionsFunction · 0.90
handleAttachmentsFunction · 0.90
findMethod · 0.45

Tested by

no test coverage detected