pub struct EmojiManager<'a, B: Backend> { /* private fields */ }Expand description
The custom emojis of one guild. Returned by Context::emojis.
discord.js counterpart: GuildEmojiManager (guild.emojis).
Implementations§
Source§impl<'a, B: Backend> EmojiManager<'a, B>
impl<'a, B: Backend> EmojiManager<'a, B>
Sourcepub const fn guild_id(self) -> GuildId
pub const fn guild_id(self) -> GuildId
The guild these emojis belong to.
discord.js counterpart: GuildEmojiManager#guild.
Sourcepub fn cache(self) -> Option<GuildView<'a, EmojiId, Emoji, B>>
pub fn cache(self) -> Option<GuildView<'a, EmojiId, Emoji, B>>
The cached emojis of the guild, if the client has a cache.
discord.js counterpart: GuildEmojiManager#cache.
Sourcepub fn fetch(
self,
emoji_id: EmojiId,
) -> Fetch<Arc<Emoji>, impl Future<Output = Result<Arc<Emoji>, Error>> + Send + 'a>
pub fn fetch( self, emoji_id: EmojiId, ) -> Fetch<Arc<Emoji>, impl Future<Output = Result<Arc<Emoji>, Error>> + Send + 'a>
An emoji: the cached one, or Get Guild Emoji, whose result is cached.
discord.js counterpart: GuildEmojiManager#fetch(id).
§Errors
Returns the REST error if Discord was asked and the request failed.
Sourcepub async fn list(self) -> Result<Collection<EmojiId, Arc<Emoji>>, Error>
pub async fn list(self) -> Result<Collection<EmojiId, Arc<Emoji>>, Error>
Every custom emoji of the guild (List Guild Emojis); the emojis are cached.
discord.js counterpart: GuildEmojiManager#fetch().
§Errors
Returns the REST error if the request failed.
Sourcepub async fn create(
self,
body: &CreateGuildEmoji,
reason: Option<&str>,
) -> Result<Arc<Emoji>, Error>
pub async fn create( self, body: &CreateGuildEmoji, reason: Option<&str>, ) -> Result<Arc<Emoji>, Error>
Uploads an emoji (Create Guild Emoji); it is cached.
discord.js counterpart: GuildEmojiManager#create.
§Errors
Returns the REST error if the request failed (it needs CREATE_EXPRESSIONS; the
image must be at most 256 KiB).
Sourcepub async fn edit(
self,
emoji_id: EmojiId,
body: &ModifyGuildEmoji,
reason: Option<&str>,
) -> Result<Arc<Emoji>, Error>
pub async fn edit( self, emoji_id: EmojiId, body: &ModifyGuildEmoji, reason: Option<&str>, ) -> Result<Arc<Emoji>, Error>
Renames an emoji or changes the roles allowed to use it (Modify Guild Emoji); the result is cached.
discord.js counterpart: GuildEmojiManager#edit / GuildEmoji#edit.
§Errors
Returns the REST error if the request failed.
Sourcepub async fn delete(
self,
emoji_id: EmojiId,
reason: Option<&str>,
) -> Result<(), Error>
pub async fn delete( self, emoji_id: EmojiId, reason: Option<&str>, ) -> Result<(), Error>
Deletes an emoji (Delete Guild Emoji). The
cache is updated by the GUILD_EMOJIS_UPDATE event that follows (D-236).
discord.js counterpart: GuildEmojiManager#delete / GuildEmoji#delete.
§Errors
Returns the REST error if the request failed.
Trait Implementations§
Source§impl<B: Backend> Clone for EmojiManager<'_, B>
impl<B: Backend> Clone for EmojiManager<'_, B>
impl<B: Backend> Copy for EmojiManager<'_, B>
Auto Trait Implementations§
impl<'a, B> !RefUnwindSafe for EmojiManager<'a, B>
impl<'a, B> !UnwindSafe for EmojiManager<'a, B>
impl<'a, B> Freeze for EmojiManager<'a, B>
impl<'a, B> Send for EmojiManager<'a, B>
impl<'a, B> Sync for EmojiManager<'a, B>
impl<'a, B> Unpin for EmojiManager<'a, B>
impl<'a, B> UnsafeUnpin for EmojiManager<'a, B>
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more