Class TextChannel
- java.lang.Object
-
- discord4j.core.object.entity.channel.TextChannel
-
- All Implemented Interfaces:
DiscordObject
,CategorizableChannel
,Channel
,GuildChannel
,GuildMessageChannel
,MessageChannel
,TopLevelGuildChannel
,TopLevelGuildMessageChannel
,Entity
public final class TextChannel extends Object
A Discord text channel.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface discord4j.core.object.entity.channel.Channel
Channel.Type
-
-
Constructor Summary
Constructors Constructor Description TextChannel(GatewayDiscordClient gateway, discord4j.discordjson.json.ChannelData data)
Constructs anTextChannel
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.Flux<Snowflake>
bulkDelete(Publisher<Snowflake> messageIds)
Requests to bulk delete the supplied message IDs.Flux<Message>
bulkDeleteMessages(Publisher<Message> messages)
Requests to bulk delete the supplied messages.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<Message>
createMessage(discord4j.core.spec.MessageCreateSpec spec)
Requests to create a message.Mono<Message>
createMessage(Consumer<? super LegacyMessageCreateSpec> spec)
Requests to create a message.Mono<Webhook>
createWebhook(discord4j.core.spec.WebhookCreateSpec spec)
Requests to create a webhook.Mono<Webhook>
createWebhook(Consumer<? super LegacyWebhookCreateSpec> spec)
Requests to create a webhook.Mono<Void>
delete(String reason)
Requests to delete this channel while optionally specifying a reason.discord4j.core.spec.TextChannelEditMono
edit()
Requests to edit this text channel.Mono<TextChannel>
edit(discord4j.core.spec.TextChannelEditSpec spec)
Requests to edit this text channel.Mono<TextChannel>
edit(Consumer<? super LegacyTextChannelEditSpec> spec)
Deprecated.useedit(TextChannelEditSpec)
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.Mono<Message>
getLastMessage()
Requests to retrieve the last message sent in this channel, if present.Mono<Message>
getLastMessage(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the last message sent in this channel, if present, using the given retrieval strategy.Optional<Snowflake>
getLastMessageId()
Gets the ID of the last message sent in this channel, if present.Optional<Instant>
getLastPinTimestamp()
Gets when the last pinned message was pinned, if present.Flux<Member>
getMembers()
Returns all members in the guild which have access to view this channel.Mono<Message>
getMessageById(Snowflake id)
Requests to retrieve the message as represented by the supplied ID.Mono<Message>
getMessageById(Snowflake id, EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the message as represented by the supplied ID, using the given retrieval strategy.Flux<Message>
getMessagesAfter(Snowflake messageId)
Requests to retrieve all messages after the specified ID.Flux<Message>
getMessagesBefore(Snowflake messageId)
Requests to retrieve all messages before the specified ID.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.Flux<Message>
getPinnedMessages()
Requests to retrieve all the pinned messages for this channel.Mono<Integer>
getPosition()
Requests to retrieve the position of the channel relative to other channels in the guild.int
getRateLimitPerUser()
Gets the amount of seconds an user has to wait before sending another message (0-120).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.Optional<String>
getTopic()
Gets the channel topic, if present.Channel.Type
getType()
Gets the type of channel.Flux<Webhook>
getWebhooks()
Requests to retrieve the webhooks of the channel.int
hashCode()
boolean
isNsfw()
Gets whether this channel is considered NSFW (Not Safe For Work).String
toString()
Mono<Void>
type()
Requests to trigger the typing indicator in this channel.Flux<Long>
typeUntil(Publisher<?> until)
Requests to trigger the typing indicator in this channel.-
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.GuildMessageChannel
createInvite, createInvite, getCategory, getCategory, getCategoryId, getInvites
-
Methods inherited from interface discord4j.core.object.entity.channel.MessageChannel
createEmbed, createEmbed, createMessage, createMessage
-
Methods inherited from interface discord4j.core.object.entity.channel.TopLevelGuildChannel
addMemberOverwrite, addMemberOverwrite, addRoleOverwrite, addRoleOverwrite, getOverwriteForMember, getOverwriteForRole, getPermissionOverwrites, getPosition, getRawPosition
-
Methods inherited from interface discord4j.core.object.entity.channel.TopLevelGuildMessageChannel
createWebhook
-
-
-
-
Constructor Detail
-
TextChannel
public TextChannel(GatewayDiscordClient gateway, discord4j.discordjson.json.ChannelData data)
Constructs anTextChannel
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
-
getRateLimitPerUser
public int getRateLimitPerUser()
Gets the amount of seconds an user has to wait before sending another message (0-120).Bots, as well as users with the permission
manage_messages
ormanage_channel
, are unaffected.- Returns:
- The amount of seconds an user has to wait before sending another message (0-120).
-
isNsfw
public boolean isNsfw()
Gets whether this channel is considered NSFW (Not Safe For Work).- Returns:
true
if this channel is considered NSFW (Not Safe For Work),false
otherwise.
-
edit
@Deprecated public Mono<TextChannel> edit(Consumer<? super LegacyTextChannelEditSpec> spec)
Deprecated.useedit(TextChannelEditSpec)
oredit()
which offer an immutable approach to build specsRequests to edit this text channel.- Parameters:
spec
- AConsumer
that provides a "blank"LegacyTextChannelEditSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the editedTextChannel
. If an error is received, it is emitted through theMono
.
-
edit
public discord4j.core.spec.TextChannelEditMono edit()
Requests to edit this text channel. Properties specifying how to edit this channel can be set via thewithXxx
methods of the returnedTextChannelEditMono
.- Returns:
- A
TextChannelEditMono
where, upon successful completion, emits the editedTextChannel
. If an error is received, it is emitted through theTextChannelEditMono
.
-
edit
public Mono<TextChannel> edit(discord4j.core.spec.TextChannelEditSpec spec)
Requests to edit this text channel.- Parameters:
spec
- an immutable object that specifies how to edit this text channel- Returns:
- A
Mono
where, upon successful completion, emits the editedTextChannel
. If an error is received, it is emitted through theMono
.
-
toString
public String toString()
-
bulkDelete
public Flux<Snowflake> bulkDelete(Publisher<Snowflake> messageIds)
Description copied from interface:GuildMessageChannel
Requests to bulk delete the supplied message IDs.Typically this method is paired with a call from
MessageChannel.getMessagesBefore(Snowflake)
orMessageChannel.getMessagesAfter(Snowflake)
to delete some or (potentially) all messages from a channel.channel.getMessagesBefore(Snowflake.of(Instant.now())) .take(420) .map(Message::getId) .transform(channel::bulkDelete)
Publisher<Message>
, considerGuildMessageChannel.bulkDeleteMessages(Publisher)
.- Specified by:
bulkDelete
in interfaceGuildMessageChannel
- Parameters:
messageIds
- APublisher
to supply the message IDs to bulk delete.- Returns:
- A
Flux
that continually emitsmessage IDs
that were not bulk deleted (typically if the ID was older than 2 weeks). If an error is received, it is emitted through theFlux
.
-
bulkDeleteMessages
public Flux<Message> bulkDeleteMessages(Publisher<Message> messages)
Description copied from interface:GuildMessageChannel
Requests to bulk delete the supplied messages.Typically this method is paired with a call from
MessageChannel.getMessagesBefore(Snowflake)
orMessageChannel.getMessagesAfter(Snowflake)
to delete some or (potentially) all messages from a channel.channel.getMessagesBefore(Snowflake.of(Instant.now())) .take(420) .transform(channel::bulkDeleteMessages)
Publisher<Snowflake>
, considerGuildMessageChannel.bulkDelete(Publisher)
.- Specified by:
bulkDeleteMessages
in interfaceGuildMessageChannel
- Parameters:
messages
- APublisher
to supply the messages to bulk delete.- Returns:
- A
Flux
that continually emitsmessages
that were not bulk deleted (typically if the message was older than 2 weeks). If an error is received, it is emitted through theFlux
.
-
getMembers
public Flux<Member> getMembers()
Description copied from interface:GuildMessageChannel
Returns all members in the guild which have access to view this channel.- Specified by:
getMembers
in interfaceGuildMessageChannel
- Returns:
- A
Flux
that continually emits all members fromGuild.getMembers()
which have access to view this channelPermission.VIEW_CHANNEL
-
getLastMessageId
public Optional<Snowflake> getLastMessageId()
Description copied from interface:MessageChannel
Gets the ID of the last message sent in this channel, if present.- Specified by:
getLastMessageId
in interfaceMessageChannel
- Returns:
- The ID of the last message sent in this channel, if present.
-
getLastMessage
public Mono<Message> getLastMessage()
Description copied from interface:MessageChannel
Requests to retrieve the last message sent in this channel, if present.- Specified by:
getLastMessage
in interfaceMessageChannel
- Returns:
- A
Mono
where, upon successful completion, emits the lastmessage
sent in this channel, if present. If an error is received, it is emitted through theMono
.
-
getLastMessage
public Mono<Message> getLastMessage(EntityRetrievalStrategy retrievalStrategy)
Description copied from interface:MessageChannel
Requests to retrieve the last message sent in this channel, if present, using the given retrieval strategy.- Specified by:
getLastMessage
in interfaceMessageChannel
- Parameters:
retrievalStrategy
- the strategy to use to get the last message- Returns:
- A
Mono
where, upon successful completion, emits the lastmessage
sent in this channel, if present. If an error is received, it is emitted through theMono
.
-
getLastPinTimestamp
public Optional<Instant> getLastPinTimestamp()
Description copied from interface:MessageChannel
Gets when the last pinned message was pinned, if present.- Specified by:
getLastPinTimestamp
in interfaceMessageChannel
- Returns:
- When the last pinned message was pinned, if present.
-
createMessage
public Mono<Message> createMessage(Consumer<? super LegacyMessageCreateSpec> spec)
Description copied from interface:MessageChannel
Requests to create a message.- Specified by:
createMessage
in interfaceMessageChannel
- Parameters:
spec
- AConsumer
that provides a "blank"LegacyMessageCreateSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the createdMessage
. If an error is received, it is emitted through theMono
.
-
createMessage
public Mono<Message> createMessage(discord4j.core.spec.MessageCreateSpec spec)
Description copied from interface:MessageChannel
Requests to create a message.- Specified by:
createMessage
in interfaceMessageChannel
- Parameters:
spec
- an immutable object that specifies how to create the message- Returns:
- A
Mono
where, upon successful completion, emits the createdMessage
. If an error is received, it is emitted through theMono
. - See Also:
MessageCreateSpec.builder()
-
type
public Mono<Void> type()
Description copied from interface:MessageChannel
Requests to trigger the typing indicator in this channel. A single invocation of this method will trigger the indicator for 10 seconds or until the bot sends a message in this channel.- Specified by:
type
in interfaceMessageChannel
- Returns:
- A
Mono
which completes upon successful triggering of the typing indicator in this channel. If an error is received, it is emitted through theMono
.
-
typeUntil
public Flux<Long> typeUntil(Publisher<?> until)
Description copied from interface:MessageChannel
Requests to trigger the typing indicator in this channel. It will be continuously triggered every 10 seconds until the given publisher emits.This method cannot stop the typing indicator during the 10 second duration. It simply checks every 10 seconds whether to trigger the indicator again depending on if the publisher emitted. For example, the following code will show the typing indicator for 10 seconds, not 5:
channel.typeUntil(Mono.delay(Duration.ofSeconds(5))
The only way to stop the typing indicator during the 10 second duration is to send a message in the channel. For example, the following code will show the typing indicator until the message is sent:
channel.typeUntil(channel.createMessage("Hello"))
- Specified by:
typeUntil
in interfaceMessageChannel
- Parameters:
until
- The companionPublisher
that signals when to stop triggering the typing indicator.- Returns:
- A
Flux
which continually emits each time the typing indicator is triggered and completes when it will no longer be triggered. If an error is received, it is emitted through theFlux
.
-
getMessagesBefore
public Flux<Message> getMessagesBefore(Snowflake messageId)
Description copied from interface:MessageChannel
Requests to retrieve all messages before the specified ID.The returned
Flux
will emit items in reverse-chronological order (newest to oldest). It is recommended to limit the emitted items by invoking eitherFlux.takeWhile(Predicate)
(to retrieve IDs within a specified range) orFlux.take(long)
(to retrieve a specific amount of IDs).The following example will get all messages from
messageId
tomyOtherMessageId
:getMessagesBefore(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) >= 0)
- Specified by:
getMessagesBefore
in interfaceMessageChannel
- Parameters:
messageId
- The ID of the newest message to retrieve. UseSnowflake.of(Instant)
to retrieve a time-based ID.- Returns:
- A
Flux
that continually emits allmessages
before the specified ID. If an error is received, it is emitted through theFlux
.
-
getMessagesAfter
public Flux<Message> getMessagesAfter(Snowflake messageId)
Description copied from interface:MessageChannel
Requests to retrieve all messages after the specified ID.The returned
Flux
will emit items in chronological order (oldest to newest). It is recommended to limit the emitted items by invoking eitherFlux.takeWhile(Predicate)
(to retrieve IDs within a specified range) orFlux.take(long)
(to retrieve a specific amount of IDs).The following example will get all messages from
messageId
tomyOtherMessageId
:getMessagesAfter(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) <= 0)
- Specified by:
getMessagesAfter
in interfaceMessageChannel
- Parameters:
messageId
- The ID of the oldest message to retrieve. UseSnowflake.of(Instant)
to retrieve a time-based ID.- Returns:
- A
Flux
that continually emits allmessages
after the specified ID. If an error is received, it is emitted through theFlux
.
-
getMessageById
public Mono<Message> getMessageById(Snowflake id)
Description copied from interface:MessageChannel
Requests to retrieve the message as represented by the supplied ID.- Specified by:
getMessageById
in interfaceMessageChannel
- Parameters:
id
- The ID of the message.- Returns:
- A
Mono
where, upon successful completion, emits theMessage
as represented by the supplied ID. If an error is received, it is emitted through theMono
.
-
getMessageById
public Mono<Message> getMessageById(Snowflake id, EntityRetrievalStrategy retrievalStrategy)
Description copied from interface:MessageChannel
Requests to retrieve the message as represented by the supplied ID, using the given retrieval strategy.- Specified by:
getMessageById
in interfaceMessageChannel
- Parameters:
id
- The ID of the message.retrievalStrategy
- the strategy to use to get the message- Returns:
- A
Mono
where, upon successful completion, emits theMessage
as represented by the supplied ID. If an error is received, it is emitted through theMono
.
-
getPinnedMessages
public Flux<Message> getPinnedMessages()
Description copied from interface:MessageChannel
Requests to retrieve all the pinned messages for this channel.- Specified by:
getPinnedMessages
in interfaceMessageChannel
- Returns:
- A
Flux
that continually emits all the pinned messages for this channel. If an error is received, it is emitted through theFlux
.
-
getTopic
public Optional<String> getTopic()
Description copied from interface:GuildMessageChannel
Gets the channel topic, if present.- Specified by:
getTopic
in interfaceGuildMessageChannel
- Specified by:
getTopic
in interfaceTopLevelGuildMessageChannel
- Returns:
- The channel topic, if present.
-
createWebhook
public Mono<Webhook> createWebhook(Consumer<? super LegacyWebhookCreateSpec> spec)
Description copied from interface:GuildMessageChannel
Requests to create a webhook.- Specified by:
createWebhook
in interfaceGuildMessageChannel
- Specified by:
createWebhook
in interfaceTopLevelGuildMessageChannel
- Parameters:
spec
- AConsumer
that provides a "blank"LegacyWebhookCreateSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the createdWebhook
. If an error is received, it is emitted through theMono
.
-
createWebhook
public Mono<Webhook> createWebhook(discord4j.core.spec.WebhookCreateSpec spec)
Description copied from interface:GuildMessageChannel
Requests to create a webhook.- Specified by:
createWebhook
in interfaceGuildMessageChannel
- Specified by:
createWebhook
in interfaceTopLevelGuildMessageChannel
- Parameters:
spec
- an immutable object that specifies how to create the webhook- Returns:
- A
Mono
where, upon successful completion, emits the createdWebhook
. If an error is received, it is emitted through theMono
.
-
getWebhooks
public Flux<Webhook> getWebhooks()
Description copied from interface:GuildMessageChannel
Requests to retrieve the webhooks of the channel.- Specified by:
getWebhooks
in interfaceGuildMessageChannel
- Specified by:
getWebhooks
in interfaceTopLevelGuildMessageChannel
- Returns:
- A
Flux
that continually emits thewebhooks
of the channel. If an error is received, it is emitted through theFlux
.
-
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.
-
-