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

View Source

Focused Telegram inbound decision helpers used by the transport pipeline.

This module stays responsible for authorization, deduplication, known-target indexing, reply-to preservation, and router-facing inbound enrichment without performing Telegram API side effects itself.

Summary

Functions

Authorization guard for Telegram callback queries.

Emit the standard Telegram inbound drop log when enabled.

Index chat metadata from an update for known-target tracking.

Enrich an inbound with update_id, account_id, and reply-to text.

Return the authorized inbound routing decision without performing side effects.

Functions

authorized_callback_query?(state, cb)

@spec authorized_callback_query?(map(), map()) :: boolean()

Authorization guard for Telegram callback queries.

extract_chat_message(update)

log_drop(state, inbound, reason)

@spec log_drop(map(), map(), term()) :: :ok

Emit the standard Telegram inbound drop log when enabled.

maybe_index_known_target(state, update)

Index chat metadata from an update for known-target tracking.

This allows the system to maintain a registry of chats/topics that have interacted with the bot.

prepare_inbound(inbound, state, update, id)

Enrich an inbound with update_id, account_id, and reply-to text.

route_authorized_inbound_action(state, inbound)

@spec route_authorized_inbound_action(map(), map()) ::
  {:ok, map()} | {:drop, term(), map()} | {:seen, map()}

Return the authorized inbound routing decision without performing side effects.