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

The unique Id of the user. Can be used to calculate the account's creation date.

Optional avatar hash.

Lets you know if the account is a bot or not.

The account's discriminator. The name + discriminator pair is always unique.

The account's username. Changing username will trigger a discriminator change if the pair is not unique.

Methods

impl User
[src]

Returns the formatted URL of the user's icon, if one exists.

Retrieves the time that this user was created at.

This is an alias of direct_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.

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);

Return a Mention which will ping this user.

Trait Implementations

impl Mentionable for User
[src]

impl Display for User
[src]

Formats a string which will mention the user.

impl Clone for User
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for User
[src]

Formats the value using the given formatter.