[][src]Struct serenity::model::guild::Emoji

pub struct Emoji {
    pub animated: bool,
    pub id: EmojiId,
    pub name: String,
    pub managed: bool,
    pub require_colons: bool,
    pub roles: Vec<RoleId>,
}

Represents a custom guild emoji, which can either be created using the API, or via an integration. Emojis created using the API only work within the guild it was created in.

Fields

Whether the emoji is animated.

The Id of the emoji.

The name of the emoji. It must be at least 2 characters long and can only contain alphanumeric characters and underscores.

Whether the emoji is managed via an Integration service.

Whether the emoji name needs to be surrounded by colons in order to be used by the client.

A list of Roles that are allowed to use the emoji. If there are no roles specified, then usage is unrestricted.

Methods

impl Emoji
[src]

Deletes the emoji.

Note: The Manage Emojis permission is required.

Note: Only user accounts may use this method.

Examples

Delete a given emoji:

// assuming emoji has been set already
match emoji.delete() {
    Ok(()) => println!("Emoji deleted."),
    Err(_) => println!("Could not delete emoji.")
}

Edits the emoji by updating it with a new name.

Note: The Manage Emojis permission is required.

Note: Only user accounts may use this method.

Examples

Change the name of an emoji:

// assuming emoji has been set already
let _ = emoji.edit("blobuwu");
assert_eq!(emoji.name, "blobuwu");

Finds the Guild that owns the emoji by looking through the Cache.

Examples

Print the guild id that owns this emoji:

// assuming emoji has been set already
if let Some(guild_id) = emoji.find_guild_id() {
    println!("{} is owned by {}", emoji.name, guild_id);
}

Generates a URL to the emoji's image.

Examples

Print the direct link to the given emoji:

// assuming emoji has been set already
println!("Direct link to emoji image: {}", emoji.url());

Trait Implementations

impl Mentionable for Emoji
[src]

Creates a mentionable string, that will be able to notify and/or create a link to the item. Read more

impl From<Emoji> for ReactionType
[src]

Performs the conversion.

impl From<Emoji> for EmojiId
[src]

Gets the Id of an Emoji.

impl<'a> From<&'a Emoji> for EmojiId
[src]

Gets the Id of an Emoji.

impl Clone for Emoji
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Emoji
[src]

Formats the value using the given formatter. Read more

impl Display for Emoji
[src]

Formats the emoji into a string that will cause Discord clients to render the emoji.

This is in the format of: <:NAME:EMOJI_ID>.

impl Serialize for Emoji
[src]

Serialize this value into the given Serde serializer. Read more

impl<'de> Deserialize<'de> for Emoji
[src]

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations

impl Send for Emoji

impl Sync for Emoji

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

Converts the given value to a String. Read more

impl<T> ToOwned for T where
    T: Clone
[src]

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

Get the TypeId of this object.

impl<T> DebugAny for T where
    T: Any + Debug
[src]

impl<T> CloneAny for T where
    T: Clone + Any
[src]

impl<T> UnsafeAny for T where
    T: Any