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
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
}