#[non_exhaustive]pub struct Emoji {
pub animated: bool,
pub available: bool,
pub id: EmojiId,
pub name: String,
pub managed: bool,
pub require_colons: bool,
pub roles: Vec<RoleId>,
pub user: Option<User>,
}
Expand description
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 (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.animated: bool
Whether the emoji is animated.
available: bool
Whether the emoji can be used. This may be false when the guild loses boosts, reducing the emoji limit.
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.
user: Option<User>
The user who created the emoji.
Implementations
sourceimpl Emoji
impl Emoji
sourcepub async fn delete<T: AsRef<Cache> + AsRef<Http>>(
&self,
cache_http: T
) -> Result<()>
Available on crate features model
and cache
only.
pub async fn delete<T: AsRef<Cache> + AsRef<Http>>(
&self,
cache_http: T
) -> Result<()>
model
and cache
only.Deletes the emoji. This method requires the cache to fetch the guild ID.
Note: The Manage Emojis and Stickers permission is required.
Examples
Delete a given emoji:
// assuming emoji has been set already
match emoji.delete(&ctx).await {
Ok(()) => println!("Emoji deleted."),
Err(_) => println!("Could not delete emoji."),
}
Errors
Returns Error::Http
if the current user lacks permission,
or may return ModelError::ItemMissing
if the emoji is not
in the cache.
sourcepub async fn edit<T: AsRef<Cache> + AsRef<Http>>(
&mut self,
cache_http: T,
name: &str
) -> Result<()>
Available on crate features model
and cache
only.
pub async fn edit<T: AsRef<Cache> + AsRef<Http>>(
&mut self,
cache_http: T,
name: &str
) -> Result<()>
model
and cache
only.Edits the emoji by updating it with a new name. This method requires the cache to fetch the guild ID.
Note: The Manage Emojis and Stickers permission is required.
Errors
Returns Error::Http
if the current user lacks permission,
or if an invalid name is given.
Trait Implementations
sourceimpl ArgumentConvert for Emoji
impl ArgumentConvert for Emoji
Look up a Emoji
.
Requires the cache feature to be enabled.
The lookup strategy is as follows (in order):
- Lookup by ID.
- Lookup by extracting ID from the emoji.
- Lookup by name.
type Err = EmojiParseError
type Err = EmojiParseError
utils
and client
only.The associated error which can be returned from parsing.
sourcefn convert<'life0, 'life1, 'async_trait>(
ctx: &'life0 Context,
guild_id: Option<GuildId>,
_channel_id: Option<ChannelId>,
s: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn convert<'life0, 'life1, 'async_trait>(
ctx: &'life0 Context,
guild_id: Option<GuildId>,
_channel_id: Option<ChannelId>,
s: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
utils
and client
only.Parses a string s
as a command parameter of this type.
sourceimpl<'de> Deserialize<'de> for Emoji
impl<'de> Deserialize<'de> for Emoji
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Emoji> for ReactionType
impl From<Emoji> for ReactionType
sourcefn from(emoji: Emoji) -> ReactionType
fn from(emoji: Emoji) -> ReactionType
Converts to this type from the input type.
sourceimpl Mentionable for Emoji
impl Mentionable for Emoji
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more