pub trait UserExt: User {
// Provided methods
fn send<B: Backend>(
&self,
ctx: &Context<B>,
body: impl Into<CreateMessage>,
) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send { ... }
fn create_dm<B: Backend>(
&self,
ctx: &Context<B>,
) -> impl Future<Output = Result<Arc<Channel>, Error>> + Send { ... }
}Expand description
Actions on a user: User or CachedUser.
This trait is sealed.
discord.js counterpart: the methods of User.
§Examples
client.on(Events::GuildMemberAdd, |ctx, join| async move {
join.user.send(&ctx, "Welcome!").await?;
Ok(())
});Provided Methods§
Sourcefn send<B: Backend>(
&self,
ctx: &Context<B>,
body: impl Into<CreateMessage>,
) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
fn send<B: Backend>( &self, ctx: &Context<B>, body: impl Into<CreateMessage>, ) -> impl Future<Output = Result<Arc<CachedMessage>, Error>> + Send
Sends a direct message to this user (UserManager::send).
discord.js counterpart: User#send.
§Errors
Returns the REST error if a request failed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".