J
J
John Jameson2021-04-01 16:38:40
Node.js
John Jameson, 2021-04-01 16:38:40

Telegraf js how to contact the user?

What command can be used to display the user who wrote the message so that when communicating, the bot addresses the interlocutor by name or user id?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LidForce, 2021-04-01
@JohnJameson

Something like this.

bot.on("message", (ctx) => {
bot.telegram.sendMessage(ctx.message.chat.id, 
`Привет, ${ctx.message.from.first_name}\n` +
`Твой id: ${ctx.message.from.id}`)
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question