You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the second version of the library, and when receiving all the user's chats, this error constantly drops, does anyone know how to fix it? json: cannot unmarshal object into Go struct field .last_message of type tdlib.MessageSender
func getChatList(client *client.Client, limit int) ([]*tdlib.Chat, error) {
var allChats []*tdlib.Chat
var chatList = tdlib.NewChatListMain()
var chats, getChatsErr = client.GetChats(chatList, int32(limit))
if getChatsErr != nil {
return nil, getChatsErr
}
for len(chats.ChatIDs) > limit {
// get chats (ids) from tdlib
_, err := client.LoadChats(chatList, int32(limit-len(chats.ChatIDs)))
if err != nil {
if err.(tdlib.RequestError).Code != 404 {
chats, err = client.GetChats(chatList, int32(limit))
break
}
return nil, err
}
chats, err = client.GetChats(chatList, int32(limit))
}
if len(chats.ChatIDs) == 0 {
return allChats, nil
}
for _, chatID := range chats.ChatIDs {
// get chat info from tdlib
var chat, getChatErr = client.GetChat(chatID)
if getChatErr == nil {
allChats = append(allChats, chat)
} else {
return nil, getChatErr
}
}
return allChats, nil
}
The text was updated successfully, but these errors were encountered:
I am using the second version of the library, and when receiving all the user's chats, this error constantly drops, does anyone know how to fix it?
json: cannot unmarshal object into Go struct field .last_message of type tdlib.MessageSender
}
The text was updated successfully, but these errors were encountered: