(entity: any, messageId: number)
| 249 | } |
| 250 | |
| 251 | function 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 | |
| 277 | function buildForwardedLinkTags( |
| 278 | entity: any, |
no test coverage detected