MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / normalizeFeishuMessage

Function normalizeFeishuMessage

src/runtime/adapters/feishu.ts:77–108  ·  view source on GitHub ↗
(
  message: Pick<
    NormalizedMessage,
    "chatType" | "mentionedBot" | "rawContentType" | "content" | "resources"
  >,
)

Source from the content-addressed store, hash-verified

75 return chatId;
76}
77
78export function normalizeFeishuMessage(
79 message: Pick<
80 NormalizedMessage,
81 "chatType" | "mentionedBot" | "rawContentType" | "content" | "resources"
82 >,
83): FeishuMessageHandlingDecision {
84 if (message.chatType === "group" && !message.mentionedBot) {
85 return { action: "ignore" };
86 }
87
88 const hasSupportedResource = message.resources.some(isSupportedResource);
89
90 if (message.rawContentType !== "text" && !hasSupportedResource) {
91 return { action: "unsupported" };
92 }
93
94 const text = message.rawContentType === "text" ? message.content.trim() : "";
95 if (!text) {
96 if (hasSupportedResource) {
97 return {
98 action: "handle",
99 text: ATTACHMENT_MESSAGE_TEXT,
100 };
101 }
102 return { action: "ignore" };
103 }
104
105 return {
106 action: "handle",
107 text,
108 };
109}
110
111function isSupportedResource(

Callers 2

handleIncomingMessageMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected