Struct tbot::state::StatefulEventLoop
source · pub struct StatefulEventLoop<S> { /* private fields */ }
Expand description
A stateful event loop.
Implementations§
source§impl<S> StatefulEventLoop<S>
impl<S> StatefulEventLoop<S>
sourcepub fn into_stateless(self) -> EventLoop
pub fn into_stateless(self) -> EventLoop
Turns this event loop into a stateless one. Handlers added on this event loop are still kept.
sourcepub fn with_other_state<T>(self, other_state: T) -> StatefulEventLoop<T>where
T: Send + Sync + 'static,
pub fn with_other_state<T>(self, other_state: T) -> StatefulEventLoop<T>where
T: Send + Sync + 'static,
Turns this event loop into another with other state. Handlers added on this event loop are still kept and will receive the previous state.
sourcepub fn username(&mut self, username: String)
pub fn username(&mut self, username: String)
Sets the bot’s username.
The username is used when checking if a command such as
/command@username
was directed to the bot.
sourcepub async fn fetch_username(&mut self) -> Result<(), MethodCall>
pub async fn fetch_username(&mut self) -> Result<(), MethodCall>
Fetches the bot’s username.
The username is used when checking if a command such as
/command@username
was directed to the bot.
source§impl<S> StatefulEventLoop<S>where
S: Send + Sync + 'static,
impl<S> StatefulEventLoop<S>where
S: Send + Sync + 'static,
sourcepub fn command<H, F>(&mut self, command: &'static str, handler: H)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn command<H, F>(&mut self, command: &'static str, handler: H)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for a command.
Note that commands such as /command@username
will be completely
ignored unless you configure the event loop with your bot’s username
with either username
or fetch_username
.
sourcepub fn command_with_description<H, F>(
&mut self,
command: &'static str,
description: &'static str,
handler: H
)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn command_with_description<H, F>(
&mut self,
command: &'static str,
description: &'static str,
handler: H
)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for a command and sets its description.
Note that commands such as /command@username
will be completely
ignored unless you configure the event loop with your bot’s username
with either username
or fetch_username
.
sourcepub fn commands<Cm, H, F>(&mut self, commands: Cm, handler: H)where
Cm: IntoIterator<Item = &'static str>,
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn commands<Cm, H, F>(&mut self, commands: Cm, handler: H)where
Cm: IntoIterator<Item = &'static str>,
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for a sequence of commands.
Note that commands such as /command@username
will be completely
ignored unless you configure the event loop with your bot’s username
with either username
or fetch_username
.
sourcepub fn start<H, F>(&mut self, handler: H)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn start<H, F>(&mut self, handler: H)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for the /start
command.
sourcepub fn start_with_description<H, F>(
&mut self,
description: &'static str,
handler: H
)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn start_with_description<H, F>(
&mut self,
description: &'static str,
handler: H
)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for the /start
command and sets its
description.
sourcepub fn help<H, F>(&mut self, handler: H)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn help<H, F>(&mut self, handler: H)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for the /help
command.
sourcepub fn help_with_description<H, F>(
&mut self,
description: &'static str,
handler: H
)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn help_with_description<H, F>(
&mut self,
description: &'static str,
handler: H
)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for the /help
command and sets its
description.
sourcepub fn settings<H, F>(&mut self, handler: H)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn settings<H, F>(&mut self, handler: H)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for the /settings
command.
sourcepub fn settings_with_description<H, F>(
&mut self,
description: &'static str,
handler: H
)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn settings_with_description<H, F>(
&mut self,
description: &'static str,
handler: H
)where
H: Fn(Arc<Command>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for the /settings
command and sets its
description.
sourcepub fn edited_command<H, F>(&mut self, command: &'static str, handler: H)where
H: Fn(Arc<EditedCommand>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn edited_command<H, F>(&mut self, command: &'static str, handler: H)where
H: Fn(Arc<EditedCommand>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for an edited command.
sourcepub fn edited_commands<Cm, H, F>(&mut self, commands: Cm, handler: H)where
Cm: IntoIterator<Item = &'static str>,
H: Fn(Arc<EditedCommand>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn edited_commands<Cm, H, F>(&mut self, commands: Cm, handler: H)where
Cm: IntoIterator<Item = &'static str>,
H: Fn(Arc<EditedCommand>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for a sequence of edited commands.
sourcepub fn any_update<H, F>(&mut self, handler: H)where
H: Fn(Arc<AnyUpdate>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn any_update<H, F>(&mut self, handler: H)where
H: Fn(Arc<AnyUpdate>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for all incoming updates.
any_update
handlers are spawned before specialized handlers,
for every update that could be deserialized (this means that
processing new updates on old versions of tbot
is not possible
even via any_update
).
Note “spawned”: every handler is executed using [tokio::spawn
],
and tbot
won’t wait for them to finish. As such, any_update
is
not suitable for running some code before every specialized handler.
Also, any_update
does not affect unhandled
in any way. It’s
executed if a specialized handler corresponding to the incoming
update wasn’t registered.
Registering specialized handler is still preferred. if at least
one any_update
handler is registered, tbot
will have to clone
every update in order to execute these and specialized handlers.
sourcepub fn animation<H, F>(&mut self, handler: H)where
H: Fn(Arc<Animation>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn animation<H, F>(&mut self, handler: H)where
H: Fn(Arc<Animation>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for animations.
sourcepub fn audio<H, F>(&mut self, handler: H)where
H: Fn(Arc<Audio>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn audio<H, F>(&mut self, handler: H)where
H: Fn(Arc<Audio>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for audio.
sourcepub fn changed_auto_delete_timer<H, F>(&mut self, handler: H)where
H: Fn(Arc<ChangedAutoDeleteTimer>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn changed_auto_delete_timer<H, F>(&mut self, handler: H)where
H: Fn(Arc<ChangedAutoDeleteTimer>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for changed auto-delete timers.
sourcepub fn chat_member<H, F>(&mut self, handler: H)where
H: Fn(Arc<ChatMember>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn chat_member<H, F>(&mut self, handler: H)where
H: Fn(Arc<ChatMember>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for chat members’ updated information.
sourcepub fn chosen_inline<H, F>(&mut self, handler: H)where
H: Fn(Arc<ChosenInline>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn chosen_inline<H, F>(&mut self, handler: H)where
H: Fn(Arc<ChosenInline>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for chosen inline results.
sourcepub fn contact<H, F>(&mut self, handler: H)where
H: Fn(Arc<Contact>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn contact<H, F>(&mut self, handler: H)where
H: Fn(Arc<Contact>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for contacts.
sourcepub fn connected_website<H, F>(&mut self, handler: H)where
H: Fn(Arc<ConnectedWebsite>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn connected_website<H, F>(&mut self, handler: H)where
H: Fn(Arc<ConnectedWebsite>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for connected websites.
sourcepub fn created_group<H, F>(&mut self, handler: H)where
H: Fn(Arc<CreatedGroup>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn created_group<H, F>(&mut self, handler: H)where
H: Fn(Arc<CreatedGroup>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for created groups.
sourcepub fn message_data_callback<H, F>(&mut self, handler: H)where
H: Fn(Arc<MessageDataCallback>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn message_data_callback<H, F>(&mut self, handler: H)where
H: Fn(Arc<MessageDataCallback>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for data callbacks from chat messages.
sourcepub fn inline_data_callback<H, F>(&mut self, handler: H)where
H: Fn(Arc<InlineDataCallback>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn inline_data_callback<H, F>(&mut self, handler: H)where
H: Fn(Arc<InlineDataCallback>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for data callbacks from inline messages.
sourcepub fn deleted_chat_photo<H, F>(&mut self, handler: H)where
H: Fn(Arc<DeletedChatPhoto>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn deleted_chat_photo<H, F>(&mut self, handler: H)where
H: Fn(Arc<DeletedChatPhoto>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for deleted chat photos.
sourcepub fn dice<H, F>(&mut self, handler: H)where
H: Fn(Arc<Dice>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn dice<H, F>(&mut self, handler: H)where
H: Fn(Arc<Dice>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for dice.
sourcepub fn document<H, F>(&mut self, handler: H)where
H: Fn(Arc<Document>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn document<H, F>(&mut self, handler: H)where
H: Fn(Arc<Document>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for documents.
sourcepub fn edited_animation<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedAnimation>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn edited_animation<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedAnimation>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for edited animations.
sourcepub fn edited_audio<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedAudio>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn edited_audio<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedAudio>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for edited audio.
sourcepub fn edited_document<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedDocument>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn edited_document<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedDocument>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for edited documents.
sourcepub fn edited_location<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedLocation>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn edited_location<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedLocation>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for edited locations.
sourcepub fn edited_photo<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedPhoto>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn edited_photo<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedPhoto>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for edited photos.
sourcepub fn edited_text<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedText>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn edited_text<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedText>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for edited text messages.
sourcepub fn edited_video<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedVideo>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn edited_video<H, F>(&mut self, handler: H)where
H: Fn(Arc<EditedVideo>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for edited videos.
sourcepub fn ended_voice_chat<H, F>(&mut self, handler: H)where
H: Fn(Arc<EndedVoiceChat>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn ended_voice_chat<H, F>(&mut self, handler: H)where
H: Fn(Arc<EndedVoiceChat>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for when a voice chat is ended.
sourcepub fn message_game_callback<H, F>(&mut self, handler: H)where
H: Fn(Arc<MessageGameCallback>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn message_game_callback<H, F>(&mut self, handler: H)where
H: Fn(Arc<MessageGameCallback>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for game callbacks from chat messages.
sourcepub fn inline_game_callback<H, F>(&mut self, handler: H)where
H: Fn(Arc<InlineGameCallback>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn inline_game_callback<H, F>(&mut self, handler: H)where
H: Fn(Arc<InlineGameCallback>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for game callbacks from inline messages.
sourcepub fn game<H, F>(&mut self, handler: H)where
H: Fn(Arc<Game>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn game<H, F>(&mut self, handler: H)where
H: Fn(Arc<Game>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for game messages.
sourcepub fn inline<H, F>(&mut self, handler: H)where
H: Fn(Arc<Inline>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn inline<H, F>(&mut self, handler: H)where
H: Fn(Arc<Inline>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for inline queries.
sourcepub fn invited_voice_chat_participants<H, F>(&mut self, handler: H)where
H: Fn(Arc<InvitedVoiceChatParticipants>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn invited_voice_chat_participants<H, F>(&mut self, handler: H)where
H: Fn(Arc<InvitedVoiceChatParticipants>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for when users are invited to a voice chat.
sourcepub fn invoice<H, F>(&mut self, handler: H)where
H: Fn(Arc<Invoice>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn invoice<H, F>(&mut self, handler: H)where
H: Fn(Arc<Invoice>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for invoices.
sourcepub fn left_member<H, F>(&mut self, handler: H)where
H: Fn(Arc<LeftMember>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn left_member<H, F>(&mut self, handler: H)where
H: Fn(Arc<LeftMember>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for left members.
sourcepub fn location<H, F>(&mut self, handler: H)where
H: Fn(Arc<Location>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn location<H, F>(&mut self, handler: H)where
H: Fn(Arc<Location>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for locations.
sourcepub fn migration<H, F>(&mut self, handler: H)where
H: Fn(Arc<Migration>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn migration<H, F>(&mut self, handler: H)where
H: Fn(Arc<Migration>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for migrations.
sourcepub fn my_chat_member<H, F>(&mut self, handler: H)where
H: Fn(Arc<MyChatMember>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn my_chat_member<H, F>(&mut self, handler: H)where
H: Fn(Arc<MyChatMember>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for the bot’s update chat member status.
sourcepub fn new_chat_photo<H, F>(&mut self, handler: H)where
H: Fn(Arc<NewChatPhoto>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn new_chat_photo<H, F>(&mut self, handler: H)where
H: Fn(Arc<NewChatPhoto>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for new chat photos.
sourcepub fn new_chat_title<H, F>(&mut self, handler: H)where
H: Fn(Arc<NewChatTitle>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn new_chat_title<H, F>(&mut self, handler: H)where
H: Fn(Arc<NewChatTitle>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for new chat titles.
sourcepub fn new_members<H, F>(&mut self, handler: H)where
H: Fn(Arc<NewMembers>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn new_members<H, F>(&mut self, handler: H)where
H: Fn(Arc<NewMembers>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for new members.
sourcepub fn passport<H, F>(&mut self, handler: H)where
H: Fn(Arc<Passport>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn passport<H, F>(&mut self, handler: H)where
H: Fn(Arc<Passport>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for passport data.
sourcepub fn payment<H, F>(&mut self, handler: H)where
H: Fn(Arc<Payment>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn payment<H, F>(&mut self, handler: H)where
H: Fn(Arc<Payment>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for successful payments.
sourcepub fn photo<H, F>(&mut self, handler: H)where
H: Fn(Arc<Photo>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn photo<H, F>(&mut self, handler: H)where
H: Fn(Arc<Photo>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for photos.
sourcepub fn pinned_message<H, F>(&mut self, handler: H)where
H: Fn(Arc<PinnedMessage>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn pinned_message<H, F>(&mut self, handler: H)where
H: Fn(Arc<PinnedMessage>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for pinned messages.
sourcepub fn poll<H, F>(&mut self, handler: H)where
H: Fn(Arc<Poll>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn poll<H, F>(&mut self, handler: H)where
H: Fn(Arc<Poll>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for poll messages.
sourcepub fn pre_checkout<H, F>(&mut self, handler: H)where
H: Fn(Arc<PreCheckout>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn pre_checkout<H, F>(&mut self, handler: H)where
H: Fn(Arc<PreCheckout>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for pre-checkout queries.
sourcepub fn proximity_alert<H, F>(&mut self, handler: H)where
H: Fn(Arc<ProximityAlert>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn proximity_alert<H, F>(&mut self, handler: H)where
H: Fn(Arc<ProximityAlert>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for proximity alerts.
sourcepub fn scheduled_voice_chat<H, F>(&mut self, handler: H)where
H: Fn(Arc<ScheduledVoiceChat>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn scheduled_voice_chat<H, F>(&mut self, handler: H)where
H: Fn(Arc<ScheduledVoiceChat>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for when a voice chat is scheduled.
sourcepub fn shipping<H, F>(&mut self, handler: H)where
H: Fn(Arc<Shipping>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn shipping<H, F>(&mut self, handler: H)where
H: Fn(Arc<Shipping>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for shipping queries.
sourcepub fn started_voice_chat<H, F>(&mut self, handler: H)where
H: Fn(Arc<StartedVoiceChat>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn started_voice_chat<H, F>(&mut self, handler: H)where
H: Fn(Arc<StartedVoiceChat>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for when a voice chat is started.
sourcepub fn sticker<H, F>(&mut self, handler: H)where
H: Fn(Arc<Sticker>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn sticker<H, F>(&mut self, handler: H)where
H: Fn(Arc<Sticker>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for stickers.
sourcepub fn text<H, F>(&mut self, handler: H)where
H: Fn(Arc<Text>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn text<H, F>(&mut self, handler: H)where
H: Fn(Arc<Text>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for text messages.
sourcepub fn unhandled<H, F>(&mut self, handler: H)where
H: Fn(Arc<Unhandled>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn unhandled<H, F>(&mut self, handler: H)where
H: Fn(Arc<Unhandled>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for unhandled updates.
Note that regisering any_update
handlers does not affect
unhandled
handlers in any way. An unhandled
handler is spawned
if a specialized handler corresponding to the incoming update was
not registered.
sourcepub fn updated_poll<H, F>(&mut self, handler: H)where
H: Fn(Arc<UpdatedPoll>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn updated_poll<H, F>(&mut self, handler: H)where
H: Fn(Arc<UpdatedPoll>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for new states of polls.
sourcepub fn poll_answer<H, F>(&mut self, handler: H)where
H: Fn(Arc<PollAnswer>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn poll_answer<H, F>(&mut self, handler: H)where
H: Fn(Arc<PollAnswer>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for new answers in the poll.
sourcepub fn venue<H, F>(&mut self, handler: H)where
H: Fn(Arc<Venue>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn venue<H, F>(&mut self, handler: H)where
H: Fn(Arc<Venue>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for venues.
sourcepub fn video<H, F>(&mut self, handler: H)where
H: Fn(Arc<Video>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
pub fn video<H, F>(&mut self, handler: H)where
H: Fn(Arc<Video>, Arc<S>) -> F + Send + Sync + 'static,
F: Future<Output = ()> + Send + 'static,
Registers a new handler for videos.