Search code examples
c#telegram-apiwtelegramclient

How to delete message using Telegram API (not BOT API!)


I need to delete specific message (TL.Message msg) from my chat. I'm trying to use var aff = await _tgSession.TgClient.Messages_DeleteMessages(new int[1] { msg.id }); but it do nothing.

this is understandable because I don't send the chat ID anywhere.

Is any other way to delete message?


Solution

  • Read the helpful tooltips when you're programming: tooltip and read the essential README about Terminology

    Messages_DeleteMessages is only for legacy basic chats / user chats.
    Channel_DeleteMessages is for groups & channel

    even better: use helper client.DeleteMessages(...) that works in any of those cases.