Interface Emote
- All Superinterfaces:
Formattable
,IMentionable
,ISnowflake
- All Known Subinterfaces:
ListedEmote
You can retrieve the creator of an emote by using Guild.retrieveEmote(Emote)
followed
by using ListedEmote.getUser()
.
This does not represent unicode emojis like they are used in the official client! (:smiley: is not a custom emoji)
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canInteract
(Member issuer) Whether the specified Member can interact with this Emotedefault boolean
canInteract
(User issuer, MessageChannel channel) Whether the specified User can interact with this Emote within the provided MessageChannel
Same logic ascanInteract(issuer, channel, true)
!default boolean
canInteract
(User issuer, MessageChannel channel, boolean botOverride) Whether the specified User can interact with this Emote within the provided MessageChannel
Special override to exclude elevated bot permissions in case of (for instance) reacting to messages.boolean
Whether this Emote has an attached roles list.delete()
Deletes this Emote.default String
getGuild()
TheGuild
this emote is attached to.default String
A String representation of the URL which leads to image displayed within the official Discord™ client when this Emote is usedgetJDA()
TheJDA
instance of this EmoteTheManager
for this emote, used to modify properties of the emote like name and role restrictions.getName()
The name of this emote.getRoles()
Roles this emote is active for.boolean
Whether or not this Emote is animated.boolean
Whether this emote is available.boolean
Whether this emote is managed.Methods inherited from interface net.dv8tion.jda.api.entities.IMentionable
formatTo
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Field Details
-
ICON_URL
Template forgetImageUrl()
- See Also:
-
-
Method Details
-
getGuild
TheGuild
this emote is attached to.This is null if the emote is created from a message
- Returns:
- Guild of this emote or null if it is created from a message
-
getRoles
Roles this emote is active for.
Learn More- Returns:
- An immutable list of the roles this emote is active for (all roles if empty)
- Throws:
IllegalStateException
- If this Emote does not have attached roles according tocanProvideRoles()
- See Also:
-
canProvideRoles
boolean canProvideRoles()Whether this Emote has an attached roles list. This might not be the case when the emote is retrieved through special cases like audit-logs.If this is not true then
getRoles()
will throwIllegalStateException
.- Returns:
- True, if this emote has an attached roles list
-
getName
The name of this emote.
Does not include colons.- Returns:
- String representation of this emote's name
-
isManaged
boolean isManaged()Whether this emote is managed. A managed Emote is controlled by Discord, not the Guild administrator, typical via a service like BTTV in conjunction with Twitch.
Learn More- Returns:
- True, if this emote is managed
-
isAvailable
boolean isAvailable()Whether this emote is available. When an emote becomes unavailable, it cannot be used in messages. An emote becomes unavailable when theBoostTier
of the guild drops such that the maximum allowed emotes is lower than the total amount of emotes added to the guild.If an emote is added to the guild when the boost tier allows for more than 50 normal and 50 animated emotes (BoostTier is at least
TIER_1
) and the emote is at least the 51st one added, then the emote becomes unavailable when the BoostTier drops below a level that allows those emotes to be used.
Emotes that where added as part of a lower BoostTier (i.e. the 51st emote on BoostTier 2) will remain available, as long as the BoostTier stays above the required level.- Returns:
- True, if this emote is available
- Since:
- 4.2.1
-
getJDA
TheJDA
instance of this Emote- Returns:
- The JDA instance of this Emote
-
delete
Deletes this Emote.Possible ErrorResponses include:
UNKNOWN_EMOTE
If this Emote was already removedUNKNOWN_GUILD
If the Guild of this Emote was deletedMISSING_ACCESS
If we were removed from the Guild
- Returns:
AuditableRestAction
The RestAction to delete this Emote.- Throws:
UnsupportedOperationException
- If this emote is managed by discord (isManaged()
)InsufficientPermissionException
- if the PermissionMANAGE_EMOTES_AND_STICKERS
is not given
-
getManager
TheManager
for this emote, used to modify properties of the emote like name and role restrictions.
You modify multiple fields in one request by chaining setters before callingRestAction.queue()
.This is a lazy idempotent getter. The manager is retained after the first call. This getter is not thread-safe and would require guards by the user.
- Returns:
- The EmoteManager for this Emote
- Throws:
IllegalStateException
- if this emote is created from a message or the bot does not have access to the emoteInsufficientPermissionException
- If the currently logged in account does not havePermission.MANAGE_EMOTES_AND_STICKERS
-
isAnimated
boolean isAnimated()Whether or not this Emote is animated.Animated Emotes are available to Discord Nitro users as well as Bot accounts.
- Returns:
- Whether the Emote is animated or not.
-
getImageUrl
A String representation of the URL which leads to image displayed within the official Discord™ client when this Emote is used- Returns:
- Discord CDN link to the Emote's image
-
getAsMention
Usable representation of this Emote (used to display in the client just like mentions with a specific format)
Emotes are used with the format<:
getName()
:getId()
>- Specified by:
getAsMention
in interfaceIMentionable
- Returns:
- A usable String representation for this Emote
- See Also:
-
canInteract
Whether the specified Member can interact with this Emote- Parameters:
issuer
- The User to test- Returns:
- True, if the provided Member can use this Emote
-
canInteract
Whether the specified User can interact with this Emote within the provided MessageChannel
Same logic ascanInteract(issuer, channel, true)
!- Parameters:
issuer
- The User to testchannel
- The MessageChannel to test- Returns:
- True, if the provided Member can use this Emote
-
canInteract
Whether the specified User can interact with this Emote within the provided MessageChannel
Special override to exclude elevated bot permissions in case of (for instance) reacting to messages.- Parameters:
issuer
- The User to testchannel
- The MessageChannel to testbotOverride
- Whether bots can use non-managed emotes in other guilds- Returns:
- True, if the provided Member can use this Emote
-