Telegram.Net icon indicating copy to clipboard operation
Telegram.Net copied to clipboard

Read unread message and set them as read or delete them

Open derodevil opened this issue 8 years ago • 3 comments

I try your library and it is awesome. It's more stable than other telegram libraries. The features like auto reconnect is very helpful. I have no idea about sending rpc request to read unread messages and set them as read or delete them. Here's the code I'm using If I subscribe to the UpdateMessage event then the Flood - FLOOD_WAIT_19 occurs where I have to wait 19 seconds to read next incoming text message. No idea how to read unread message without FLOOD_WAIT :(

to set message as read - no luck

var requestConfirmed = new ReceivedMessagesRequest(messageId)
{
    ConfirmReceived = true
};
await client.SendRpcRequest(requestConfirmed);

to delete message - no luck

var requestDelete = new DeleteMessagesRequest(new List<int> { messageId });
await client.SendRpcRequest(requestDelete);

One more. After creating new instance of TelegramClient and calling client.Start(); the UpdateMessage event is not fired untill I send message first then back to normal (UpdateMessage fired again)

derodevil avatar Oct 12 '17 09:10 derodevil

Hi. Do you use library built from github or did you install it from nuget?

steavy29 avatar Oct 12 '17 09:10 steavy29

I clone it from github as you stated here https://github.com/steavy29/Telegram.Net#how-do-i-add-this-to-my-project. I don't even know if it's available on nuget.

derodevil avatar Oct 12 '17 09:10 derodevil

I have solved some problems regarding to receive incoming message without getting FLOOD_WAIT_X error using GetUpdatesDifference(). The DeleteMessages() method also works by stopping receiving new message untill all messages are deleted. But I still have no luck to mark message as read using the following code

var requestConfirmed = new ReceivedMessagesRequest(messageId)
{
    ConfirmReceived = true
};
await client.SendRpcRequest(requestConfirmed);

What is wrong here?

derodevil avatar Oct 22 '17 13:10 derodevil