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

Method sendNew

deepwiki/deepwiki.ts:141–163  ·  view source on GitHub ↗
(
    msg: Api.Message,
    text: string,
    parseMode: "html" | "markdown" = "html",
    replyToId?: number,
    linkPreview: boolean = false
  )

Source from the content-addressed store, hash-verified

139 }
140
141 static async sendNew(
142 msg: Api.Message,
143 text: string,
144 parseMode: "html" | "markdown" = "html",
145 replyToId?: number,
146 linkPreview: boolean = false
147 ): Promise<Api.Message | undefined> {
148 const topicRootId = getTopicRootId(msg);
149 const replyTo =
150 replyToId && topicRootId && replyToId !== topicRootId
151 ? new Api.InputReplyToMessage({
152 replyToMsgId: replyToId,
153 topMsgId: topicRootId,
154 })
155 : replyToId ?? topicRootId;
156
157 return await (msg.client as any).sendMessage(msg.chatId || msg.peerId, {
158 message: text,
159 parseMode,
160 ...(replyTo ? { replyTo } : {}),
161 linkPreview,
162 });
163 }
164}
165
166const getTopicRootId = (msg: Api.Message): number | undefined => {

Callers 1

sendAnswerOrTelegraphMethod · 0.45

Calls 1

getTopicRootIdFunction · 0.70

Tested by

no test coverage detected