Struct serenity::model::guild::Emoji [−][src]
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
animated: bool
Whether the emoji is animated.
id: EmojiId
The Id of the emoji.
name: String
The name of the emoji. It must be at least 2 characters long and can only contain alphanumeric characters and underscores.
managed: bool
Whether the emoji is managed via an Integration
service.
require_colons: bool
Whether the emoji name needs to be surrounded by colons in order to be used by the client.
roles: Vec<RoleId>
A list of Role
s that are allowed to use the emoji. If there are no
roles specified, then usage is unrestricted.
Methods
impl Emoji
[src]
impl Emoji
pub fn delete(&self) -> Result<()>
[src]
pub fn delete(&self) -> Result<()>
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.") }
pub fn edit(&mut self, name: &str) -> Result<()>
[src]
pub fn edit(&mut self, name: &str) -> Result<()>
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");
pub fn find_guild_id(&self) -> Option<GuildId>
[src]
pub fn find_guild_id(&self) -> Option<GuildId>
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); }
pub fn url(&self) -> String
[src]
pub fn url(&self) -> String
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 From<Emoji> for ReactionType
[src]
impl From<Emoji> for ReactionType
fn from(emoji: Emoji) -> ReactionType
[src]
fn from(emoji: Emoji) -> ReactionType
Performs the conversion.
impl Clone for Emoji
[src]
impl Clone for Emoji
fn clone(&self) -> Emoji
[src]
fn clone(&self) -> Emoji
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Emoji
[src]
impl Debug for Emoji
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Display for Emoji
[src]
impl Display for Emoji
fn fmt(&self, f: &mut Formatter) -> FmtResult
[src]
fn fmt(&self, f: &mut Formatter) -> FmtResult
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 From<Emoji> for EmojiId
[src]
impl From<Emoji> for EmojiId
impl<'a> From<&'a Emoji> for EmojiId
[src]
impl<'a> From<&'a Emoji> for EmojiId
impl Mentionable for Emoji
[src]
impl Mentionable for Emoji