td icon indicating copy to clipboard operation
td copied to clipboard

updateDeleteMessages not emitted immediately in private channels — only received after other chat activity

Open kolosseo opened this issue 8 months ago • 1 comments

Environment:

  • tdl: v7.2.0
  • tdl-tdlib-addon: v1.2.2
  • prebuilt-tdlib: v0.1008012.0
  • Node.js: v20
  • OS: GNU/Linux

Summary:

When using TDLib in a private channel where a bot is present as an admin, the event updateDeleteMessages is not emitted immediately after a user deletes a message via the official Telegram app.

Instead, the update is delayed and only emitted after another message is sent or edited in the same channel. This makes it difficult to detect deletions in near real-time.


Steps to Reproduce:

  1. Add a bot using TDLib to a private channel, with full admin rights.
  2. Delete a message in the channel using the Telegram mobile/desktop client.
  3. No updateDeleteMessages event is received immediately.
  4. Send or edit a message in the channel.
  5. The updateDeleteMessages event is now emitted for the earlier deletion.

Expected behavior: updateDeleteMessages should be emitted immediately when a message is deleted, even if no other chat activity occurs.

Observed behavior: TDLib appears to buffer or hold the updateDeleteMessages update until another state-changing event (like a message or reaction) triggers an update propagation.


Notes:

  • The bot is using TDLib via the Node.js tdl wrapper.
  • The issue happens across all private channels where the bot is added.
  • Periodic polling via methods like getAuthorizationState does not unblock the update.
  • Reacting to messages triggers the flush only if the reaction causes a visible change (e.g. first time adding a like).
  • It seems that TDLib does not propagate the deletion unless a concurrent "chat state change" occurs.

Please let me know if more logs, debug traces, or configuration details are needed.
I'd be happy to test any patches or experimental flags.

Thank you for maintaining TDLib — it's an amazing foundation for Telegram bots.

kolosseo avatar Apr 24 '25 23:04 kolosseo

This is expected server-side behavior which can't be affected by TDLib. Channel updates are not supposed to be propagated in "near real-time" with the exception of updates received by bots and exposed by Bot API. Message deletions in channels aren't exposed and can be batched with other updates.

levlam avatar Apr 25 '25 08:04 levlam