Closed Behruz999 closed 1 month ago
You just need to include the username in the text of the message.
levlam, you helped me get rid depress out, enormous thanks
and my modified code snippet:
const messageId = ctx.message_id;
const username = ctx.from.username;
const response = username ? `@${username} Please do not share links in this group!`
: `<a href="tg://user?id=${user.id}">${user.first_name}</a> Please do not share links in this group!`;
const options = username ? { entities: [{ type: "mention", offset: 0, length: response.length }] } : {
entities: [{
type: "text_mention",
offset: 0,
length: response.length,
user,
},
], parse_mode: "HTML" };
bot.sendMessage(chatId, response, options);
Hi everyone, I got a lack of insight about mentioning users by it's @username, my code's:
it's a mention by user id, I've read docs too however I coudn't figure out what i need to do to reach my purpose. I typically use NODEJS + EXPRESS