Answer the question
In order to leave comments, you need to log in
Can a bot interact with a specific chat by receiving a PM command?
I created a function for sending a message, I specified the chat ID in the chat_id parameter, the mechanism works like this:
1. I write a command to the bot in the LAN
2. It reads and sends something to the conversation
If you write a command in the conversation, it is logical that the bot will answer it because he handles events, but is it possible to do the opposite? Or does it require a User Long Poll?
Answer the question
In order to leave comments, you need to log in
The fact is that this chat with ID 114 is only for you 114, if the bot was added to the conversation for the first time, then for it the chat ID will be 1, and each subsequent one will be +1, that is, if I created a group, I added it into a conversation, for her this chat will be with ID 1, in the second conversation already 2, and so on.
If you want to know the chat ID, you can enter any command directly in the conversation, then display the peer_id, and you can subtract 2000000000 from it (if this is a conversation, it doesn’t work with pm), and after that you will get the conversation ID for the bot
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question