Package discord4j.core.object.entity
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.
-
-
Constructor Summary
Constructors Constructor Description GuildEmoji(GatewayDiscordClient gateway, discord4j.discordjson.json.EmojiData data, long guildId)Constructs aGuildEmojiwith an associatedGatewayDiscordClientand Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description StringasFormat()Gets the formatted version of this emoji (i.e., to display in the client).Mono<Void>delete()Requests to delete this emoji.Mono<Void>delete(String reason)Requests to delete this emoji while optionally specifying a reason.discord4j.core.spec.GuildEmojiEditMonoedit()Requests to edit this guild emoji.Mono<GuildEmoji>edit(discord4j.core.spec.GuildEmojiEditSpec spec)Requests to edit this guild emoji.Mono<GuildEmoji>edit(Consumer<? super LegacyGuildEmojiEditSpec> spec)Deprecated.useedit(GuildEmojiEditSpec)oredit()which offer an immutable approach to build specsbooleanequals(Object obj)GatewayDiscordClientgetClient()Returns theGatewayDiscordClientthat created this object.discord4j.discordjson.json.EmojiDatagetData()Gets the data of the emoji.Mono<Guild>getGuild()Requests to retrieve the guild this emoji is associated to.Mono<Guild>getGuild(EntityRetrievalStrategy retrievalStrategy)Requests to retrieve the guild this emoji is associated to, using the given retrieval strategy.SnowflakegetGuildId()Gets the ID of the guild this emoji is associated to.SnowflakegetId()Gets the Snowflake that uniquely identifies this entity.Mono<Image>getImage()Gets the image for this guild emoji.StringgetImageUrl()Gets the URL for this guild emoji.StringgetName()Gets the emoji name.Set<Snowflake>getRoleIds()Gets the IDs of the roles this emoji is whitelisted to.Flux<Role>getRoles()Requests to retrieve the roles this emoji is whitelisted to.Flux<Role>getRoles(EntityRetrievalStrategy retrievalStrategy)Requests to retrieve the roles this emoji is whitelisted to, using the given retrieval strategy.Mono<User>getUser()Requests to retrieve the user that created this emoji.inthashCode()booleanisAnimated()Gets whether this emoji is animated.booleanisAvailable()Gets whether this emoji is available for use.booleanisManaged()Gets whether this emoji is managed.booleanrequiresColons()Gets whether this emoji must be wrapped in colons.StringtoString()
-
-
-
Constructor Detail
-
GuildEmoji
public GuildEmoji(GatewayDiscordClient gateway, discord4j.discordjson.json.EmojiData data, long guildId)
Constructs aGuildEmojiwith an associatedGatewayDiscordClientand Discord data.- Parameters:
gateway- TheGatewayDiscordClientassociated 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 Detail
-
getClient
public GatewayDiscordClient getClient()
Description copied from interface:DiscordObjectReturns theGatewayDiscordClientthat created this object. Methods in it are exclusively based on the entity cache orStorein use. Refer to callinggetClient().rest()to access aDiscordClientthat is capable of requesting entities directly from the REST API.- Specified by:
getClientin interfaceDiscordObject- Returns:
- The
GatewayDiscordClientassociated to this object.
-
getId
public Snowflake getId()
Description copied from interface:EntityGets 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
Fluxis unspecified. UseOrderUtil.orderRoles(Flux)to consistently order roles.
-
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
Fluxis unspecified. UseOrderUtil.orderRoles(Flux)to consistently order roles.
-
getUser
public Mono<User> getUser()
Requests to retrieve the user that created this emoji. This method will always hit the REST API.
-
requiresColons
public boolean requiresColons()
Gets whether this emoji must be wrapped in colons.- Returns:
trueif this emoji must be wrapped in colons,falseotherwise.
-
isManaged
public boolean isManaged()
Gets whether this emoji is managed.- Returns:
trueif this emoji is managed,falseotherwise.
-
isAnimated
public boolean isAnimated()
Gets whether this emoji is animated.- Returns:
trueif this emoji is animated,falseotherwise.
-
isAvailable
public boolean isAvailable()
Gets whether this emoji is available for use.- Returns:
trueif this emoji is available,falseotherwise (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(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the guild this emoji is associated to, using the given retrieval strategy.
-
edit
@Deprecated public Mono<GuildEmoji> edit(Consumer<? super LegacyGuildEmojiEditSpec> spec)
Deprecated.useedit(GuildEmojiEditSpec)oredit()which offer an immutable approach to build specsRequests to edit this guild emoji.- Parameters:
spec- AConsumerthat provides a "blank"LegacyGuildEmojiEditSpecto be operated on.- Returns:
- A
Monowhere, upon successful completion, emits the editedGuildEmoji. If an error is received, it is emitted through theMono.
-
edit
public discord4j.core.spec.GuildEmojiEditMono edit()
Requests to edit this guild emoji. Properties specifying how to edit this emoji can be set via thewithXxxmethods of the returnedGuildEmojiEditMono.- Returns:
- A
GuildEmojiEditMonowhere, upon successful completion, emits the editedGuildEmoji. If an error is received, it is emitted through theGuildEmojiEditMono.
-
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
Monowhere, upon successful completion, emits the editedGuildEmoji. If an error is received, it is emitted through theMono.
-
delete
public Mono<Void> delete()
Requests to delete this emoji.- Returns:
- A
Monowhere, upon successful completion, emits nothing; indicating the emoji has been deleted. If an error is received, it is emitted through theMono.
-
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
Monowhere, upon successful completion, emits nothing; indicating the emoji has been deleted. If an error is received, it is emitted through theMono.
-
getImageUrl
public String getImageUrl()
Gets the URL for this guild emoji.- Returns:
- The URL for this guild emoji.
-
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).
-
-