Class ChannelActionImpl<T extends GuildChannel>
- All Implemented Interfaces:
RestAction<T>
,AuditableRestAction<T>
,ChannelAction<T>
,FluentAuditableRestAction<T,
ChannelAction<T>>
-
Field Summary
Fields inherited from class net.dv8tion.jda.internal.requests.RestActionImpl
LOG
Fields inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
MAX_REASON_LENGTH
-
Constructor Summary
ConstructorsConstructorDescriptionChannelActionImpl
(Class<T> clazz, String name, Guild guild, ChannelType type) -
Method Summary
Modifier and TypeMethodDescriptionaddMemberPermissionOverride
(long userId, long allow, long deny) Adds a new MemberPermissionOverride
for the new GuildChannel.addRolePermissionOverride
(long roleId, long allow, long deny) Adds a new RolePermissionOverride
for the new GuildChannel.Removes all currently configured permission overridesdeadline
(long timestamp) Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.getGuild()
The guild to create thisGuildChannel
ingetType()
TheChannelType
for the resulting channelApplies the specified reason as audit-log reason field.removePermissionOverride
(long id) Removes any existing override with the provided id.setAvailableTags
(List<? extends BaseForumTag> tags) Sets the available tags of the channel.setBitrate
(Integer bitrate) Sets the bitrate for the new VoiceChannelsetCheck
(BooleanSupplier checks) Sets the last-second checks before finally executing the http request in the queue.setDefaultLayout
(ForumChannel.Layout layout) Sets the default layout of the newForumChannel
.setDefaultReaction
(Emoji emoji) Sets the default reaction emoji of the channel.setDefaultSortOrder
(IPostContainer.SortOrder sortOrder) Sets the default sort order of the channel.setDefaultThreadSlowmode
(int slowmode) Sets the slowmode value, which limits the amount of time that individual users must wait between sending messages in the new channel.Sets the name for the new GuildChannelsetNSFW
(boolean nsfw) Sets the NSFW flag for the channelSets theCategory
for the new GuildChannel.setPosition
(Integer position) Sets the position where the new Channel should be inserted into.Sets the voice region for the new AudioChannelsetSlowmode
(int slowmode) Sets the slowmode value, which limits the amount of time that individual users must wait between sending messages in the new channel.Sets the topic for the channelsetUserlimit
(Integer userlimit) Sets the userlimit for the newAudioChannel
.Syncs the permission overrides of the channel with the category.Timeout for this RestAction instance.Methods inherited from class net.dv8tion.jda.internal.requests.RestActionImpl
complete, getCheck, getDefaultFailure, getDefaultSuccess, getDefaultTimeout, getJDA, handleResponse, isPassContext, priority, queue, setDefaultFailure, setDefaultSuccess, setDefaultTimeout, setErrorMapper, setPassContext, submit
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.ChannelAction
addMemberPermissionOverride, addPermissionOverride, addPermissionOverride, addRolePermissionOverride, removePermissionOverride, removePermissionOverride
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.FluentAuditableRestAction
addCheck
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Constructor Details
-
ChannelActionImpl
-
-
Method Details
-
reason
Description copied from interface:AuditableRestAction
Applies the specified reason as audit-log reason field.
When the provided reason is empty ornull
it will be treated as not set. If the provided reason is longer than 512<T> characters, it will be truncated to fit the limit.Reasons for any AuditableRestAction may be retrieved via
AuditLogEntry.getReason()
in iterableAuditLogPaginationActions
fromGuild.retrieveAuditLogs()
! Forguild bans
, this is also accessible viaGuild.Ban.getReason()
.This will specify the reason via the
X-Audit-Log-Reason
Request Header.- Specified by:
reason
in interfaceAuditableRestAction<T extends GuildChannel>
- Specified by:
reason
in interfaceFluentAuditableRestAction<T extends GuildChannel,
ChannelAction<T extends GuildChannel>> - Overrides:
reason
in classAuditableRestActionImpl<T extends GuildChannel>
- Parameters:
reason
- The reason for this action which should be logged in the Guild's AuditLogs (up to 512<T> characters)- Returns:
- The current AuditableRestAction instance for chaining convenience
- See Also:
-
setCheck
Description copied from interface:RestAction
Sets the last-second checks before finally executing the http request in the queue.
If the provided supplier evaluates tofalse
or throws an exception this will not be finished. When an exception is thrown from the supplier it will be provided to the failure callback.- Specified by:
setCheck
in interfaceAuditableRestAction<T extends GuildChannel>
- Specified by:
setCheck
in interfaceFluentAuditableRestAction<T extends GuildChannel,
ChannelAction<T extends GuildChannel>> - Specified by:
setCheck
in interfaceRestAction<T extends GuildChannel>
- Overrides:
setCheck
in classAuditableRestActionImpl<T extends GuildChannel>
- Parameters:
checks
- The checks to run before executing the request, ornull
to run no checks- Returns:
- The current RestAction for chaining convenience
- See Also:
-
timeout
Description copied from interface:AuditableRestAction
Timeout for this RestAction instance.
If the request doesn't get executed within the timeout it will fail.When a RestAction times out, it will fail with a
TimeoutException
. This is the same asdeadline(System.currentTimeMillis() + unit.toMillis(timeout))
.Example
action.timeout(10, TimeUnit.SECONDS) // 10 seconds from now .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
- Specified by:
timeout
in interfaceAuditableRestAction<T extends GuildChannel>
- Specified by:
timeout
in interfaceFluentAuditableRestAction<T extends GuildChannel,
ChannelAction<T extends GuildChannel>> - Specified by:
timeout
in interfaceRestAction<T extends GuildChannel>
- Overrides:
timeout
in classAuditableRestActionImpl<T extends GuildChannel>
- Parameters:
timeout
- The timeout to useunit
-Unit
for the timeout value- Returns:
- The same RestAction instance with the applied timeout
- See Also:
-
deadline
Description copied from interface:RestAction
Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.
If the deadline is reached, the request will fail with aTimeoutException
.This does not mean that the request will immediately timeout when the deadline is reached. JDA will check the deadline right before executing the request or within intervals in a worker thread. This only means the request will timeout if the deadline has passed.
Example
action.deadline(System.currentTimeMillis() + 10000) // 10 seconds from now .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
- Specified by:
deadline
in interfaceAuditableRestAction<T extends GuildChannel>
- Specified by:
deadline
in interfaceFluentAuditableRestAction<T extends GuildChannel,
ChannelAction<T extends GuildChannel>> - Specified by:
deadline
in interfaceRestAction<T extends GuildChannel>
- Overrides:
deadline
in classAuditableRestActionImpl<T extends GuildChannel>
- Parameters:
timestamp
- Millisecond timestamp at which the request will timeout- Returns:
- The same RestAction with the applied deadline
- See Also:
-
getGuild
Description copied from interface:ChannelAction
The guild to create thisGuildChannel
in- Specified by:
getGuild
in interfaceChannelAction<T extends GuildChannel>
- Returns:
- The guild
-
getType
Description copied from interface:ChannelAction
TheChannelType
for the resulting channel- Specified by:
getType
in interfaceChannelAction<T extends GuildChannel>
- Returns:
- The channel type
-
setName
Description copied from interface:ChannelAction
Sets the name for the new GuildChannel- Specified by:
setName
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
name
- The not-null name for the new GuildChannel (1-100 characters long)- Returns:
- The current ChannelAction, for chaining convenience
-
setParent
Description copied from interface:ChannelAction
Sets theCategory
for the new GuildChannel.You can use
ChannelAction.syncPermissionOverrides()
to sync the channel with the category.- Specified by:
setParent
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
category
- The parent for the new GuildChannel- Returns:
- The current ChannelAction, for chaining convenience
- See Also:
-
setPosition
Description copied from interface:ChannelAction
Sets the position where the new Channel should be inserted into. This refers to the raw position value, not the computed (relative) position.By default (or by providing this method with
null
), the position will automatically be computed based on the other Channels (inserted last in its respective group).Note: This does not shift the position values of existing Channels if the values collide.
As a reminder: The ordering of Channels is determined first by its Category's position, then by its raw position value and finally by its id (younger Channels are below older ones)- Specified by:
setPosition
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
position
- The raw position value that should be used for the new Channel- Returns:
- The current ChannelAction, for chaining convenience
-
setTopic
Description copied from interface:ChannelAction
Sets the topic for the channel- Specified by:
setTopic
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
topic
- The topic for the new GuildChannel- Returns:
- The current ChannelAction, for chaining convenience
-
setNSFW
Description copied from interface:ChannelAction
Sets the NSFW flag for the channel- Specified by:
setNSFW
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
nsfw
- The NSFW flag for the new GuildChannel- Returns:
- The current ChannelAction, for chaining convenience
-
setSlowmode
Description copied from interface:ChannelAction
Sets the slowmode value, which limits the amount of time that individual users must wait between sending messages in the new channel. This is measured in seconds.Note: Bots are unaffected by this.
HavingMESSAGE_MANAGE
orMANAGE_CHANNEL
permission also grants immunity to slowmode.- Specified by:
setSlowmode
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
slowmode
- The number of seconds required to wait between sending messages in the channel.- Returns:
- The current ChannelAction, for chaining convenience
-
setDefaultThreadSlowmode
Description copied from interface:ChannelAction
Sets the slowmode value, which limits the amount of time that individual users must wait between sending messages in the new channel. This is measured in seconds.
This is applied to newly created threads by default.Note: Bots are unaffected by this.
HavingMESSAGE_MANAGE
orMANAGE_CHANNEL
permission also grants immunity to slowmode.- Specified by:
setDefaultThreadSlowmode
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
slowmode
- The number of seconds required to wait between sending messages in the channel.- Returns:
- The current ChannelAction, for chaining convenience
-
setDefaultReaction
Description copied from interface:ChannelAction
Sets the default reaction emoji of the channel.
This does not support custom emoji from other guilds.- Specified by:
setDefaultReaction
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
emoji
- The new default reaction emoji, or null to unset.- Returns:
- The current ChannelAction, for chaining convenience
- See Also:
-
setDefaultLayout
Description copied from interface:ChannelAction
Sets the default layout of the newForumChannel
.- Specified by:
setDefaultLayout
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
layout
- The new default layout.- Returns:
- The current ChannelAction, for chaining convenience
- See Also:
-
setDefaultSortOrder
Description copied from interface:ChannelAction
Sets the default sort order of the channel.- Specified by:
setDefaultSortOrder
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
sortOrder
- The new default sort order.- Returns:
- The current ChannelAction, for chaining convenience
- See Also:
-
setAvailableTags
Description copied from interface:ChannelAction
Sets the available tags of the channel.
Tags will be ordered based on the provided list order.You can use
ForumTagData
to create new tags.- Specified by:
setAvailableTags
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
tags
- The new available tags in the desired order.- Returns:
- The current ChannelAction, for chaining convenience
- See Also:
-
addMemberPermissionOverride
@Nonnull @CheckReturnValue public ChannelActionImpl<T> addMemberPermissionOverride(long userId, long allow, long deny) Description copied from interface:ChannelAction
Adds a new MemberPermissionOverride
for the new GuildChannel.If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied.
Example:
long userId = user.getIdLong(); long allow = Permission.VIEW_CHANNEL.getRawValue(); long deny = Permission.MESSAGE_SEND.getRawValue() | Permission.MESSAGE_ADD_REACTION.getRawValue(); channelAction.addMemberPermissionOverride(userId, allow, deny);
- Specified by:
addMemberPermissionOverride
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
userId
- The id for the memberallow
- The grantedPermissions
for the override. UsePermission.getRawValue()
to retrieve these Permissions.deny
- The deniedPermissions
for the override. UsePermission.getRawValue()
to retrieve these Permissions.- Returns:
- The current ChannelAction, for chaining convenience
- See Also:
-
addRolePermissionOverride
@Nonnull @CheckReturnValue public ChannelActionImpl<T> addRolePermissionOverride(long roleId, long allow, long deny) Description copied from interface:ChannelAction
Adds a new RolePermissionOverride
for the new GuildChannel.If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied.
Example:
long roleId = role.getIdLong(); long allow = Permission.VIEW_CHANNEL.getRawValue(); long deny = Permission.MESSAGE_SEND.getRawValue() | Permission.MESSAGE_ADD_REACTION.getRawValue(); channelAction.addMemberPermissionOverride(roleId, allow, deny);
- Specified by:
addRolePermissionOverride
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
roleId
- The id for the roleallow
- The grantedPermissions
for the override. UsePermission.getRawValue()
to retrieve these Permissions.deny
- The deniedPermissions
for the override. UsePermission.getRawValue()
to retrieve these Permissions.- Returns:
- The current ChannelAction, for chaining convenience
- See Also:
-
removePermissionOverride
Description copied from interface:ChannelAction
Removes any existing override with the provided id.
If no override with the provided id exists, this method does nothing.- Specified by:
removePermissionOverride
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
id
- The member or role id of the override- Returns:
- The current ChannelAction, for chaining convenience
-
clearPermissionOverrides
Description copied from interface:ChannelAction
Removes all currently configured permission overrides- Specified by:
clearPermissionOverrides
in interfaceChannelAction<T extends GuildChannel>
- Returns:
- The current ChannelAction, for chaining convenience
-
syncPermissionOverrides
Description copied from interface:ChannelAction
Syncs the permission overrides of the channel with the category.If setting permission overwrites, only permissions your bot has in the guild can be allowed/denied. In order to properly sync permissions the currently logged in account must have all allowed/denied permissions or
Permission.MANAGE_ROLES
in the parent category.- Specified by:
syncPermissionOverrides
in interfaceChannelAction<T extends GuildChannel>
- Returns:
- The current ChannelAction, for chaining convenience
-
setBitrate
Description copied from interface:ChannelAction
Sets the bitrate for the new VoiceChannel- Specified by:
setBitrate
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
bitrate
- The bitrate for the new VoiceChannel inbps
(limits 8000 <= bitrate <=Guild.getMaxBitrate()
) ornull
to use the default 64kbps.- Returns:
- The current ChannelAction, for chaining convenience
-
setUserlimit
Description copied from interface:ChannelAction
Sets the userlimit for the newAudioChannel
.
The limit maximum varies by type.- Specified by:
setUserlimit
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
userlimit
- The userlimit for the new AudioChannel ornull
/0
to use no limit- Returns:
- The current ChannelAction, for chaining convenience
-
setRegion
Description copied from interface:ChannelAction
Sets the voice region for the new AudioChannel- Specified by:
setRegion
in interfaceChannelAction<T extends GuildChannel>
- Parameters:
region
- The region for the new AudioChannel, ornull
to set toRegion.AUTOMATIC
- Returns:
- The current ChannelAction, for chaining convenience
-