Skip to main content

BotBuilder

Struct BotBuilder 

Source
pub struct BotBuilder<'a, 'b, 'c, S: Send + Sync + ?Sized + 'static> { /* private fields */ }

Implementations§

Source§

impl<'a, 'b, 'c> BotBuilder<'a, 'b, 'c, ()>

Source

pub fn new( category_slug: &'a str, client_id: &'b str, client_secret: &'c str, ) -> Self

Source

pub fn state<S: Send + Sync + ?Sized + 'static>( self, state: Arc<S>, ) -> BotBuilder<'a, 'b, 'c, S>

Source§

impl<S: Send + Sync + ?Sized + 'static> BotBuilder<'_, '_, '_, S>

Source

pub fn host(self, host_info: HostInfo) -> Self

Source

pub fn user_agent(self, user_agent: &'static str) -> Self

Defaults to racetime-rs/0.35.3.

Source

pub fn scan_races_every(self, scan_races_every: UDuration) -> Self

According to https://github.com/racetimeGG/racetime-app/issues/217#issuecomment-2915924787 this can be set as low as 5 seconds without hitting rate limits. Defaults to 30 seconds.

Source

pub fn network_timeout(self, network_timeout: Option<UDuration>) -> Self

Consider it an error if any network operation (HTTP request or WebSocket write) takes longer than this.

After a WebSocket read is silent for this long, the bot sends one liveness probe. If the connection remains silent for another interval, it reconnects. No probes are sent while the server’s normal keepalive messages are arriving. Defaults to 1 hour.

Source

pub async fn build(self) -> Result<Bot<S>, AuthError>

Auto Trait Implementations§

§

impl<'a, 'b, 'c, S> Freeze for BotBuilder<'a, 'b, 'c, S>
where Arc<S>: Freeze, S: ?Sized,

§

impl<'a, 'b, 'c, S> RefUnwindSafe for BotBuilder<'a, 'b, 'c, S>
where Arc<S>: RefUnwindSafe, S: ?Sized,

§

impl<'a, 'b, 'c, S> Send for BotBuilder<'a, 'b, 'c, S>
where Arc<S>: Send, S: ?Sized,

§

impl<'a, 'b, 'c, S> Sync for BotBuilder<'a, 'b, 'c, S>
where Arc<S>: Sync, S: ?Sized,

§

impl<'a, 'b, 'c, S> Unpin for BotBuilder<'a, 'b, 'c, S>
where Arc<S>: Unpin, S: ?Sized,

§

impl<'a, 'b, 'c, S> UnsafeUnpin for BotBuilder<'a, 'b, 'c, S>
where Arc<S>: UnsafeUnpin, S: ?Sized,

§

impl<'a, 'b, 'c, S> UnwindSafe for BotBuilder<'a, 'b, 'c, S>
where Arc<S>: UnwindSafe, S: ?Sized,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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.

Source§

impl<T> Instrument for T

Source§

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

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

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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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