Struct serenity::model::User
[−]
[src]
pub struct User { pub id: UserId, pub avatar: Option<String>, pub bot: bool, pub discriminator: String, pub name: String, }
Information about a user
Fields
id: UserId
avatar: Option<String>
bot: bool
discriminator: String
name: String
Methods
impl User
[src]
fn avatar_url(&self) -> Option<String>
Returns the formatted URL of the user's icon, if one exists.
fn created_at(&self) -> Timespec
Retrieves the time that this user was created at.
fn dm(&self, content: &str) -> Result<Message>
This is an alias of direct_message.
fn direct_message(&self, content: &str) -> Result<Message>
Send a direct message to a user. This will create or retrieve the PrivateChannel over REST if one is not already in the cache, and then send a message to it.
fn has_role<G, R>(&self, guild: G, role: R) -> bool where G: Into<GuildContainer>, R: Into<RoleId>
Check if a user has a Role
. This will retrieve the
Guild
from the Cache
if it is available, and then check if that
guild has the given Role
.
If the Guild
is not present, then the guild will be retrieved from
the API and the cache will be updated with it.
If there are issues with requesting the API, then false
will be
returned.
Three forms of data may be passed in to the guild parameter: either a
Guild
itself, a GuildId
, or a u64
.
Examples
Check if a guild has a Role
by Id:
// Assumes a 'guild' and `role_id` have already been bound context.message.author.has_role(guild, role_id);
fn mention(&self) -> Mention
Return a Mention
which will ping this user.
Trait Implementations
impl Mentionable for User
[src]
impl Display for User
[src]
impl Clone for User
[src]
fn clone(&self) -> User
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more