Skip to main content

🏞 Media group

Telegram media groups is not one update, it's separated messages with field media_group_id. This makes it difficult to work with them, since you need to get all these messages in order to process the media group. This plugin allows you to easily handle and copy media groups.

The plugin works with video, audio, photo, document and their combinations.

Installing a plugin​

npm install @opengram/media-group

How to use​

Configuration​

Accepted fields:

PropertyDescriptionRequiredDefault value
timeoutTimeout after which the media group is considered processedNo100
storeMap-compatible store used for temporary storing media group messagesNoMap
allowedUpdatesList of allowed updatesNo['video', 'audio', 'photo', 'document']

Result object​

You can get plugin result in ctx.mediaGroup, that object contains media group messages array.

Usage example​

Loading...

Flowchart

Click to expand
No
Yes
No
Yes
Incoming update
Upstream middlewares
Filter by given update types
Has media group?
Nothing to do, run next
Save to store
Saved messages count = 10?
Wait for timeout
Timeout expired
Add media-group messages
to ctx.mediaGroup and mark as media_group, run next
Wait for new media
Downstream middlewares

Additional Information​