(chatId: string, username?: string)
| 382 | function buildChatLink(chatId: string, username?: string): string { |
| 383 | if (username) { |
| 384 | return `https://t.me/${username}`; |
| 385 | } |
| 386 | // 私有群:chatId 格式为 -100xxxxx,需要去掉 -100 前缀 |
| 387 | const numericId = chatId.replace(/^-100/, ''); |
| 388 | return `https://t.me/c/${numericId}`; |
| 389 | } |
| 390 | |
| 391 | // 构建消息链接 |
| 392 | function buildMessageLink(chatId: string, messageId: number, username?: string): string { |
| 393 | if (username) { |
| 394 | return `https://t.me/${username}/${messageId}`; |