Interface KnownCustomEmoji
-
- All Superinterfaces:
CustomEmoji,Deletable,DiscordEntity,Emoji,java.util.Formattable,KnownCustomEmojiAttachableListenerManager,Mentionable,Nameable,Specializable<Emoji>,Updatable<KnownCustomEmoji>,UpdatableFromCache<KnownCustomEmoji>
public interface KnownCustomEmoji extends CustomEmoji, Deletable, 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.java.util.concurrent.CompletableFuture<java.util.Optional<User>>getCreator()Gets the creator of the emoji.default java.util.Optional<KnownCustomEmoji>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.ServergetServer()Gets the server of the emoji.java.util.Optional<java.util.Set<Role>>getWhitelistedRoles()Gets all whitelisted roles.booleanisManaged()Checks if this emoji is managed.default java.util.concurrent.CompletableFuture<java.lang.Void>removeWhitelist()Removes the whitelist of the emoji.booleanrequiresColons()Checks if this emoji must be wrapped in colons.default java.util.concurrent.CompletableFuture<java.lang.Void>updateName(java.lang.String name)Updates the name of the emoji.default java.util.concurrent.CompletableFuture<java.lang.Void>updateWhitelist(java.util.Collection<Role> roles)Updates the whitelist of the emoji.default java.util.concurrent.CompletableFuture<java.lang.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.Deletable
delete, delete, deleteAfter, deleteAfter, deleteAfter, deleteAfter, getApi
-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getApi, 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.
-
createUpdater
default CustomEmojiUpdater createUpdater()
Creates an updater for this emoji.- Returns:
- An updater for this emoji.
-
getWhitelistedRoles
java.util.Optional<java.util.Set<Role>> getWhitelistedRoles()
Gets all whitelisted roles.- Returns:
- 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
java.util.concurrent.CompletableFuture<java.util.Optional<User>> getCreator()
Gets the creator of the emoji.- Returns:
- The user who created the emoji.
-
updateName
default java.util.concurrent.CompletableFuture<java.lang.Void> updateName(java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> updateWhitelist(java.util.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 java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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 java.util.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<KnownCustomEmoji>- Returns:
- The current cached instance.
-
-