Skip to content

Commit 3ac421e

Browse files
authored
msgLink use group username if available (#161)
Tested in prod
1 parent 0f1bcaa commit 3ac421e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

utils/tg.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ const inlineKeyboard = (...inline_keyboard) =>
1515
({ reply_markup: { inline_keyboard } });
1616

1717
const msgLink = msg =>
18-
`https://t.me/c/${msg.chat.id.toString().slice(4)}/${msg.message_id}`;
18+
msg.chat.username
19+
? `https://t.me/${msg.chat.username}/${msg.message_id}`
20+
: `https://t.me/c/${msg.chat.id.toString().slice(4)}/${msg.message_id}`;
1921

2022
const link = ({ id, first_name }) =>
2123
html`${lrm}<a href="tg://user?id=${id}">${first_name}</a> [<code>${id}</code>]`;

0 commit comments

Comments
 (0)