steavy29 / Telegram.Net

Telegram (http://telegram.org) client library implemented in C#.
17 stars 6 forks source link

Read unread message and set them as read or delete them #42

Open derodevil opened 7 years ago

derodevil commented 7 years ago

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)

steavy29 commented 7 years ago

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

derodevil commented 7 years ago

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 commented 7 years ago

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?