pub struct TelegramEvents { /* private fields */ }Expand description
The venture’s hooks: TelegramEvents::new().on_message(|message| ...).
Every hook is optional. An update kind with no hook is still handled — linking, the action buttons and the dedup ledger all run; only the venture’s part is a no-op.
Implementations§
Source§impl TelegramEvents
impl TelegramEvents
pub fn new() -> Self
Sourcepub fn on_message(
self,
hook: impl Fn(Message) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static,
) -> Self
pub fn on_message( self, hook: impl Fn(Message) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static, ) -> Self
Calls hook with every plain message. A hook error fails the
delivery with a 5xx and leaves the dedup key unclaimed, so
Telegram’s redelivery re-runs it.
Sourcepub fn on_command(
self,
hook: impl Fn(Command) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static,
) -> Self
pub fn on_command( self, hook: impl Fn(Command) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static, ) -> Self
Calls hook with every /command — including /start when it
arrives without a code, or from a group chat rather than the
private conversation linking happens in.
Sourcepub fn on_callback(
self,
hook: impl Fn(CallbackQuery) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static,
) -> Self
pub fn on_callback( self, hook: impl Fn(CallbackQuery) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static, ) -> Self
Calls hook with every button press whose data is not one of
this module’s action tokens — the venture’s own keyboard buttons.
Sourcepub fn on_channel_post(
self,
hook: impl Fn(ChannelPost) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static,
) -> Self
pub fn on_channel_post( self, hook: impl Fn(ChannelPost) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static, ) -> Self
Calls hook with every channel post (edits included, flagged).
Sourcepub fn on_linked(
self,
hook: impl Fn(Linked) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static,
) -> Self
pub fn on_linked( self, hook: impl Fn(Linked) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static, ) -> Self
Calls hook when a /start <code> links an account. After this
fires, the subject’s prompts and notifications go to the chat.
Sourcepub fn on_action(
self,
hook: impl Fn(ActionDecision) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static,
) -> Self
pub fn on_action( self, hook: impl Fn(ActionDecision) -> BoxFuture<'static, Result<(), AnyError>> + Send + Sync + 'static, ) -> Self
Calls hook with every finished consent decision — a Telegram
tap (passkey_confirmed: false) or the web app’s passkey
confirmation (true). Value-moving approvals fired only from
the confirm route never reach Telegram taps.