Interface RichCustomEmoji

All Superinterfaces:
CustomEmoji, Emoji, Formattable, IMentionable, ISnowflake, SerializableData

public interface RichCustomEmoji extends CustomEmoji
Represents a Custom Emoji.

This does not represent unicode emojis like they are used in the official client! The format :smiley: is a client-side alias which is replaced by the unicode emoji, not a custom emoji.

See Also:
  • Method Details

    • getGuild

      @Nonnull Guild getGuild()
      The Guild this emoji is attached to.
      Returns:
      Guild of this emoji
    • getRoles

      @Nonnull @Unmodifiable List<Role> getRoles()
      Roles this emoji is active for.
      Learn More
      Returns:
      An immutable list of the roles this emoji is active for (all roles if empty)
    • isManaged

      boolean isManaged()
      Whether this emoji is managed. A managed emoji is controlled by Discord, not the Guild administrator, typical via a service like BTTV in conjunction with Twitch.
      Learn More
      Returns:
      True, if this emoji is managed
    • isAvailable

      boolean isAvailable()
      Whether this emoji is available. When an emoji becomes unavailable, it cannot be used in messages. An emoji becomes unavailable when the BoostTier of the guild drops such that the maximum allowed emojis is lower than the total amount of emojis added to the guild.

      If an emoji is added to the guild when the boost tier allows for more than 50 normal and 50 animated emojis (BoostTier is at least TIER_1) and the emoji is at least the 51st one added, then the emoji becomes unavailable when the BoostTier drops below a level that allows those emojis to be used.
      emojis that where added as part of a lower BoostTier (i.e. the 51st emoji on BoostTier 2) will remain available, as long as the BoostTier stays above the required level.

      Returns:
      True, if this emoji is available
    • getJDA

      @Nonnull JDA getJDA()
      The JDA instance of this emoji
      Returns:
      The JDA instance of this emoji
    • getOwner

      @Nullable User getOwner()
      The user who created this emoji

      This is only available for manually retrieved emojis from Guild.retrieveEmojis() and Guild.retrieveEmojiById(long).
      Requires Permission.MANAGE_GUILD_EXPRESSIONS.

      Returns:
      The user who created this emoji, or null if not provided
      Throws:
      IllegalStateException - If this emoji does not have user information
      See Also:
    • retrieveOwner

      Retrieves the owner of this emoji.
      If getOwner() is present, this will directly return the owner in a completed RestAction without making a request. The user information might be outdated, you can use action.useCache(false) to force an update.
      Returns:
      RestAction - Type: User
      Throws:
      InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_GUILD_EXPRESSIONS in this guild
      See Also:
    • delete

      Deletes this emoji.

      Possible ErrorResponses include:

      Returns:
      AuditableRestAction The RestAction to delete this emoji.
      Throws:
      UnsupportedOperationException - If this emoji is managed by discord (isManaged())
      InsufficientPermissionException - if the Permission MANAGE_GUILD_EXPRESSIONS is not given
    • getManager

      The Manager for this emoji, used to modify properties of the emoji like name and role restrictions.
      You modify multiple fields in one request by chaining setters before calling RestAction.queue().
      Returns:
      The CustomEmojiManager for this emoji
      Throws:
      InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_GUILD_EXPRESSIONS
    • canInteract

      default boolean canInteract(Member issuer)
      Whether the specified Member can interact with this emoji
      Parameters:
      issuer - The User to test
      Returns:
      True, if the provided Member can use this emoji
    • canInteract

      default boolean canInteract(User issuer, MessageChannel channel)
      Whether the specified User can interact with this emoji within the provided MessageChannel
      Same logic as canInteract(issuer, channel, true)!
      Parameters:
      issuer - The User to test
      channel - The MessageChannel to test
      Returns:
      True, if the provided Member can use this emoji
    • canInteract

      default boolean canInteract(User issuer, MessageChannel channel, boolean botOverride)
      Whether the specified User can interact with this emoji within the provided MessageChannel
      Special override to exclude elevated bot permissions in case of (for instance) reacting to messages.
      Parameters:
      issuer - The User to test
      channel - The MessageChannel to test
      botOverride - Whether bots can use non-managed emojis in other guilds
      Returns:
      True, if the provided Member can use this emoji