pub struct UserManager<'a, B: Backend> { /* private fields */ }Expand description
The users the bot knows. Returned by Context::users.
discord.js counterpart: UserManager (client.users).
Implementations§
Source§impl<'a, B: Backend> UserManager<'a, B>
impl<'a, B: Backend> UserManager<'a, B>
Sourcepub fn cache(self) -> Option<CacheView<'a, UserId, CachedUser, B>>
pub fn cache(self) -> Option<CacheView<'a, UserId, CachedUser, B>>
The cached users, if the client has a cache.
discord.js counterpart: UserManager#cache.
Sourcepub fn fetch(
self,
user_id: UserId,
) -> Fetch<Arc<CachedUser>, impl Future<Output = Result<Arc<CachedUser>, Error>> + Send + 'a>
pub fn fetch( self, user_id: UserId, ) -> Fetch<Arc<CachedUser>, impl Future<Output = Result<Arc<CachedUser>, Error>> + Send + 'a>
Sourcepub fn send(
self,
user_id: UserId,
body: impl Into<CreateMessage>,
) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send + 'a
pub fn send( self, user_id: UserId, body: impl Into<CreateMessage>, ) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send + 'a
Sends a direct message: opens the DM channel, then sends body to it.
discord.js counterpart: UserManager#send.
§Errors
Returns the REST error if a request failed (Discord refuses DMs to users who share no guild with the bot or closed their DMs).
Trait Implementations§
Source§impl<B: Backend> Clone for UserManager<'_, B>
impl<B: Backend> Clone for UserManager<'_, B>
impl<B: Backend> Copy for UserManager<'_, B>
Auto Trait Implementations§
impl<'a, B> !RefUnwindSafe for UserManager<'a, B>
impl<'a, B> !UnwindSafe for UserManager<'a, B>
impl<'a, B> Freeze for UserManager<'a, B>
impl<'a, B> Send for UserManager<'a, B>
impl<'a, B> Sync for UserManager<'a, B>
impl<'a, B> Unpin for UserManager<'a, B>
impl<'a, B> UnsafeUnpin for UserManager<'a, B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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