Expand description
Telegram long-polling loop: getUpdates → dispatch → offset advance;
outbound mpsc → REST send. Plays the same role as
discord::gateway::run_gateway_loop, but with no session/resume state —
long polling has no connection to lose beyond a single HTTP request, so
this is a plain retry-forever loop around one HTTP GET.
Constants§
- CHAT_
MIN_ 🔒SPACING - Minimum spacing between two outbound sends to the same chat (spec §2.5 — “1 msg/second” limit, enforced with a bit of headroom).
- MAX_
RECONNECT_ 🔒DELAY_ SECS - RECONNECT_
DELAY_ 🔒SECS
Functions§
- handle_
outbound 🔒 - handle_
update 🔒 - Filters, envelopes, and injects one inbound update. Plays the same role as
gateway.rs’shandle_dispatchforMESSAGE_CREATE. - jitter 🔒
- Cheap jitter (0-300ms) without pulling in a
randdependency — derived from the current time’s sub-second nanoseconds. - resolve_
chat_ 🔒id - Resolves an
OutboundMsg.channel_id(a stringified chat id, or empty for “use the bridge’s default”) into a Telegram numeric chat id. - run_
inbound_ 🔒loop - run_
outbound_ 🔒loop - run_
poll_ loop - Runs the inbound long-poll loop and the outbound send loop as two fully
independent tasks (
tokio::join!, nottokio::select!on a shared loop iteration). - unix_
secs 🔒