[−][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]
pub fn delete<T>(&self, cache_and_http: T) -> Result<()> where
T: AsRef<CacheRwLock> + AsRef<Http>,
[src]
T: AsRef<CacheRwLock> + AsRef<Http>,
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(&ctx) { Ok(()) => println!("Emoji deleted."), Err(_) => println!("Could not delete emoji.") }
pub fn edit<T>(&mut self, cache_and_http: T, name: &str) -> Result<()> where
T: AsRef<CacheRwLock> + AsRef<Http>,
[src]
T: AsRef<CacheRwLock> + AsRef<Http>,
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.
pub fn find_guild_id(&self, cache: impl AsRef<CacheRwLock>) -> Option<GuildId>
[src]
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(&cache) { println!("{} is owned by {}", emoji.name, guild_id); }
pub fn url(&self) -> String
[src]
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 Clone for Emoji
[src]
impl Debug for Emoji
[src]
impl<'de> Deserialize<'de> for Emoji
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for Emoji
[src]
fn fmt(&self, f: &mut Formatter) -> FmtResult
[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<'a> From<&'a Emoji> for EmojiId
[src]
impl From<Emoji> for ReactionType
[src]
fn from(emoji: Emoji) -> ReactionType
[src]
impl From<Emoji> for EmojiId
[src]
impl Mentionable for Emoji
[src]
impl Serialize for Emoji
[src]
Auto Trait Implementations
impl RefUnwindSafe for Emoji
impl Send for Emoji
impl Sync for Emoji
impl Unpin for Emoji
impl UnwindSafe for Emoji
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CloneAny for T where
T: Clone + Any,
[src]
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
[src]
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
[src]
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
[src]
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
[src]
T: Send + Sync,
impl<T> DebugAny for T where
T: Any + Debug,
[src]
T: Any + Debug,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,