Interface KnownCustomEmoji
-
- All Superinterfaces:
CustomEmoji,DiscordEntity,Emoji,Formattable,KnownCustomEmojiAttachableListenerManager,Mentionable,Nameable,Specializable<Emoji>,Updatable<Emoji>,UpdatableFromCache<Emoji>
public interface KnownCustomEmoji extends CustomEmoji, UpdatableFromCache<KnownCustomEmoji>, KnownCustomEmojiAttachableListenerManager
This class represents a known custom emoji.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default CustomEmojiUpdatercreateUpdater()Creates an updater for this emoji.default CompletableFuture<Void>delete()Deletes the emoji.CompletableFuture<Void>delete(String reason)Deletes the emoji.CompletableFuture<Optional<User>>getCreator()Gets the creator of the emoji.default Optional<KnownCustomEmoji>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.ServergetServer()Gets the server of the emoji.Optional<Collection<Role>>getWhitelistedRoles()Gets a list with all whitelisted roles.booleanisManaged()Checks if this emoji is managed.default CompletableFuture<Void>removeWhitelist()Removes the whitelist of the emoji.booleanrequiresColons()Checks if this emoji must be wrapped in colons.default CompletableFuture<Void>updateName(String name)Updates the name of the emoji.default CompletableFuture<Void>updateWhitelist(Collection<Role> roles)Updates the whitelist of the emoji.default CompletableFuture<Void>updateWhitelist(Role... roles)Updates the whitelist of the emoji.-
Methods inherited from interface org.javacord.api.entity.emoji.CustomEmoji
asCustomEmoji, asKnownCustomEmoji, asUnicodeEmoji, getImage, getMentionTag, getReactionTag
-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getApi, getCreationTimestamp, getCreationTimestamp, getId, getIdAsString
-
Methods inherited from interface org.javacord.api.entity.emoji.Emoji
equalsEmoji, equalsEmoji, isAnimated, isCustomEmoji, isKnownCustomEmoji, isUnicodeEmoji
-
Methods inherited from interface org.javacord.api.listener.server.emoji.KnownCustomEmojiAttachableListenerManager
addKnownCustomEmojiAttachableListener, addKnownCustomEmojiChangeNameListener, addKnownCustomEmojiChangeWhitelistedRolesListener, addKnownCustomEmojiDeleteListener, getKnownCustomEmojiAttachableListeners, getKnownCustomEmojiChangeNameListeners, getKnownCustomEmojiChangeWhitelistedRolesListeners, getKnownCustomEmojiDeleteListeners, removeKnownCustomEmojiAttachableListener, removeListener
-
Methods inherited from interface org.javacord.api.util.Specializable
as
-
Methods inherited from interface org.javacord.api.entity.UpdatableFromCache
getLatestInstance
-
-
-
-
Method Detail
-
getServer
Server getServer()
Gets the server of the emoji.- Returns:
- The server of the emoji.
-
delete
default CompletableFuture<Void> delete()
Deletes the emoji.- Returns:
- A future to tell us if the deletion was successful.
-
delete
CompletableFuture<Void> delete(String reason)
Deletes the emoji.- Parameters:
reason- The reason for the deletion.- Returns:
- A future to tell us if the deletion was successful.
-
createUpdater
default CustomEmojiUpdater createUpdater()
Creates an updater for this emoji.- Returns:
- An updater for this emoji.
-
getWhitelistedRoles
Optional<Collection<Role>> getWhitelistedRoles()
Gets a list with all whitelisted roles.- Returns:
- A list with all whitelisted roles.
-
requiresColons
boolean requiresColons()
Checks if this emoji must be wrapped in colons.- Returns:
- Whether this emoji must be wrapped in colons or not.
-
isManaged
boolean isManaged()
Checks if this emoji is managed.- Returns:
- Whether this emoji is managed or not.
-
getCreator
CompletableFuture<Optional<User>> getCreator()
Gets the creator of the emoji.- Returns:
- The user who created the emoji.
-
updateName
default CompletableFuture<Void> updateName(String name)
Updates the name of the emoji.If you want to update several settings at once, it's recommended to use the
CustomEmojiUpdaterfromcreateUpdater()which provides a better performance!- Parameters:
name- The new name of the emoji.- Returns:
- A future to check if the update was successful.
-
updateWhitelist
default CompletableFuture<Void> updateWhitelist(Collection<Role> roles)
Updates the whitelist of the emoji. To be active, the whitelist must at least contain one role, otherwise everyone can use the emoji!If you want to update several settings at once, it's recommended to use the
CustomEmojiUpdaterfromcreateUpdater()which provides a better performance!- Parameters:
roles- The new whitelist.- Returns:
- A future to check if the update was successful.
-
updateWhitelist
default CompletableFuture<Void> updateWhitelist(Role... roles)
Updates the whitelist of the emoji. To be active, the whitelist must at least contain one role, otherwise everyone can use the emoji!If you want to update several settings at once, it's recommended to use the
CustomEmojiUpdaterfromcreateUpdater()which provides a better performance!- Parameters:
roles- The new whitelist.- Returns:
- A future to check if the update was successful.
-
removeWhitelist
default CompletableFuture<Void> removeWhitelist()
Removes the whitelist of the emoji.If you want to update several settings at once, it's recommended to use the
CustomEmojiUpdaterfromcreateUpdater()which provides a better performance!- Returns:
- A future to check if the update was successful.
-
getCurrentCachedInstance
default Optional<KnownCustomEmoji> getCurrentCachedInstance()
Description copied from interface:UpdatableFromCacheGets an updated instance of this entity from the cache. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache, that gets updates from Discord, in case this one was invalidated.This method returns the currently cached entity, or an empty
Optionalif the entity is not cached any longer, for example because it was deleted or the message was thrown out of the cache.- Specified by:
getCurrentCachedInstancein interfaceCustomEmoji- Specified by:
getCurrentCachedInstancein interfaceUpdatableFromCache<Emoji>- Returns:
- The current cached instance.
-
-