Is there any way that can handle deleted message by user in one-to-one chat or groups that bot is member of it ? there is method for edited message update but not for deleted message .
Asked
Active
Viewed 2,834 times
3 Answers
10
No. There is no way to track whether messages have been deleted or not.
-
really ?! so :( – alireza Jan 29 '18 at 05:34
-
Unfortunately :( – Sean Wei Jan 29 '18 at 05:36
-
This is sad ! : – alireza Mar 12 '18 at 08:29
-
I would recommend asking @BotSupport to implement this. If enough people ask, they have to listen – Suppen Sep 18 '18 at 12:09
-
There is actually: https://core.telegram.org/constructor/updateDeleteMessages – Jacopo Pace Jun 02 '23 at 18:20
0
The pyrogram have DeletedMessagesHandler / @Client.on_deleted_messages(). If used as Userbot, It handles in all chat groups channels. I failed to filter. Maybe it will work in a bot

QSST
- 1
0
There is actually an event update from the official API docs: https://core.telegram.org/constructor/updateDeleteMessages
I had the very same problem, 'cause no framework seems to manage this event. I solved by using directly the official Telegam libraries TDLibs with a JS wrapper (TDL in this case). Here it is a simple and working code:
import {Client} from 'tdl'
import {TDLib} from 'tdl-tdlib-addon'
import {getTdjson} from 'prebuilt-tdlib'
// Start bot
const client = new Client(new TDLib(getTdjson()), {
apiHash: YOUR_TELEGRAM_API_HASH,
apiId: YOUR_TELEGRAM_API_ID
})
await client.loginAsBot(YOUR_TELEGRAM_BOT_TOKEN)
// Manage updates
client.on('update', function(update) {
// On deleted message(s) event
if (update._ === 'updateDeleteMessages') {
return yourHandlerFunction()
}
// If Other updates, do other stuff ...
})
// Print errors
client.on('error', console.error)

Jacopo Pace
- 460
- 7
- 14