tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

How to collect media Albums when there is no any field about their count? #2523

Closed patzu closed 1 year ago

patzu commented 1 year ago

I have a grouped image message and I want to forward it. When I am collecting images in a map I don't know how many media are in a message to collect them. Should I use timer to detect the last one? I am collecting them in a map but I don't know how many they are? And when should I send the albums?


           if (message.mediaAlbumId != 0) {
                if (!albums.containsKey(message.mediaAlbumId)) {
                    albums.put(message.mediaAlbumId, new ArrayList<>());
                }
                albums.get(message.mediaAlbumId).add(message);
            }
RememberTheAir commented 1 year ago

You either use a timer or wait for the next message that isn't shipped with that album id. I'm pretty sure there has been discussions here about this (eg. #1482) - but you can find a couple of strategies on how to deal with albums here