Closed FunkyYang closed 8 months ago
Primary TDLib interface is asynchronous and most methods can be called only asynchronously. What exactly do you mean?
I need get reponse which come from bot.that is synchronous
It is not possible to receive the response synchronously.
// Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires
func (client *Client) GetCallbackQueryAnswer(req *GetCallbackQueryAnswerRequest) (*CallbackQueryAnswer, error) {
result, err := client.Send(Request{
meta: meta{
Type: "getCallbackQueryAnswer",
},
Data: map[string]interface{}{
"chat_id": req.ChatId,
"message_id": req.MessageId,
"payload": req.Payload,
},
})
if err != nil {
return nil, err
}
if result.Type == "error" {
return nil, buildResponseError(result.Data)
}
return UnmarshalCallbackQueryAnswer(result.Data)
}
this is a library which I use to connect telegram. and that indicate must receive response from server before 60s timeout.this is a synchronously?
The function client.Send is asynchronous under the hood: https://github.com/zelenin/go-tdlib/blob/eacb6ab405b78851f6fabe02d2d79be5f2de74ea/client/client.go#L116C2-L116C8.
some groups call
GetCallbackQueryAnswer
and response slowly.How can I use it asynchronous?