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 anTextChannelwith 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.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.TextChannelEditMonoedit()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 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.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.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.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.intgetRateLimitPerUser()Gets the amount of seconds an user has to wait before sending another message (0-120).intgetRawPosition()Gets the raw position of the channel as exposed by Discord.RestChannelgetRestChannel()Return aRestChannelhandle to execute REST API operations on this entity.Optional<String>getTopic()Gets the channel topic, if present.Channel.TypegetType()Gets the type of channel.Flux<Webhook>getWebhooks()Requests to retrieve the webhooks of the channel.inthashCode()booleanisNsfw()Gets whether this channel is considered NSFW (Not Safe For Work).StringtoString()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 anTextChannelwith 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
-
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_messagesormanage_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:
trueif this channel is considered NSFW (Not Safe For Work),falseotherwise.
-
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- AConsumerthat provides a "blank"LegacyTextChannelEditSpecto be operated on.- Returns:
- A
Monowhere, 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 thewithXxxmethods of the returnedTextChannelEditMono.- Returns:
- A
TextChannelEditMonowhere, 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
Monowhere, 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:GuildMessageChannelRequests 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.
If you have achannel.getMessagesBefore(Snowflake.of(Instant.now())) .take(420) .map(Message::getId) .transform(channel::bulkDelete)Publisher<Message>, considerGuildMessageChannel.bulkDeleteMessages(Publisher).- Specified by:
bulkDeletein interfaceGuildMessageChannel- Parameters:
messageIds- APublisherto supply the message IDs to bulk delete.- Returns:
- A
Fluxthat continually emitsmessage IDsthat 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:GuildMessageChannelRequests 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.
If you have achannel.getMessagesBefore(Snowflake.of(Instant.now())) .take(420) .transform(channel::bulkDeleteMessages)Publisher<Snowflake>, considerGuildMessageChannel.bulkDelete(Publisher).- Specified by:
bulkDeleteMessagesin interfaceGuildMessageChannel- Parameters:
messages- APublisherto supply the messages to bulk delete.- Returns:
- A
Fluxthat continually emitsmessagesthat 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:GuildMessageChannelReturns all members in the guild which have access to view this channel.- Specified by:
getMembersin interfaceGuildMessageChannel- Returns:
- A
Fluxthat continually emits all members fromGuild.getMembers()which have access to view this channelPermission.VIEW_CHANNEL
-
getLastMessageId
public Optional<Snowflake> getLastMessageId()
Description copied from interface:MessageChannelGets the ID of the last message sent in this channel, if present.- Specified by:
getLastMessageIdin interfaceMessageChannel- Returns:
- The ID of the last message sent in this channel, if present.
-
getLastMessage
public Mono<Message> getLastMessage()
Description copied from interface:MessageChannelRequests to retrieve the last message sent in this channel, if present.- Specified by:
getLastMessagein interfaceMessageChannel- Returns:
- A
Monowhere, upon successful completion, emits the lastmessagesent 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:MessageChannelRequests to retrieve the last message sent in this channel, if present, using the given retrieval strategy.- Specified by:
getLastMessagein interfaceMessageChannel- Parameters:
retrievalStrategy- the strategy to use to get the last message- Returns:
- A
Monowhere, upon successful completion, emits the lastmessagesent in this channel, if present. If an error is received, it is emitted through theMono.
-
getLastPinTimestamp
public Optional<Instant> getLastPinTimestamp()
Description copied from interface:MessageChannelGets when the last pinned message was pinned, if present.- Specified by:
getLastPinTimestampin interfaceMessageChannel- Returns:
- When the last pinned message was pinned, if present.
-
createMessage
public Mono<Message> createMessage(Consumer<? super LegacyMessageCreateSpec> spec)
Description copied from interface:MessageChannelRequests to create a message.- Specified by:
createMessagein interfaceMessageChannel- Parameters:
spec- AConsumerthat provides a "blank"LegacyMessageCreateSpecto be operated on.- Returns:
- A
Monowhere, 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:MessageChannelRequests to create a message.- Specified by:
createMessagein interfaceMessageChannel- Parameters:
spec- an immutable object that specifies how to create the message- Returns:
- A
Monowhere, 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:MessageChannelRequests 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:
typein interfaceMessageChannel- Returns:
- A
Monowhich 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:MessageChannelRequests 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:
typeUntilin interfaceMessageChannel- Parameters:
until- The companionPublisherthat signals when to stop triggering the typing indicator.- Returns:
- A
Fluxwhich 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:MessageChannelRequests to retrieve all messages before the specified ID.The returned
Fluxwill 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
messageIdtomyOtherMessageId:getMessagesBefore(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) >= 0)- Specified by:
getMessagesBeforein interfaceMessageChannel- Parameters:
messageId- The ID of the newest message to retrieve. UseSnowflake.of(Instant)to retrieve a time-based ID.- Returns:
- A
Fluxthat continually emits allmessagesbefore the specified ID. If an error is received, it is emitted through theFlux.
-
getMessagesAfter
public Flux<Message> getMessagesAfter(Snowflake messageId)
Description copied from interface:MessageChannelRequests to retrieve all messages after the specified ID.The returned
Fluxwill 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
messageIdtomyOtherMessageId:getMessagesAfter(messageId).takeWhile(message -> message.getId().compareTo(myOtherMessageId) <= 0)- Specified by:
getMessagesAfterin interfaceMessageChannel- Parameters:
messageId- The ID of the oldest message to retrieve. UseSnowflake.of(Instant)to retrieve a time-based ID.- Returns:
- A
Fluxthat continually emits allmessagesafter the specified ID. If an error is received, it is emitted through theFlux.
-
getMessageById
public Mono<Message> getMessageById(Snowflake id)
Description copied from interface:MessageChannelRequests to retrieve the message as represented by the supplied ID.- Specified by:
getMessageByIdin interfaceMessageChannel- Parameters:
id- The ID of the message.- Returns:
- A
Monowhere, upon successful completion, emits theMessageas 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:MessageChannelRequests to retrieve the message as represented by the supplied ID, using the given retrieval strategy.- Specified by:
getMessageByIdin interfaceMessageChannel- Parameters:
id- The ID of the message.retrievalStrategy- the strategy to use to get the message- Returns:
- A
Monowhere, upon successful completion, emits theMessageas represented by the supplied ID. If an error is received, it is emitted through theMono.
-
getPinnedMessages
public Flux<Message> getPinnedMessages()
Description copied from interface:MessageChannelRequests to retrieve all the pinned messages for this channel.- Specified by:
getPinnedMessagesin interfaceMessageChannel- Returns:
- A
Fluxthat 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:GuildMessageChannelGets the channel topic, if present.- Specified by:
getTopicin interfaceGuildMessageChannel- Specified by:
getTopicin interfaceTopLevelGuildMessageChannel- Returns:
- The channel topic, if present.
-
createWebhook
public Mono<Webhook> createWebhook(Consumer<? super LegacyWebhookCreateSpec> spec)
Description copied from interface:GuildMessageChannelRequests to create a webhook.- Specified by:
createWebhookin interfaceGuildMessageChannel- Specified by:
createWebhookin interfaceTopLevelGuildMessageChannel- Parameters:
spec- AConsumerthat provides a "blank"LegacyWebhookCreateSpecto be operated on.- Returns:
- A
Monowhere, 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:GuildMessageChannelRequests to create a webhook.- Specified by:
createWebhookin interfaceGuildMessageChannel- Specified by:
createWebhookin interfaceTopLevelGuildMessageChannel- Parameters:
spec- an immutable object that specifies how to create the webhook- Returns:
- A
Monowhere, 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:GuildMessageChannelRequests to retrieve the webhooks of the channel.- Specified by:
getWebhooksin interfaceGuildMessageChannel- Specified by:
getWebhooksin interfaceTopLevelGuildMessageChannel- Returns:
- A
Fluxthat continually emits thewebhooksof the channel. If an error is received, it is emitted through theFlux.
-
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.
-
-