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 anStoreChannelwith an associatedGatewayDiscordClientand 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.StoreChannelEditMonoedit()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 specsbooleanequals(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.GatewayDiscordClientgetClient()Returns theGatewayDiscordClientthat 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.SnowflakegetGuildId()Gets the ID of the guild this channel is associated to.SnowflakegetId()Gets the Snowflake that uniquely identifies this entity.Flux<ExtendedInvite>getInvites()Requests to retrieve this channel's invites.StringgetName()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.intgetRawPosition()Gets the raw position of the channel as exposed by Discord.RestChannelgetRestChannel()Return aRestChannelhandle to execute REST API operations on this entity.Channel.TypegetType()Gets the type of channel.inthashCode()StringtoString()-
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 anStoreChannelwith 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.
-
-
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- AConsumerthat provides a "blank"LegacyStoreChannelEditSpecto be operated on.- Returns:
- A
Monowhere, 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 thewithXxxmethods of the returnedStoreChannelEditMono.- Returns:
- A
StoreChannelEditMonowhere, 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
Monowhere, 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:CategorizableChannelGets the ID of the category for this channel, if present.- Specified by:
getCategoryIdin interfaceCategorizableChannel- Returns:
- The ID of the category for this channel, if present.
-
getCategory
public Mono<Category> getCategory()
Description copied from interface:CategorizableChannelRequests to retrieve the category for this channel, if present.- Specified by:
getCategoryin interfaceCategorizableChannel- Returns:
- A
Monowhere, upon successful completion, emits thecategorythis channel, if present. If an error is received, it is emitted through theMono.
-
getCategory
public Mono<Category> getCategory(EntityRetrievalStrategy retrievalStrategy)
Description copied from interface:CategorizableChannelRequests to retrieve the category for this channel, if present, using the given retrieval strategy.- Specified by:
getCategoryin interfaceCategorizableChannel- Parameters:
retrievalStrategy- the strategy to use to get the category- Returns:
- A
Monowhere, upon successful completion, emits thecategorythis 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:CategorizableChannelRequests to create an invite.- Specified by:
createInvitein interfaceCategorizableChannel- Parameters:
spec- AConsumerthat provides a "blank"LegacyInviteCreateSpecto be operated on.- Returns:
- A
Monowhere, 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:CategorizableChannelRequests to create an invite.- Specified by:
createInvitein interfaceCategorizableChannel- Parameters:
spec- an immutable object that specifies how to create the invite- Returns:
- A
Monowhere, 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:CategorizableChannelRequests to retrieve this channel's invites.- Specified by:
getInvitesin interfaceCategorizableChannel- Returns:
- A
Fluxthat continually emits this channel'sinvites. If an error is received, it is emitted through theFlux.
-
getGuildId
public final Snowflake getGuildId()
Description copied from interface:GuildChannelGets the ID of the guild this channel is associated to.- Specified by:
getGuildIdin interfaceGuildChannel- Returns:
- The ID of the guild this channel is associated to.
-
getGuild
public final Mono<Guild> getGuild()
Description copied from interface:GuildChannelRequests to retrieve the guild this channel is associated to.- Specified by:
getGuildin interfaceGuildChannel- Returns:
- A
Monowhere, upon successful completion, emits theguildthis 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:GuildChannelRequests to retrieve the guild this channel is associated to, using the given retrieval strategy.- Specified by:
getGuildin interfaceGuildChannel- Parameters:
retrievalStrategy- the strategy to use to get the guild- Returns:
- A
Monowhere, upon successful completion, emits theguildthis channel is associated to. If an error is received, it is emitted through theMono.
-
getPermissionOverwrites
public final Set<ExtendedPermissionOverwrite> getPermissionOverwrites()
Description copied from interface:GuildChannelGets the permission overwrites for this channel.- Specified by:
getPermissionOverwritesin interfaceGuildChannel- Returns:
- The permission overwrites for this channel.
-
getOverwriteForMember
public Optional<ExtendedPermissionOverwrite> getOverwriteForMember(Snowflake memberId)
Description copied from interface:GuildChannelGets the permission overwrite targeting the given member.- Specified by:
getOverwriteForMemberin 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:GuildChannelGets the permission overwrite targeting the given role.- Specified by:
getOverwriteForRolein 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:GuildChannelGets the permissions for the given member, taking into account permission overwrites in this channel.- Specified by:
getEffectivePermissionsin 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:GuildChannelGets the permissions for the given member, taking into account permission overwrites in this channel.- Specified by:
getEffectivePermissionsin 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:GuildChannelGets the name of the channel.- Specified by:
getNamein interfaceGuildChannel- Returns:
- The name of the channel.
-
getRawPosition
public int getRawPosition()
Description copied from interface:GuildChannelGets 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:
getRawPositionin interfaceGuildChannel- Returns:
- The raw position of the channel.
-
getPosition
public final Mono<Integer> getPosition()
Description copied from interface:GuildChannelRequests 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
sortedlist 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:
It would be much more efficient to write:guild.getChannels() .flatMap(c -> c.getPosition().map(pos -> c.getName() + " : " + pos))guild.getChannels() .transform(OrderUtil::orderGuildChannels) .index((pos, c) -> c.getName() + " : " + pos)- Specified by:
getPositionin interfaceGuildChannel- Returns:
- A
Monowhere, 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:GuildChannelRequests to add a permission overwrite for the given member while optionally specifying a reason.- Specified by:
addMemberOverwritein 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
Monowhere, 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:GuildChannelRequests to add a permission overwrite for the given role while optionally specifying a reason.- Specified by:
addRoleOverwritein 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
Monowhere, upon successful completion, emits nothing; If an error is received, it is emitted through theMono.
-
getClient
public final 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 final Snowflake getId()
Description copied from interface:EntityGets the Snowflake that uniquely identifies this entity.
-
getRestChannel
public RestChannel getRestChannel()
Description copied from interface:ChannelReturn aRestChannelhandle to execute REST API operations on this entity.- Specified by:
getRestChannelin interfaceChannel
-
getType
public final Channel.Type getType()
Description copied from interface:ChannelGets the type of channel.
-
delete
public final Mono<Void> delete(@Nullable String reason)
Description copied from interface:ChannelRequests to delete this channel while optionally specifying a reason.
-
-