public class ChannelAction extends AuditableRestAction<Channel>
RestAction
specifically
designed to create a Channel
.
This extension allows setting properties before executing the action.AuditableRestAction.EmptyRestAction<T>
DEFAULT_FAILURE, DEFAULT_SUCCESS, LOG
Constructor | Description |
---|---|
ChannelAction(net.dv8tion.jda.core.requests.Route.CompiledRoute route,
java.lang.String name,
Guild guild,
ChannelType type) |
Creates a new ChannelAction instance
|
Modifier and Type | Method | Description |
---|---|---|
ChannelAction |
addPermissionOverride(IPermissionHolder target,
long allow,
long deny) |
Adds a new Role or Member
PermissionOverride
for the new Channel. |
ChannelAction |
addPermissionOverride(IPermissionHolder target,
java.util.Collection<Permission> allow,
java.util.Collection<Permission> deny) |
Adds a new Role or Member
PermissionOverride
for the new Channel. |
ChannelAction |
setBitrate(java.lang.Integer bitrate) |
Sets the bitrate for the new VoiceChannel
|
ChannelAction |
setCheck(java.util.function.BooleanSupplier checks) |
Sets the last-second checks before finally executing the http request in the queue.
|
ChannelAction |
setName(java.lang.String name) |
Sets the name for the new Channel
|
ChannelAction |
setNSFW(boolean nsfw) |
Sets the NSFW flag for the new TextChannel
|
ChannelAction |
setParent(Category category) |
Sets the
Category for the new Channel |
ChannelAction |
setSlowmode(int slowmode) |
Sets the slowmode value, which limits the amount of time that individual users must wait
between sending messages in the new TextChannel.
|
ChannelAction |
setTopic(java.lang.String topic) |
Sets the topic for the new TextChannel
|
ChannelAction |
setUserlimit(java.lang.Integer userlimit) |
Sets the userlimit for the new VoiceChannel
|
reason
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
complete, complete, completeAfter, getJDA, isPassContext, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, setPassContext, submit, submit, submitAfter, submitAfter
public ChannelAction(net.dv8tion.jda.core.requests.Route.CompiledRoute route, java.lang.String name, Guild guild, ChannelType type)
public ChannelAction setCheck(java.util.function.BooleanSupplier checks)
RestAction
false
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.setCheck
in class AuditableRestAction<Channel>
checks
- The checks to run before executing the request, or null
to run no checks@CheckReturnValue public ChannelAction setName(java.lang.String name)
name
- The not-null name for the new Channel (1-100 chars long)java.lang.IllegalArgumentException
- If the provided name is null or not between 1-100 chars long@CheckReturnValue public ChannelAction setParent(Category category)
Category
for the new Channelcategory
- The parent for the new Channeljava.lang.UnsupportedOperationException
- If this ChannelAction is for a Categoryjava.lang.IllegalArgumentException
- If the provided category is null
or not from this Guild@CheckReturnValue public ChannelAction setTopic(java.lang.String topic)
topic
- The topic for the new Channel (max 1024 chars)java.lang.UnsupportedOperationException
- If this ChannelAction is not for a TextChanneljava.lang.IllegalArgumentException
- If the provided topic is longer than 1024 chars@CheckReturnValue public ChannelAction setNSFW(boolean nsfw)
nsfw
- The NSFW flag for the new Channeljava.lang.UnsupportedOperationException
- If this ChannelAction is not for a TextChannel@CheckReturnValue public ChannelAction setSlowmode(int slowmode)
Note that only CLIENT
type accounts are
affected by slowmode, and that BOT
accounts
are immune to the restrictions.
Having MESSAGE_MANAGE
or
MANAGE_CHANNEL
permission also
grants immunity to slowmode.
slowmode
- The number of seconds required to wait between sending messages in the channel.java.lang.IllegalArgumentException
- If the slowmode
is greater than 120, or less than 0@CheckReturnValue public ChannelAction addPermissionOverride(IPermissionHolder target, java.util.Collection<Permission> allow, java.util.Collection<Permission> deny)
PermissionOverride
for the new Channel.
Example:
Role role = guild.getPublicRole();
EnumSet<Permission> allow = EnumSet.of(Permission.MESSAGE_READ);
EnumSet<Permission> deny = EnumSet.of(Permission.MESSAGE_WRITE);
channelAction.addPermissionOverride(role, allow, deny);
target
- The not-null Role
or Member
for the overrideallow
- The granted Permissions
for the override or nulldeny
- The denied Permissions
for the override or nulljava.lang.IllegalArgumentException
- If the specified target is null or not within the same guild.EnumSet
@CheckReturnValue public ChannelAction addPermissionOverride(IPermissionHolder target, long allow, long deny)
PermissionOverride
for the new Channel.
Example:
Role role = guild.getPublicRole();
long allow = Permission.MESSAGE_READ.getRawValue();
long deny = Permission.MESSAGE_WRITE.getRawValue() | Permission.MESSAGE_ADD_REACTION.getRawValue();
channelAction.addPermissionOverride(role, allow, deny);
target
- The not-null Role
or Member
for the overrideallow
- The granted Permissions
for the override
Use Permission.getRawValue()
to retrieve these Permissions.deny
- The denied Permissions
for the override
Use Permission.getRawValue()
to retrieve these Permissions.java.lang.IllegalArgumentException
- Permission.getRawValue()
,
Permission.getRaw(java.util.Collection)
,
Permission.getRaw(net.dv8tion.jda.core.Permission...)
@CheckReturnValue public ChannelAction setBitrate(java.lang.Integer bitrate)
bitrate
- The bitrate for the new Channel (min 8000
; max 96000
/128000
(for VIP Guilds
)) or null to use default (64000
)java.lang.UnsupportedOperationException
- If this ChannelAction is not for a VoiceChanneljava.lang.IllegalArgumentException
- If the provided bitrate is less than 8000 or greater than 128000@CheckReturnValue public ChannelAction setUserlimit(java.lang.Integer userlimit)
userlimit
- The userlimit for the new VoiceChannel or null
/0
to use no limit,java.lang.UnsupportedOperationException
- If this ChannelAction is not for a VoiceChanneljava.lang.IllegalArgumentException
- If the provided userlimit is negative or above 99