MCPcopy Create free account
hub / github.com/027xiguapi/code-box / sendMessageToChat

Function sendMessageToChat

contents/chat-integration.ts:62–74  ·  view source on GitHub ↗
(message: ExtensionMessage)

Source from the content-addressed store, hash-verified

60
61// 发送消息到聊天应用
62function sendMessageToChat(message: ExtensionMessage) {
63 // 尝试查找聊天应用的 iframe 或窗口
64 const chatWindow = findChatWindow()
65
66 if (chatWindow) {
67 console.log("[Chat Integration] 发送消息到聊天应用:", message)
68 chatWindow.postMessage(message, "*")
69 } else {
70 console.warn("[Chat Integration] 未找到聊天应用窗口")
71 // 如果没有找到 iframe,直接在当前窗口发送
72 window.postMessage(message, "*")
73 }
74}
75
76// 查找聊天应用窗口
77function findChatWindow(): Window | null {

Callers 4

captureAndSendToChatFunction · 0.85
sendTextToChatFunction · 0.85
sendImageToChatFunction · 0.85

Calls 1

findChatWindowFunction · 0.85

Tested by

no test coverage detected