When a user puts a reaction on a message for the first time (i.e. the message hasn't received any reaction yet), the MTProto sends to all bots in the group an update that the message has been edited. Long polling doesn't have such a bug and works like a charm. Webhooks haven't been tested yet.
It seems to be a bug and not a feature since bots are not supposed to see the reactions, and such behavior confuses: a bot which is supposed to be triggered by a message edit gets triggered by a reaction instead, and there is absolutely no way to determine that the update was caused by reaction (since, again, bots cannot work with reactions).
I emphasise that MTProto only sends an update if it is the first reaction on the message.
I also emphasise that the problem is not related to a specific library of a certain language. It concerns the server side.
Steps to reproduce
Use any language and any MTProto library to write a bot, in my example I'll use Python with Pyrogram but all other MTProto-based libraries I tested had the same problem as well.
Create a bot:
from pyrogram import Client, filters
app = Client("test", api_id=12345, api_hash='abcdefg12345')
@app.on_edited_message()
async def notification(client, message):
await message.reply("This message has been edited!")
app.run()
Run the script.
Add the bot to a chat.
Put a reaction on a message which hasn't been reacted yet.
The bot thinks the message has been edited!
Expected result
MTProto never sends an update caused by any reaction to the bot and the latter remains silent about it.
Device info
The problem is on the server side, so the device info doesn't matter. Excuse me for tagging Telegram Desktop as the platform. This place doesn't seem to be supposed for server-related issues.
Same issue exists with webhooks. It's especially annoying since we reprimand users for swearing in the chat and if someone liked the message, the user gets reprimanded twice.
3
Yes, I know that this ticket has already been described in detail. It's just a shame to delete the information from my poorly written ticket, which needs to be transferred.
---
[for BOT updates] Divide the action "edited message" on: "reaction" and "edited message" When you add a reaction, any message gets the status "edited message". Don't combine the two conditions, separate them.
Why does this need to be fixed? Sometimes abusers join chats, post normal images, and then, a couple of weeks later, change the messages to banned content and the group gets blocked. There are bots that catch such actions and delete the modified messages, but this prevents people from posting reactions to old messages because reactions = modified messages and they are deleted.
Example A user edited his own message - (trigger) msg_edit_1 A user gave another user a reaction - (trigger) msg_edit_2
Log in here to report bugs or suggest features. Please enter your phone number in the international format and we will send a confirmation message to your account via Telegram.
---
[for BOT updates] Divide the action "edited message" on: "reaction" and "edited message"
When you add a reaction, any message gets the status "edited message". Don't combine the two conditions, separate them.
Why does this need to be fixed?
Sometimes abusers join chats, post normal images, and then, a couple of weeks later, change the messages to banned content and the group gets blocked. There are bots that catch such actions and delete the modified messages, but this prevents people from posting reactions to old messages because reactions = modified messages and they are deleted.
Example
A user edited his own message - (trigger) msg_edit_1
A user gave another user a reaction - (trigger) msg_edit_2