Closed llistochek closed 1 year ago
chat.participants()
returns empty list.Version: 3.3.1
To reproduce, add following listener to Whatsapp instance:
// Kotlin import it.auties.whatsapp.listener.Listener import it.auties.whatsapp.model.chat.Chat class ChatsListener : Listener { override fun onChats(chats: MutableCollection<Chat>) { chats.forEach { chat -> if (chat.isGroup) { println(chat.participants().size) } } } }
Expected behavior: It should output anything other than "0".
Actual behavior: It outputs only "0".
right now it works as a cache, so you have to first invoke queryGroupMetadata for that list to he populated. I agree though that it's counter intuitive so I'll fix it
Thanks for the quick reply!
right now it works as a cache, so you have to first invoke queryGroupMetadata for that list to he populated
import it.auties.whatsapp.api.Whatsapp import it.auties.whatsapp.listener.Listener import it.auties.whatsapp.model.chat.Chat
class ChatsListener : Listener {
override fun onChats(whatsapp: Whatsapp, chats: MutableCollection
This listener prints normal `Metadata size:` (equal to real number of participants) but `Chat size:` is always 0. So it seems like group metadata isn't cached. Am I missing something?
Thanks for the quick reply!
right now it works as a cache, so you have to first invoke queryGroupMetadata for that list to he populated
import it.auties.whatsapp.api.Whatsapp import it.auties.whatsapp.listener.Listener import it.auties.whatsapp.model.chat.Chat class ChatsListener : Listener { override fun onChats(whatsapp: Whatsapp, chats: MutableCollection<Chat>) { for (chat in chats) { if (!chat.isGroup) continue val metadataParticipants = whatsapp.queryGroupMetadata(chat).join().participants() val chatParticipants = chat.participants() println("---") println(chat.name()) println("Metadata size: ${metadataParticipants.size}") println("Chat size: ${chatParticipants.size}") } } }
This listener prints normal
Metadata size:
(equal to real number of participants) butChat size:
is always 0. So it seems like group metadata isn't cached. Am I missing something?
I've fixed it in the latest commit, now it will also sync all the metadata of groups used in the last 2 weeks
chat.participants()
returns empty list.Version: 3.3.1
To reproduce, add following listener to Whatsapp instance:
Expected behavior: It should output anything other than "0".
Actual behavior: It outputs only "0".