MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / getRepliedMessageText

Function getRepliedMessageText

deepwiki/deepwiki.ts:69–91  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

67};
68
69const getRepliedMessageText = async (msg: Api.Message): Promise<string> => {
70 try {
71 const getter = (msg as any).getReplyMessage;
72 if (typeof getter === "function") {
73 const replied = await getter.call(msg);
74 return getMessageText(replied).trim();
75 }
76 } catch {}
77
78 try {
79 const replyToMsgId =
80 (msg as any)?.replyTo?.replyToMsgId ??
81 (msg as any)?.replyToMsgId ??
82 (msg as any)?.replyTo?.replyToMsg?.id;
83 if (!replyToMsgId) return "";
84 const peer = (msg.chatId || msg.peerId) as any;
85 const res = await safeGetMessages(msg.client as any, peer, { ids: [replyToMsgId] });
86 const replied = Array.isArray(res) ? res[0] : res;
87 return getMessageText(replied).trim();
88 } catch {}
89
90 return "";
91};
92
93const getRepliedMessageId = async (msg: Api.Message): Promise<number | undefined> => {
94 try {

Callers 1

DeepWikiPluginClass · 0.85

Calls 1

getMessageTextFunction · 0.70

Tested by

no test coverage detected