Struct teloxide::update_listeners::PollingBuilder
source · #[non_exhaustive]pub struct PollingBuilder<R> {
pub bot: R,
pub timeout: Option<Duration>,
pub limit: Option<u8>,
pub allowed_updates: Option<Vec<AllowedUpdate>>,
pub drop_pending_updates: bool,
}
Expand description
Builder for polling update listener.
Can be created by Polling::builder
.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.bot: R
§timeout: Option<Duration>
§limit: Option<u8>
§allowed_updates: Option<Vec<AllowedUpdate>>
§drop_pending_updates: bool
Implementations§
source§impl<R> PollingBuilder<R>where
R: Requester + Send + 'static,
<R as Requester>::GetUpdates: Send,
impl<R> PollingBuilder<R>where
R: Requester + Send + 'static,
<R as Requester>::GetUpdates: Send,
sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
A timeout in seconds for polling.
Note
timeout
should not be bigger than http client timeout, see
default_reqwest_settings
for default http client settings.
sourcepub fn limit(self, limit: u8) -> Self
pub fn limit(self, limit: u8) -> Self
Limit the number of updates to be retrieved at once. Values between 1—100 are accepted.
Panics
If limit
is 0 or greater than 100.
sourcepub fn allowed_updates(self, allowed_updates: Vec<AllowedUpdate>) -> Self
pub fn allowed_updates(self, allowed_updates: Vec<AllowedUpdate>) -> Self
A list of the types of updates you want to receive.
Note
teloxide
normally (when using Dispatcher
or repl
s) sets this
automatically via hint_allowed_updates
, so you rarely need to use
allowed_updates
explicitly.
sourcepub fn drop_pending_updates(self) -> Self
pub fn drop_pending_updates(self) -> Self
Drops pending updates.
sourcepub async fn delete_webhook(self) -> Self
pub async fn delete_webhook(self) -> Self
Deletes webhook if it was set up.
sourcepub fn build(self) -> Polling<R>
pub fn build(self) -> Polling<R>
Returns a long polling update listener with configuration from the builder.
See also: polling_default
, Polling
.