Class StoreChannel
- java.lang.Object
-
- discord4j.core.object.entity.channel.StoreChannel
-
- All Implemented Interfaces:
DiscordObject
,CategorizableChannel
,Channel
,GuildChannel
,TopLevelGuildChannel
,Entity
public final class StoreChannel extends Object
A Discord store channel.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface discord4j.core.object.entity.channel.Channel
Channel.Type
-
-
Constructor Summary
Constructors Constructor Description StoreChannel(GatewayDiscordClient gateway, discord4j.discordjson.json.ChannelData data)
Constructs anStoreChannel
with an associatedGatewayDiscordClient
and Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method 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<ExtendedInvite>
createInvite(discord4j.core.spec.InviteCreateSpec spec)
Requests to create an invite.Mono<ExtendedInvite>
createInvite(Consumer<? super LegacyInviteCreateSpec> spec)
Requests to create an invite.Mono<Void>
delete(String reason)
Requests to delete this channel while optionally specifying a reason.discord4j.core.spec.StoreChannelEditMono
edit()
Requests to edit this store channel.Mono<StoreChannel>
edit(discord4j.core.spec.StoreChannelEditSpec spec)
Requests to edit this store channel.Mono<StoreChannel>
edit(Consumer<? super LegacyStoreChannelEditSpec> spec)
Deprecated.useedit(StoreChannelEditSpec)
oredit()
which offer an immutable approach to build specsboolean
equals(Object obj)
Mono<Category>
getCategory()
Requests to retrieve the category for this channel, if present.Mono<Category>
getCategory(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the category for this channel, if present, using the given retrieval strategy.Optional<Snowflake>
getCategoryId()
Gets the ID of the category for this channel, if present.GatewayDiscordClient
getClient()
Returns theGatewayDiscordClient
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<PermissionSet>
getEffectivePermissions(Member member)
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.Flux<ExtendedInvite>
getInvites()
Requests to retrieve this channel's invites.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 aRestChannel
handle to execute REST API operations on this entity.Channel.Type
getType()
Gets the type of channel.int
hashCode()
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface discord4j.core.object.entity.channel.CategorizableChannel
createInvite
-
Methods inherited from interface discord4j.core.object.entity.channel.Channel
delete, delete, getMention, getRestChannel, getType
-
Methods inherited from interface discord4j.core.object.DiscordObject
getClient
-
Methods inherited from interface discord4j.core.object.entity.channel.GuildChannel
getEffectivePermissions, getEffectivePermissions, getGuild, getGuild, getGuildId, getName
-
Methods inherited from interface discord4j.core.object.entity.channel.TopLevelGuildChannel
addMemberOverwrite, addMemberOverwrite, addRoleOverwrite, addRoleOverwrite, getOverwriteForMember, getOverwriteForRole, getPermissionOverwrites, getPosition, getRawPosition
-
-
-
-
Constructor Detail
-
StoreChannel
public StoreChannel(GatewayDiscordClient gateway, discord4j.discordjson.json.ChannelData data)
Constructs anStoreChannel
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.
-
-
Method Detail
-
edit
@Deprecated public Mono<StoreChannel> edit(Consumer<? super LegacyStoreChannelEditSpec> spec)
Deprecated.useedit(StoreChannelEditSpec)
oredit()
which offer an immutable approach to build specsRequests to edit this store channel.- Parameters:
spec
- AConsumer
that provides a "blank"LegacyStoreChannelEditSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the editedStoreChannel
. If an error is received, it is emitted through theMono
.
-
edit
public discord4j.core.spec.StoreChannelEditMono edit()
Requests to edit this store channel. Properties specifying how to edit this store channel can be set via thewithXxx
methods of the returnedStoreChannelEditMono
.- Returns:
- A
StoreChannelEditMono
where, upon successful completion, emits the editedStoreChannel
. If an error is received, it is emitted through theStoreChannelEditMono
.
-
edit
public Mono<StoreChannel> edit(discord4j.core.spec.StoreChannelEditSpec spec)
Requests to edit this store channel.- Parameters:
spec
- an immutable object that specifies how to edit this store channel- Returns:
- A
Mono
where, upon successful completion, emits the editedStoreChannel
. If an error is received, it is emitted through theMono
.
-
toString
public String toString()
-
getCategoryId
public Optional<Snowflake> getCategoryId()
Description copied from interface:CategorizableChannel
Gets the ID of the category for this channel, if present.- Specified by:
getCategoryId
in interfaceCategorizableChannel
- Returns:
- The ID of the category for this channel, if present.
-
getCategory
public Mono<Category> getCategory()
Description copied from interface:CategorizableChannel
Requests to retrieve the category for this channel, if present.- Specified by:
getCategory
in interfaceCategorizableChannel
- Returns:
- A
Mono
where, upon successful completion, emits thecategory
this channel, if present. If an error is received, it is emitted through theMono
.
-
getCategory
public Mono<Category> getCategory(EntityRetrievalStrategy retrievalStrategy)
Description copied from interface:CategorizableChannel
Requests to retrieve the category for this channel, if present, using the given retrieval strategy.- Specified by:
getCategory
in interfaceCategorizableChannel
- Parameters:
retrievalStrategy
- the strategy to use to get the category- Returns:
- A
Mono
where, upon successful completion, emits thecategory
this channel, if present. If an error is received, it is emitted through theMono
.
-
createInvite
public Mono<ExtendedInvite> createInvite(Consumer<? super LegacyInviteCreateSpec> spec)
Description copied from interface:CategorizableChannel
Requests to create an invite.- Specified by:
createInvite
in interfaceCategorizableChannel
- Parameters:
spec
- AConsumer
that provides a "blank"LegacyInviteCreateSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the createdExtendedInvite
. If an error is received, it is emitted through theMono
.
-
createInvite
public Mono<ExtendedInvite> createInvite(discord4j.core.spec.InviteCreateSpec spec)
Description copied from interface:CategorizableChannel
Requests to create an invite.- Specified by:
createInvite
in interfaceCategorizableChannel
- Parameters:
spec
- an immutable object that specifies how to create the invite- Returns:
- A
Mono
where, upon successful completion, emits the createdExtendedInvite
. If an error is received, it is emitted through theMono
.
-
getInvites
public Flux<ExtendedInvite> getInvites()
Description copied from interface:CategorizableChannel
Requests to retrieve this channel's invites.- Specified by:
getInvites
in interfaceCategorizableChannel
- Returns:
- A
Flux
that continually emits this channel'sinvites
. If an error is received, it is emitted through theFlux
.
-
getGuildId
public final Snowflake getGuildId()
Description copied from interface:GuildChannel
Gets the ID of the guild this channel is associated to.- Specified by:
getGuildId
in interfaceGuildChannel
- Returns:
- The ID of the guild this channel is associated to.
-
getGuild
public final Mono<Guild> getGuild()
Description copied from interface:GuildChannel
Requests to retrieve the guild this channel is associated to.- Specified by:
getGuild
in interfaceGuildChannel
- Returns:
- A
Mono
where, upon successful completion, emits theguild
this channel is associated to. If an error is received, it is emitted through theMono
.
-
getGuild
public Mono<Guild> getGuild(EntityRetrievalStrategy retrievalStrategy)
Description copied from interface:GuildChannel
Requests to retrieve the guild this channel is associated to, using the given retrieval strategy.- Specified by:
getGuild
in interfaceGuildChannel
- Parameters:
retrievalStrategy
- the strategy to use to get the guild- Returns:
- A
Mono
where, upon successful completion, emits theguild
this channel is associated to. If an error is received, it is emitted through theMono
.
-
getPermissionOverwrites
public final Set<ExtendedPermissionOverwrite> getPermissionOverwrites()
Description copied from interface:GuildChannel
Gets the permission overwrites for this channel.- Specified by:
getPermissionOverwrites
in interfaceGuildChannel
- Returns:
- The permission overwrites for this channel.
-
getOverwriteForMember
public Optional<ExtendedPermissionOverwrite> getOverwriteForMember(Snowflake memberId)
Description copied from interface:GuildChannel
Gets the permission overwrite targeting the given member.- Specified by:
getOverwriteForMember
in interfaceGuildChannel
- Parameters:
memberId
- The ID of the member to get the overwrite for.- Returns:
- The permission overwrite targeting the given member.
-
getOverwriteForRole
public Optional<ExtendedPermissionOverwrite> getOverwriteForRole(Snowflake roleId)
Description copied from interface:GuildChannel
Gets the permission overwrite targeting the given role.- Specified by:
getOverwriteForRole
in interfaceGuildChannel
- Parameters:
roleId
- The ID of the role to get the overwrite for.- Returns:
- The permission overwrite targeting the given role.
-
getEffectivePermissions
public Mono<PermissionSet> getEffectivePermissions(Snowflake memberId)
Description copied from interface:GuildChannel
Gets the permissions for the given member, taking into account permission overwrites in this channel.- Specified by:
getEffectivePermissions
in interfaceGuildChannel
- Parameters:
memberId
- The ID of the member to get permissions for.- Returns:
- The permissions for the given member.
-
getEffectivePermissions
public Mono<PermissionSet> getEffectivePermissions(Member member)
Description copied from interface:GuildChannel
Gets the permissions for the given member, taking into account permission overwrites in this channel.- Specified by:
getEffectivePermissions
in interfaceGuildChannel
- Parameters:
member
- The member to get permissions for.- Returns:
- The permissions for the given member.
-
getName
public final String getName()
Description copied from interface:GuildChannel
Gets the name of the channel.- Specified by:
getName
in interfaceGuildChannel
- Returns:
- The name of the channel.
-
getRawPosition
public int getRawPosition()
Description copied from interface:GuildChannel
Gets the raw position of the channel as exposed by Discord. This may or may not be accurate with relativity to other channels in the guild.- Specified by:
getRawPosition
in interfaceGuildChannel
- Returns:
- The raw position of the channel.
-
getPosition
public final Mono<Integer> getPosition()
Description copied from interface:GuildChannel
Requests to retrieve the position of the channel relative to other channels in the guild.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))
guild.getChannels() .transform(OrderUtil::orderGuildChannels) .index((pos, c) -> c.getName() + " : " + pos)
- Specified by:
getPosition
in interfaceGuildChannel
- Returns:
- A
Mono
where, upon successful completion, emits the position of the channel. If an error is received, it is emitted through theMono
.
-
addMemberOverwrite
public Mono<Void> addMemberOverwrite(Snowflake memberId, PermissionOverwrite overwrite, @Nullable String reason)
Description copied from interface:GuildChannel
Requests to add a permission overwrite for the given member while optionally specifying a reason.- Specified by:
addMemberOverwrite
in interfaceGuildChannel
- Parameters:
memberId
- The ID of the member to add the overwrite for.overwrite
- The overwrite to add.reason
- The reason, if present.- Returns:
- A
Mono
where, upon successful completion, emits nothing; If an error is received, it is emitted through theMono
.
-
addRoleOverwrite
public Mono<Void> addRoleOverwrite(Snowflake roleId, PermissionOverwrite overwrite, @Nullable String reason)
Description copied from interface:GuildChannel
Requests to add a permission overwrite for the given role while optionally specifying a reason.- Specified by:
addRoleOverwrite
in interfaceGuildChannel
- Parameters:
roleId
- The ID of the role to add the overwrite for.overwrite
- The overwrite to add.reason
- The reason, if present.- Returns:
- A
Mono
where, upon successful completion, emits nothing; If an error is received, it is emitted through theMono
.
-
getClient
public final GatewayDiscordClient 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
public final Snowflake getId()
Description copied from interface:Entity
Gets the Snowflake that uniquely identifies this entity.
-
getRestChannel
public RestChannel getRestChannel()
Description copied from interface:Channel
Return aRestChannel
handle to execute REST API operations on this entity.- Specified by:
getRestChannel
in interfaceChannel
-
getType
public final Channel.Type getType()
Description copied from interface:Channel
Gets the type of channel.
-
delete
public final Mono<Void> delete(@Nullable String reason)
Description copied from interface:Channel
Requests to delete this channel while optionally specifying a reason.
-
-