I created a bot in php to make two strangers talk.The function that I would like to implement is the possibility of having a user delete a message that has already been sent and therefore that it is no longer visible to the other user. In particular, the user replies to the message to be deleted and this is also deleted from the other user.
The question is how to get the message id in the other chat and then delete it?
CodePudding user response:
Messages from bot to user1 and user2 are not connected to each other on telegram side. To solve your problem you can save message_id (1) and message_id (2) in your database and find message_id (2) by message_id (1).
When user1 reply "/delete" on any message in his chat your bot will receive new message with "reply_to_message" section from where you can get message_id (1) to delete and second message_id (2) you will find in your DB.