How to load bot chat context in tdlib java?

132 Views Asked by At

I am developing service for interaction with Telegram using tdlib in java. Log in with botToken as a bot.

If I try to send a message to the chat on behalf of the bot immediately after the Client has successfully authorized, I get an error

Chat not found

In order to send a message, you need to send a message to the bot again on behalf of the user (although there was already a chat before). As a result, each time the application is restarted, it will be necessary to wait for an incoming message from the user, which is wrong.

When trying to send a request

client.send(new TdApi.GetChats(new TdApi.ChatListMain(), 1000), resultHandler);

I get an answer

Error {
  code = 400
  message = "The method is not available to bots"
}

I don't understant why methods are not available for bots. Which are available? I also tried LoadChats, the result is the same.

The question is how can I immediately load the chat context when the application starts without waiting for an incoming message from the user?

Tdlib documentation for java is very poor. Any links about bots abilities in tdlib will be very helpfull.

0

There are 0 best solutions below