Package discord4j.core.object.entity
Class GuildEmoji
java.lang.Object
discord4j.core.object.entity.GuildEmoji
- All Implemented Interfaces:
DiscordObject
,Entity
A Discord guild emoji.
-
Constructor Summary
ConstructorsConstructorDescriptionGuildEmoji
(GatewayDiscordClient gateway, discord4j.discordjson.json.EmojiData data, long guildId) Constructs aGuildEmoji
with an associatedGatewayDiscordClient
and Discord data. -
Method Summary
Modifier and TypeMethodDescriptionasFormat()
Gets the formatted version of this emoji (i.e., to display in the client).delete()
Requests to delete this emoji.Requests to delete this emoji while optionally specifying a reason.discord4j.core.spec.GuildEmojiEditMono
edit()
Requests to edit this guild emoji.edit
(discord4j.core.spec.GuildEmojiEditSpec spec) Requests to edit this guild emoji.edit
(Consumer<? super LegacyGuildEmojiEditSpec> spec) Deprecated.boolean
Returns theGatewayDiscordClient
that created this object.discord4j.discordjson.json.EmojiData
getData()
Gets the data of the emoji.getGuild()
Requests to retrieve the guild this emoji is associated to.getGuild
(EntityRetrievalStrategy retrievalStrategy) Requests to retrieve the guild this emoji is associated to, using the given retrieval strategy.Gets the ID of the guild this emoji is associated to.getId()
Gets the Snowflake that uniquely identifies this entity.getImage()
Gets the image for this guild emoji.Gets the URL for this guild emoji.getName()
Gets the emoji name.Gets the IDs of the roles this emoji is whitelisted to.getRoles()
Requests to retrieve the roles this emoji is whitelisted to.getRoles
(EntityRetrievalStrategy retrievalStrategy) Requests to retrieve the roles this emoji is whitelisted to, using the given retrieval strategy.getUser()
Requests to retrieve the user that created this emoji.int
hashCode()
boolean
Gets whether this emoji is animated.boolean
Gets whether this emoji is available for use.boolean
Gets whether this emoji is managed.boolean
Gets whether this emoji must be wrapped in colons.toString()
-
Constructor Details
-
GuildEmoji
public GuildEmoji(GatewayDiscordClient gateway, discord4j.discordjson.json.EmojiData data, long guildId) Constructs aGuildEmoji
with an associatedGatewayDiscordClient
and Discord data.- Parameters:
gateway
- TheGatewayDiscordClient
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
Description copied from interface:DiscordObject
Returns theGatewayDiscordClient
that created this object. Methods in it are exclusively based on the entity cache orStore
in use. Refer to callinggetClient().rest()
to access aDiscordClient
that is capable of requesting entities directly from the REST API.- Specified by:
getClient
in interfaceDiscordObject
- Returns:
- The
GatewayDiscordClient
associated to this object.
-
getId
Description copied from interface:Entity
Gets 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
Gets the emoji name.- Returns:
- The emoji name.
-
getRoleIds
Gets the IDs of the roles this emoji is whitelisted to.- Returns:
- The IDs of the roles this emoji is whitelisted to.
-
getRoles
Requests to retrieve the roles this emoji is whitelisted to.The order of items emitted by the returned
Flux
is unspecified. UseOrderUtil.orderRoles(Flux)
to consistently order roles. -
getRoles
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. UseOrderUtil.orderRoles(Flux)
to consistently order roles. -
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:
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
Gets the ID of the guild this emoji is associated to.- Returns:
- The ID of the guild this emoji is associated to.
-
getGuild
Requests to retrieve the guild this emoji is associated to. -
getGuild
Requests to retrieve the guild this emoji is associated to, using the given retrieval strategy. -
edit
Deprecated.useedit(GuildEmojiEditSpec)
oredit()
which offer an immutable approach to build specsRequests to edit this guild emoji.- Parameters:
spec
- AConsumer
that provides a "blank"LegacyGuildEmojiEditSpec
to be operated on.- Returns:
- A
Mono
where, 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 thewithXxx
methods of the returnedGuildEmojiEditMono
.- Returns:
- A
GuildEmojiEditMono
where, upon successful completion, emits the editedGuildEmoji
. If an error is received, it is emitted through theGuildEmojiEditMono
.
-
edit
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 editedGuildEmoji
. If an error is received, it is emitted through theMono
.
-
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 theMono
.
-
delete
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 theMono
.
-
getImageUrl
Gets the URL for this guild emoji.- Returns:
- The URL for this guild emoji.
-
getImage
Gets the image for this guild emoji. -
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
-
hashCode
public int hashCode() -
toString
-
edit(GuildEmojiEditSpec)
oredit()
which offer an immutable approach to build specs