LemonChannels.Adapters.Telegram.Transport.MediaGroups (lemon_channels v0.1.0)

View Source

Media-group coalescence logic for the Telegram transport.

Telegram sends album/document-group uploads as individual messages that share a media_group_id. This module buffers those messages, applies a debounce timer, and provides a flush function that hands off the complete group for processing.

Summary

Functions

Enqueue an inbound into its media-group buffer, creating the buffer if needed.

Return the debounce interval (in ms) for media-group coalescence.

Returns true when a group buffer for this inbound's media group already exists in state.

Compute the key that identifies a media group within GenServer state.

Returns true when the inbound message belongs to a Telegram media group (i.e. has both a media_group_id and any media attachment in its meta).

Functions

enqueue_media_group(state, inbound)

Enqueue an inbound into its media-group buffer, creating the buffer if needed.

Returns the updated state.

media_group_debounce_ms(state)

Return the debounce interval (in ms) for media-group coalescence.

media_group_exists?(state, inbound)

Returns true when a group buffer for this inbound's media group already exists in state.

media_group_key(state, inbound)

Compute the key that identifies a media group within GenServer state.

media_group_member?(inbound)

Returns true when the inbound message belongs to a Telegram media group (i.e. has both a media_group_id and any media attachment in its meta).