pub struct ClientBuilder { /* private fields */ }
Expand description

A builder for the Client object to make customisation easier

Implementations§

source§

impl ClientBuilder

source

pub fn new() -> Self

Creates a bare builder

source

pub fn set_webhook(&mut self, webhook: &WebhookOptions) -> &mut Self

sets the webhook url for the Client to listen to

source

pub fn set_framework(&mut self, framework: Arc<Framework>) -> &mut Self

Sets the framework for your bot to use, please use the create_framework macro for creating it

source

pub fn set_token(&mut self, token: impl ToString) -> &mut Self

Sets the token to be used in authorizing the API requests of your bot

source

pub fn set_hyper_client(&mut self, client: TlsClient) -> &mut Self

Sets the custom hyper client for the APIClient to use

source

pub fn set_api_client(&mut self, client: Arc<Box<dyn API + Send>>) -> &mut Self

Sets the custom API client

source

pub fn set_allowed_updates(&mut self, allowed: Vec<UpdateType>) -> &mut Self

Set the list of update types you want your update handlers to handle An empty list means all updates except ChatMember

source

pub fn add_allowed_updates(&mut self, allowed: UpdateType) -> &mut Self

Add an update type to the list of update types you want your update handlers to handle

An empty list means all updates except ChatMember

source

pub fn remove_allowed_updates(&mut self, denied: &UpdateType) -> &mut Self

Remove an update type from the list of update types you want your update handlers to handle

Note: An empty list means all updates except ChatMember

source

pub fn add_handler_func(&mut self, handler: EventHandlerFunc) -> &mut Self

Adds an EventHandlerFunc function for handling incoming updates

source

pub fn add_raw_handler_func( &mut self, handler: RawEventHandlerFunc ) -> &mut Self

Adds an RawEventHandlerFunc function for handling incoming updates

source

pub fn build(&mut self) -> Client

Creates the Client object from the settings set in the ClientBuilder object

Panics

Will panic if no token or custom API client was set

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more