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(ServiceMediator serviceMediator, GuildEmojiBean data, long guildId)
Constructs aGuildEmoji
with an associated ServiceMediator and Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
asFormat()
Gets the formatted version of this emoji (i.e., to display in the client).reactor.core.publisher.Mono<Void>
delete()
Requests to delete this emoji.reactor.core.publisher.Mono<Void>
delete(String reason)
Requests to delete this emoji while optionally specifying a reason.reactor.core.publisher.Mono<GuildEmoji>
edit(Consumer<? super GuildEmojiEditSpec> spec)
Requests to edit this guild emoji.boolean
equals(Object obj)
DiscordClient
getClient()
Gets the DiscordClient associated to this object.reactor.core.publisher.Mono<Guild>
getGuild()
Requests to retrieve the guild this emoji is associated to.Snowflake
getGuildId()
Gets the ID of the guild this emoji is associated to.Snowflake
getId()
Gets the Snowflake that uniquely identifies this entity.String
getImageUrl()
Gets the URL for this guild emoji.String
getName()
Gets the emoji name.Set<Snowflake>
getRoleIds()
Gets the IDs of the roles this emoji is whitelisted to.reactor.core.publisher.Flux<Role>
getRoles()
Requests to retrieve the roles this emoji is whitelisted to.reactor.core.publisher.Mono<User>
getUser()
Requests to retrieve the user that created this emoji.int
hashCode()
boolean
isAnimated()
Gets whether this emoji is animated.boolean
isManaged()
Gets whether this emoji is managed.boolean
requiresColons()
Gets whether this emoji must be wrapped in colons.String
toString()
-
-
-
Constructor Detail
-
GuildEmoji
public GuildEmoji(ServiceMediator serviceMediator, GuildEmojiBean data, long guildId)
Constructs aGuildEmoji
with an associated ServiceMediator and Discord data.- Parameters:
serviceMediator
- The ServiceMediator 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 Detail
-
getClient
public DiscordClient getClient()
Description copied from interface:DiscordObject
Gets the DiscordClient associated to this object.- Specified by:
getClient
in interfaceDiscordObject
- Returns:
- The DiscordClient associated to this object.
-
getId
public Snowflake getId()
Description copied from interface:Entity
Gets the Snowflake that uniquely identifies this entity.
-
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 reactor.core.publisher.Flux<Role> getRoles()
Requests to retrieve the roles this emoji is whitelisted to.The returned
Flux
will emit items in order based off their natural position, which is indicated visually in the Discord client. For roles, the "lowest" role will be emitted first.- Returns:
- A
Flux
that continually emits theroles
this emoji is whitelisted for. if an error is received, it is emitted through theFlux
.
-
getUser
public reactor.core.publisher.Mono<User> getUser()
Requests to retrieve the user that created this emoji.- Returns:
- A
Mono
where, upon successful completion, emits theuser
that created this emoji. If an error is received, it is emitted through theMono
.
-
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.
-
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 reactor.core.publisher.Mono<Guild> getGuild()
Requests to retrieve the guild this emoji is associated to.- Returns:
- A
Mono
where, upon successful completion, emits theguild
this emoji is associated to. If an error is received, it is emitted through theMono
.
-
edit
public reactor.core.publisher.Mono<GuildEmoji> edit(Consumer<? super GuildEmojiEditSpec> spec)
Requests to edit this guild emoji.- Parameters:
spec
- AConsumer
that provides a "blank"GuildEmojiEditSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the editedGuildEmoji
. If an error is received, it is emitted through theMono
.
-
delete
public reactor.core.publisher.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 theMono
.
-
delete
public reactor.core.publisher.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 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).
-
-