#[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§
Source§impl Emoji
impl Emoji
Sourcepub async fn delete(&self, cache_http: impl CacheHttp) -> Result<()>
👎Deprecated: Use Guild(Id)::delete_emoji, this performs a loop over all guilds!Available on crate features model
and cache
only.
pub async fn delete(&self, cache_http: impl CacheHttp) -> Result<()>
model
and cache
only.Deletes the emoji. This method requires the cache to fetch the guild ID.
Note: If the emoji was created by the current user, requires either the Create Guild Expressions or the Manage Guild Expressions permission. Otherwise, the Manage Guild Expressions 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(
&mut self,
cache_http: impl CacheHttp,
name: &str,
) -> Result<()>
👎Deprecated: Use Guild(Id)::edit_emoji, this performs a loop over all guilds!Available on crate features model
and cache
only.
pub async fn edit( &mut self, cache_http: impl CacheHttp, 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: If the emoji was created by the current user, requires either the Create Guild Expressions or the Manage Guild Expressions permission. Otherwise, the Manage Guild Expressions permission is required.
§Errors
Returns Error::Http
if the current user lacks permission, or if an invalid name is
given.
Trait Implementations§
Source§impl ArgumentConvert for Emoji
Available on crate features client
and utils
only.
impl ArgumentConvert for Emoji
client
and utils
only.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.
Source§type Err = EmojiParseError
type Err = EmojiParseError
Source§fn convert<'life0, 'async_trait>(
ctx: impl 'async_trait + CacheHttp,
guild_id: Option<GuildId>,
_channel_id: Option<ChannelId>,
s: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn convert<'life0, 'async_trait>(
ctx: impl 'async_trait + CacheHttp,
guild_id: Option<GuildId>,
_channel_id: Option<ChannelId>,
s: &'life0 str,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Err>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
s
as a command parameter of this type.Source§impl<'de> Deserialize<'de> for Emoji
impl<'de> Deserialize<'de> for Emoji
Source§fn 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>,
Source§impl From<Emoji> for ReactionType
impl From<Emoji> for ReactionType
Source§fn from(emoji: Emoji) -> ReactionType
fn from(emoji: Emoji) -> ReactionType
Auto Trait Implementations§
impl Freeze for Emoji
impl RefUnwindSafe for Emoji
impl Send for Emoji
impl Sync for Emoji
impl Unpin for Emoji
impl UnwindSafe for Emoji
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)