Shubh
Shubh

Reputation: 593

How to get chat_id, user_id and time from telegram bot?

I am writing a telegram bot to handle conversations (one to one) with users and I am getting same for both userid and chat_id.

My code is:

chat_id = update.message.chat_id
user_id = update.effective_user.id

Upvotes: 0

Views: 2695

Answers (1)

Gagan T K
Gagan T K

Reputation: 728

user_id is the Telegram ID of the user sending a message to bot. chat_id is the Telegram ID of the chat where a message is being sent to bot.

So, in one to one conversation, the user will send a message in his own chat (with respect to bot). That's the reason both are same.

Upvotes: 1

Related Questions