Interface TopLevelGuildChannel
-
- All Superinterfaces:
Channel
,DiscordObject
,Entity
,GuildChannel
- All Known Subinterfaces:
CategorizableChannel
,GuildMessageChannel
,TopLevelGuildMessageChannel
- All Known Implementing Classes:
NewsChannel
,StoreChannel
,TextChannel
,VoiceChannel
public interface TopLevelGuildChannel extends GuildChannel
A Discord channel in a guild that isn't a thread.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface discord4j.core.object.entity.channel.Channel
Channel.Type
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Mono<Void>
addMemberOverwrite(Snowflake memberId, PermissionOverwrite overwrite)
Requests to add a permission overwrite for the given member.Mono<Void>
addMemberOverwrite(Snowflake memberId, PermissionOverwrite overwrite, String reason)
Requests to add a permission overwrite for the given member while optionally specifying a reason.default Mono<Void>
addRoleOverwrite(Snowflake roleId, PermissionOverwrite overwrite)
Requests to add a permission overwrite for the given role.Mono<Void>
addRoleOverwrite(Snowflake roleId, PermissionOverwrite overwrite, String reason)
Requests to add a permission overwrite for the given role while optionally specifying a reason.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.-
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
-
-
-
-
Method Detail
-
getPermissionOverwrites
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
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
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.
-
addMemberOverwrite
default Mono<Void> addMemberOverwrite(Snowflake memberId, PermissionOverwrite overwrite)
Description copied from interface:GuildChannel
Requests to add a permission overwrite for the given member.- Specified by:
addMemberOverwrite
in interfaceGuildChannel
- Parameters:
memberId
- The ID of the member to add the overwrite for.overwrite
- The overwrite to add.- Returns:
- A
Mono
where, upon successful completion, emits nothing; If an error is received, it is emitted through theMono
.
-
addMemberOverwrite
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
default Mono<Void> addRoleOverwrite(Snowflake roleId, PermissionOverwrite overwrite)
Description copied from interface:GuildChannel
Requests to add a permission overwrite for the given role.- Specified by:
addRoleOverwrite
in interfaceGuildChannel
- Parameters:
roleId
- The ID of the role to add the overwrite for.overwrite
- The overwrite to add.- Returns:
- A
Mono
where, upon successful completion, emits nothing; If an error is received, it is emitted through theMono
.
-
addRoleOverwrite
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
.
-
getRawPosition
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
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
.
-
-