Class GuildEmoji

java.lang.Object
discord4j.core.object.entity.GuildEmoji
All Implemented Interfaces:
DiscordObject, Entity

public final class GuildEmoji extends Object implements Entity
A Discord guild emoji.

Emoji Resource

  • Constructor Details

    • GuildEmoji

      public GuildEmoji(GatewayDiscordClient gateway, discord4j.discordjson.json.EmojiData data, long guildId)
      Constructs a GuildEmoji with an associated GatewayDiscordClient and Discord data.
      Parameters:
      gateway - The GatewayDiscordClient associated to this object, must be non-null.
      data - The raw data as represented by Discord, must be non-null.
      guildId - The ID of the guild this emoji is associated to.
  • Method Details

    • getClient

      public GatewayDiscordClient getClient()
      Description copied from interface: DiscordObject
      Returns the GatewayDiscordClient that created this object. Methods in it are exclusively based on the entity cache or Store in use. Refer to calling getClient().rest() to access a DiscordClient that is capable of requesting entities directly from the REST API.
      Specified by:
      getClient in interface DiscordObject
      Returns:
      The GatewayDiscordClient associated to this object.
    • getId

      public Snowflake getId()
      Description copied from interface: Entity
      Gets the Snowflake that uniquely identifies this entity.
      Specified by:
      getId in interface Entity
      Returns:
      The Snowflake that uniquely identifies this entity.
    • getData

      public discord4j.discordjson.json.EmojiData getData()
      Gets the data of the emoji.
      Returns:
      The data of the emoji.
    • getName

      public String getName()
      Gets the emoji name.
      Returns:
      The emoji name.
    • getRoleIds

      public Set<Snowflake> getRoleIds()
      Gets the IDs of the roles this emoji is whitelisted to.
      Returns:
      The IDs of the roles this emoji is whitelisted to.
    • getRoles

      public Flux<Role> getRoles()
      Requests to retrieve the roles this emoji is whitelisted to.

      The order of items emitted by the returned Flux is unspecified. Use OrderUtil.orderRoles(Flux) to consistently order roles.

      Returns:
      A Flux that continually emits the roles this emoji is whitelisted for. if an error is received, it is emitted through the Flux.
    • getRoles

      public Flux<Role> getRoles(EntityRetrievalStrategy retrievalStrategy)
      Requests to retrieve the roles this emoji is whitelisted to, using the given retrieval strategy.

      The order of items emitted by the returned Flux is unspecified. Use OrderUtil.orderRoles(Flux) to consistently order roles.

      Parameters:
      retrievalStrategy - the strategy to use to get the roles
      Returns:
      A Flux that continually emits the roles this emoji is whitelisted for. if an error is received, it is emitted through the Flux.
    • getUser

      public Mono<User> getUser()
      Requests to retrieve the user that created this emoji. This method will always hit the REST API.
      Returns:
      A Mono where, upon successful completion, emits the user that created this emoji. If an error is received, it is emitted through the Mono.
    • requiresColons

      public boolean requiresColons()
      Gets whether this emoji must be wrapped in colons.
      Returns:
      true if this emoji must be wrapped in colons, false otherwise.
    • isManaged

      public boolean isManaged()
      Gets whether this emoji is managed.
      Returns:
      true if this emoji is managed, false otherwise.
    • isAnimated

      public boolean isAnimated()
      Gets whether this emoji is animated.
      Returns:
      true if this emoji is animated, false otherwise.
    • isAvailable

      public boolean isAvailable()
      Gets whether this emoji is available for use.
      Returns:
      true if this emoji is available, false otherwise (due to loss of Server Boosts for example).
    • getGuildId

      public Snowflake getGuildId()
      Gets the ID of the guild this emoji is associated to.
      Returns:
      The ID of the guild this emoji is associated to.
    • getGuild

      public Mono<Guild> getGuild()
      Requests to retrieve the guild this emoji is associated to.
      Returns:
      A Mono where, upon successful completion, emits the guild this emoji is associated to. If an error is received, it is emitted through the Mono.
    • getGuild

      public Mono<Guild> getGuild(EntityRetrievalStrategy retrievalStrategy)
      Requests to retrieve the guild this emoji is associated to, using the given retrieval strategy.
      Parameters:
      retrievalStrategy - the strategy to use to get the guild
      Returns:
      A Mono where, upon successful completion, emits the guild this emoji is associated to. If an error is received, it is emitted through the Mono.
    • edit

      Deprecated.
      use edit(GuildEmojiEditSpec) or edit() which offer an immutable approach to build specs
      Requests to edit this guild emoji.
      Parameters:
      spec - A Consumer that provides a "blank" LegacyGuildEmojiEditSpec to be operated on.
      Returns:
      A Mono where, upon successful completion, emits the edited GuildEmoji. If an error is received, it is emitted through the Mono.
    • edit

      public discord4j.core.spec.GuildEmojiEditMono edit()
      Requests to edit this guild emoji. Properties specifying how to edit this emoji can be set via the withXxx methods of the returned GuildEmojiEditMono.
      Returns:
      A GuildEmojiEditMono where, upon successful completion, emits the edited GuildEmoji. If an error is received, it is emitted through the GuildEmojiEditMono.
    • edit

      public Mono<GuildEmoji> edit(discord4j.core.spec.GuildEmojiEditSpec spec)
      Requests to edit this guild emoji.
      Parameters:
      spec - an immutable object that specifies how to edit this emoji
      Returns:
      A Mono where, upon successful completion, emits the edited GuildEmoji. If an error is received, it is emitted through the Mono.
    • delete

      public Mono<Void> delete()
      Requests to delete this emoji.
      Returns:
      A Mono where, upon successful completion, emits nothing; indicating the emoji has been deleted. If an error is received, it is emitted through the Mono.
    • delete

      public Mono<Void> delete(@Nullable String reason)
      Requests to delete this emoji while optionally specifying a reason.
      Parameters:
      reason - The reason, if present.
      Returns:
      A Mono where, upon successful completion, emits nothing; indicating the emoji has been deleted. If an error is received, it is emitted through the Mono.
    • getImageUrl

      public String getImageUrl()
      Gets the URL for this guild emoji.
      Returns:
      The URL for this guild emoji.
    • getImage

      public Mono<Image> getImage()
      Gets the image for this guild emoji.
      Returns:
      A Mono where, upon successful completion, emits the image of the emoji. If an error is received, it is emitted through the Mono.
    • asFormat

      public String asFormat()
      Gets the formatted version of this emoji (i.e., to display in the client).
      Returns:
      The formatted version of this emoji (i.e., to display in the client).
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object