pub struct StatefulEventLoop<S> { /* private fields */ }
Expand description

A stateful event loop.

Implementations§

Returns an Arc to the state.

Turns this event loop into a stateless one. Handlers added on this event loop are still kept.

Turns this event loop into another with other state. Handlers added on this event loop are still kept and will receive the previous state.

Sets the bot’s username.

The username is used when checking if a command such as /command@username was directed to the bot.

Fetches the bot’s username.

The username is used when checking if a command such as /command@username was directed to the bot.

Starts polling configuration.

Starts webhook configuration.

See our wiki to learn how to use webhook with tbot.

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.

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.

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.

Registers a new handler for the /start command.

Registers a new handler for the /start command and sets its description.

Registers a new handler for the /help command.

Registers a new handler for the /help command and sets its description.

Registers a new handler for the /settings command.

Registers a new handler for the /settings command and sets its description.

Registers a new handler for an edited command.

Registers a new handler for a sequence of edited commands.

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.

Registers a new handler for animations.

Registers a new handler for audio.

Registers a new handler for changed auto-delete timers.

Registers a new handler for chat members’ updated information.

Registers a new handler for chosen inline results.

Registers a new handler for contacts.

Registers a new handler for connected websites.

Registers a new handler for created groups.

Registers a new handler for data callbacks from chat messages.

Registers a new handler for data callbacks from inline messages.

Registers a new handler for deleted chat photos.

Registers a new handler for dice.

Registers a new handler for documents.

Registers a new handler for edited animations.

Registers a new handler for edited audio.

Registers a new handler for edited documents.

Registers a new handler for edited locations.

Registers a new handler for edited photos.

Registers a new handler for edited text messages.

Registers a new handler for edited videos.

Registers a new handler for when a voice chat is ended.

Registers a new handler for game callbacks from chat messages.

Registers a new handler for game callbacks from inline messages.

Registers a new handler for game messages.

Registers a new handler for inline queries.

Registers a new handler for when users are invited to a voice chat.

Registers a new handler for invoices.

Registers a new handler for left members.

Registers a new handler for locations.

Registers a new handler for migrations.

Registers a new handler for the bot’s update chat member status.

Registers a new handler for new chat photos.

Registers a new handler for new chat titles.

Registers a new handler for new members.

Registers a new handler for passport data.

Registers a new handler for successful payments.

Registers a new handler for photos.

Registers a new handler for pinned messages.

Registers a new handler for poll messages.

Registers a new handler for pre-checkout queries.

Registers a new handler for proximity alerts.

Registers a new handler for when a voice chat is scheduled.

Registers a new handler for shipping queries.

Registers a new handler for when a voice chat is started.

Registers a new handler for stickers.

Registers a new handler for text messages.

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.

Registers a new handler for new states of polls.

Registers a new handler for new answers in the poll.

Registers a new handler for venues.

Registers a new handler for videos.

Registers a new handler for video notes.

Registers a new handler for voice messages.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more