public final class Category extends Object
Channel.Type
Constructor and Description |
---|
Category(GatewayDiscordClient gateway,
discord4j.discordjson.json.ChannelData data)
Constructs an
Category with an associated ServiceMediator and Discord data. |
Modifier and Type | Method and Description |
---|---|
Mono<Void> |
addMemberOverwrite(Snowflake memberId,
PermissionOverwrite overwrite,
String reason)
Requests to add a permission overwrite for the given member while optionally specifying a reason.
|
Mono<Void> |
addRoleOverwrite(Snowflake roleId,
PermissionOverwrite overwrite,
String reason)
Requests to add a permission overwrite for the given role while optionally specifying a reason.
|
Mono<Void> |
delete(String reason)
Requests to delete this channel while optionally specifying a reason.
|
Mono<Category> |
edit(Consumer<? super CategoryEditSpec> spec)
Requests to edit this category.
|
boolean |
equals(Object obj) |
Flux<CategorizableChannel> |
getChannels()
Requests to retrieve the channels residing in this category.
|
Flux<CategorizableChannel> |
getChannels(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the channels residing in this category, using the given retrieval strategy.
|
GatewayDiscordClient |
getClient()
Returns the
GatewayDiscordClient that created this object. |
Mono<PermissionSet> |
getEffectivePermissions(Snowflake memberId)
Gets the permissions for the given member, taking into account permission overwrites in this channel.
|
Mono<Guild> |
getGuild()
Requests to retrieve the guild this channel is associated to.
|
Mono<Guild> |
getGuild(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the guild this channel is associated to, using the given retrieval strategy.
|
Snowflake |
getGuildId()
Gets the ID of the guild this channel is associated to.
|
Snowflake |
getId()
Gets the Snowflake that uniquely identifies this entity.
|
String |
getName()
Gets the name of the channel.
|
Optional<ExtendedPermissionOverwrite> |
getOverwriteForMember(Snowflake memberId)
Gets the permission overwrite targeting the given member.
|
Optional<ExtendedPermissionOverwrite> |
getOverwriteForRole(Snowflake roleId)
Gets the permission overwrite targeting the given role.
|
Set<ExtendedPermissionOverwrite> |
getPermissionOverwrites()
Gets the permission overwrites for this channel.
|
Mono<Integer> |
getPosition()
Requests to retrieve the position of the channel relative to other channels in the guild.
|
int |
getRawPosition()
Gets the raw position of the channel as exposed by Discord.
|
RestChannel |
getRestChannel()
Return a
RestChannel handle to execute REST API operations on this entity. |
Channel.Type |
getType()
Gets the type of channel.
|
int |
hashCode() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addMemberOverwrite, addRoleOverwrite
delete, delete, getMention, getRestChannel, getType
getClient
public Category(GatewayDiscordClient gateway, discord4j.discordjson.json.ChannelData data)
Category
with an associated ServiceMediator and Discord data.gateway
- The GatewayDiscordClient
associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.public Flux<CategorizableChannel> getChannels()
public Flux<CategorizableChannel> getChannels(EntityRetrievalStrategy retrievalStrategy)
public Mono<Category> edit(Consumer<? super CategoryEditSpec> spec)
spec
- A Consumer
that provides a "blank" CategoryEditSpec
to be operated on.Mono
where, upon successful completion, emits the edited Category
. If an error is
received, it is emitted through the Mono
.public String toString()
public final Snowflake getGuildId()
GuildChannel
getGuildId
in interface GuildChannel
public final Mono<Guild> getGuild()
GuildChannel
getGuild
in interface GuildChannel
Mono
where, upon successful completion, emits the guild
this channel is
associated to. If an error is received, it is emitted through the Mono
.public Mono<Guild> getGuild(EntityRetrievalStrategy retrievalStrategy)
GuildChannel
getGuild
in interface GuildChannel
retrievalStrategy
- the strategy to use to get the guildMono
where, upon successful completion, emits the guild
this channel is
associated to. If an error is received, it is emitted through the Mono
.public final Set<ExtendedPermissionOverwrite> getPermissionOverwrites()
GuildChannel
getPermissionOverwrites
in interface GuildChannel
public Optional<ExtendedPermissionOverwrite> getOverwriteForMember(Snowflake memberId)
GuildChannel
getOverwriteForMember
in interface GuildChannel
memberId
- The ID of the member to get the overwrite for.public Optional<ExtendedPermissionOverwrite> getOverwriteForRole(Snowflake roleId)
GuildChannel
getOverwriteForRole
in interface GuildChannel
roleId
- The ID of the role to get the overwrite for.public Mono<PermissionSet> getEffectivePermissions(Snowflake memberId)
GuildChannel
getEffectivePermissions
in interface GuildChannel
memberId
- The ID of the member to get permissions for.public final String getName()
GuildChannel
getName
in interface GuildChannel
public int getRawPosition()
GuildChannel
getRawPosition
in interface GuildChannel
public final Mono<Integer> getPosition()
GuildChannel
This is determined by the index of this channel in the sorted
list of channels of the guild.
Warning: Because this method must sort the guild channels, it is inefficient to make repeated invocations for the same set of channels (meaning that channels haven't been added or removed). For example, instead of writing:
guild.getChannels()
.flatMap(c -> c.getPosition().map(pos -> c.getName() + " : " + pos))
It would be much more efficient to write:
guild.getChannels()
.transform(OrderUtil::orderGuildChannels)
.index((pos, c) -> c.getName() + " : " + pos)
getPosition
in interface GuildChannel
Mono
where, upon successful completion, emits the position of the channel. If an error is
received, it is emitted through the Mono
.public Mono<Void> addMemberOverwrite(Snowflake memberId, PermissionOverwrite overwrite, @Nullable String reason)
GuildChannel
addMemberOverwrite
in interface GuildChannel
memberId
- The ID of the member to add the overwrite for.overwrite
- The overwrite to add.reason
- The reason, if present.Mono
where, upon successful completion, emits nothing; If an error is received, it is emitted
through the Mono
.public Mono<Void> addRoleOverwrite(Snowflake roleId, PermissionOverwrite overwrite, @Nullable String reason)
GuildChannel
addRoleOverwrite
in interface GuildChannel
roleId
- The ID of the role to add the overwrite for.overwrite
- The overwrite to add.reason
- The reason, if present.Mono
where, upon successful completion, emits nothing; If an error is received, it is emitted
through the Mono
.public final GatewayDiscordClient getClient()
DiscordObject
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.getClient
in interface DiscordObject
GatewayDiscordClient
associated to this object.public final Snowflake getId()
Entity
public RestChannel getRestChannel()
Channel
RestChannel
handle to execute REST API operations on this entity.getRestChannel
in interface Channel
public final Channel.Type getType()
Channel
public final Mono<Void> delete(@Nullable String reason)
Channel