[−][src]Struct serenity::model::guild::Emoji
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 Mentionable for Emoji
[src]
impl Mentionable for Emoji
fn mention(&self) -> String
[src]
fn mention(&self) -> String
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]
impl From<Emoji> for ReactionType
fn from(emoji: Emoji) -> ReactionType
[src]
fn from(emoji: Emoji) -> ReactionType
Performs the conversion.
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 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 Serialize for Emoji
[src]
impl Serialize for Emoji
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for Emoji
[src]
impl<'de> Deserialize<'de> for Emoji
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 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]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 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> DeserializeOwned for T where
T: Deserialize<'de>,
impl<T> Erased for T
impl<T> Erased for T
impl<T> Typeable for T where
T: Any,
impl<T> Typeable for T where
T: Any,
impl<T> DebugAny for T where
T: Any + Debug,
[src]
impl<T> DebugAny for T where
T: Any + Debug,
impl<T> CloneAny for T where
T: Clone + Any,
[src]
impl<T> CloneAny for T where
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
[src]
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
[src]
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
[src]
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
[src]
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,