[][src]Struct telebot::bot::Bot

pub struct Bot {
    pub request: RequestHandle,
    pub handlers: HashMap<String, UnboundedSender<(RequestHandle, Message)>>,
    pub unknown_handler: Option<UnboundedSender<(RequestHandle, Message)>>,
    pub callback_handler: Option<UnboundedSender<(RequestHandle, CallbackQuery)>>,
    pub inline_handler: Option<UnboundedSender<(RequestHandle, InlineQuery)>>,
    // some fields omitted
}

Fields

request: RequestHandlehandlers: HashMap<String, UnboundedSender<(RequestHandle, Message)>>unknown_handler: Option<UnboundedSender<(RequestHandle, Message)>>callback_handler: Option<UnboundedSender<(RequestHandle, CallbackQuery)>>inline_handler: Option<UnboundedSender<(RequestHandle, InlineQuery)>>

Methods

impl Bot[src]

pub fn new(key: &str) -> Bot[src]

pub fn update_interval(self, interval: u64) -> Bot[src]

Sets the update interval to an integer in milliseconds

pub fn timeout(self, timeout: u64) -> Bot[src]

Sets the timeout interval for long polling

pub fn new_cmd(
    &mut self,
    cmd: &str
) -> impl Stream<Item = (RequestHandle, Message), Error = Error>
[src]

Creates a new command and returns a stream which will yield a message when the command is send

pub fn unknown_cmd(
    &mut self
) -> impl Stream<Item = (RequestHandle, Message), Error = Error>
[src]

Returns a stream which will yield a message when none of previously registered commands matches

pub fn callback(
    &mut self
) -> impl Stream<Item = (RequestHandle, CallbackQuery), Error = Error>
[src]

Returns a stream which will yield a received CallbackQuery

pub fn inline(
    &mut self
) -> impl Stream<Item = (RequestHandle, InlineQuery), Error = Error>
[src]

Returns a stream which will yield a received CallbackQuery

pub fn resolve_name(&self) -> impl Future<Item = Option<String>, Error = Error>[src]

pub fn process_updates(
    self,
    last_id: Arc<AtomicUsize>
) -> impl Stream<Item = (RequestHandle, Update), Error = Error>
[src]

pub fn get_stream(
    self,
    name: Option<String>
) -> impl Stream<Item = (RequestHandle, Update), Error = Error>
[src]

The main update loop, the update function is called every update_interval milliseconds When an update is available the last_id will be updated and the message is filtered for commands The message is forwarded to the returned stream if no command was found

pub fn into_future(&self) -> impl Future<Item = (), Error = Error>[src]

pub fn run_with<I>(self, other: I) where
    I: IntoFuture<Error = Error>,
    <I as IntoFuture>::Future: Send + 'static,
    <I as IntoFuture>::Item: Send
[src]

pub fn run(self)[src]

Trait Implementations

impl Clone for Bot[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Bot

impl Sync for Bot

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T