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

Function buildMessageLink

bs/bs.ts:251–275  ·  view source on GitHub ↗
(entity: any, messageId: number)

Source from the content-addressed store, hash-verified

249}
250
251function buildMessageLink(entity: any, messageId: number): string | undefined {
252 if (!entity || !messageId) return undefined;
253 const username = resolveEntityUsername(entity);
254 if (username) {
255 return `https://t.me/${username}/${messageId}`;
256 }
257
258 const cleaned = cleanEntityId(
259 entity.id ??
260 entity.peerId ??
261 entity.chatId ??
262 entity.channelId ??
263 entity.userId ??
264 entity.peer?.channelId ??
265 entity.peer?.userId ??
266 entity.peer?.chatId
267 );
268 if (cleaned) {
269 if (entity instanceof Api.User || entity?.className === "User") {
270 return `tg://user?id=${cleaned}`;
271 }
272 return `https://t.me/c/${cleaned}/${messageId}`;
273 }
274 return undefined;
275}
276
277function buildForwardedLinkTags(
278 entity: any,

Callers 2

buildForwardedLinkTagsFunction · 0.70

Calls 2

resolveEntityUsernameFunction · 0.85
cleanEntityIdFunction · 0.85

Tested by

no test coverage detected