tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Get messageID from GetChatHistory #2233

Closed nivos20 closed 1 year ago

nivos20 commented 1 year ago

When I use this command : _client.Send(new TdApi.GetChatHistory(777000, 2, -99, 100, false), GetMessageHandler);

I get all message history from a chat but the thing is that I get the info as @object and the only way to interact with the info recieved is to use ToString().

Is there a way to extract a part of the data that is received on result (for example extract keep separately the user and message id) without using some kind of separation manipulation? (Split function for example)

levlam commented 1 year ago

Telegram.Td.Api.GetChatHistory returns an object of type Telegram.Td.Api.Messages or Telegram.Td.Api.Error. You need to check object's type and convert it to an appropriate type. For example,

if (response is Messages messages) {
  // process messages
}