public class ChannelManager
extends net.dv8tion.jda.core.managers.impl.ManagerBase
Guild Channel
.
Example
manager.setName("github-log")
.setTopic("logs for github commits")
.setNSFW(false)
.queue();
manager.reset(ChannelManager.TOPIC | ChannelManager.NAME)
.setName("nsfw-commits")
.setTopic(null)
.setNSFW(true)
.queue();
Channel.getManager()
AuditableRestAction.EmptyRestAction<T>
Modifier and Type | Field | Description |
---|---|---|
static long |
BITRATE |
Used to reset the bitrate field
|
static long |
NAME |
Used to reset the name field
|
static long |
NSFW |
Used to reset the nsfw field
|
static long |
PARENT |
Used to reset the parent field
|
static long |
PERMISSION |
Used to reset the permission field
|
static long |
POSITION |
Used to reset the position field
|
static long |
SLOWMODE |
Used to reset the rate-limit per user field
|
static long |
TOPIC |
Used to reset the topic field
|
static long |
USERLIMIT |
Used to reset the userlimit field
|
DEFAULT_FAILURE, DEFAULT_SUCCESS, LOG
Constructor | Description |
---|---|
ChannelManager(Channel channel) |
Creates a new ChannelManager instance
|
Modifier and Type | Method | Description |
---|---|---|
ChannelManager |
clearOverridesAdded() |
Clears the overrides added via
putPermissionOverride(IPermissionHolder, Collection, Collection) . |
ChannelManager |
clearOverridesRemoved() |
Clears the overrides removed via
removePermissionOverride(IPermissionHolder) . |
Channel |
getChannel() |
The
Channel that will
be modified by this Manager instance |
Guild |
getGuild() |
|
ChannelType |
getType() |
The
ChannelType |
ChannelManager |
putPermissionOverride(IPermissionHolder permHolder,
long allow,
long deny) |
Adds an override for the specified
IPermissionHolder
with the provided raw bitmasks as allowed and denied permissions. |
ChannelManager |
putPermissionOverride(IPermissionHolder permHolder,
java.util.Collection<Permission> allow,
java.util.Collection<Permission> deny) |
Adds an override for the specified
IPermissionHolder
with the provided permission sets as allowed and denied permissions. |
ChannelManager |
removePermissionOverride(IPermissionHolder permHolder) |
Removes the
PermissionOverride for the specified
IPermissionHolder . |
ChannelManager |
reset() |
Resets all fields for this manager.
|
ChannelManager |
reset(long fields) |
Resets the fields specified by the provided bit-flag pattern.
|
ChannelManager |
reset(long... fields) |
Resets the fields specified by the provided bit-flag patterns.
|
ChannelManager |
setBitrate(int bitrate) |
Sets the bitrate of the selected
VoiceChannel . |
ChannelManager |
setName(java.lang.String name) |
Sets the name of the selected
Channel . |
ChannelManager |
setNSFW(boolean nsfw) |
Sets the nsfw flag of the selected
TextChannel . |
ChannelManager |
setParent(Category category) |
Sets the
Parent Category
of the selected Channel . |
ChannelManager |
setPosition(int position) |
Sets the position of the selected
Channel . |
ChannelManager |
setSlowmode(int slowmode) |
Sets the slowmode of the selected
TextChannel . |
ChannelManager |
setTopic(java.lang.String topic) |
Sets the topic of the selected
TextChannel . |
ChannelManager |
setUserLimit(int userLimit) |
Sets the user-limit of the selected
VoiceChannel . |
ChannelManager |
sync() |
Syncs all
PermissionOverrides of this Channel with
its parent (Category ). |
ChannelManager |
sync(Channel syncSource) |
Syncs all
PermissionOverrides of this Channel with
the given (Channel ). |
reason, setCheck
complete, isPermissionChecksEnabled, queue, setPermissionChecksEnabled
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
complete, completeAfter, getJDA, isPassContext, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, setPassContext, submit, submit, submitAfter, submitAfter
public static final long NAME
public static final long PARENT
public static final long TOPIC
public static final long POSITION
public static final long NSFW
public static final long USERLIMIT
public static final long BITRATE
public static final long PERMISSION
public static final long SLOWMODE
public ChannelManager(Channel channel)
channel
- Channel
that should be modified
Voice
- or TextChannel
public ChannelType getType()
ChannelType
public Channel getChannel()
Channel
that will
be modified by this Manager instanceChannel
public Guild getGuild()
Guild
this Manager's
Channel
is in.
getChannel().getGuild()
Guild
@CheckReturnValue public ChannelManager reset(long fields)
manager.reset(ChannelManager.NAME | ChannelManager.PARENT);
Flag Constants:
reset
in class net.dv8tion.jda.core.managers.impl.ManagerBase
fields
- Integer value containing the flags to reset.@CheckReturnValue public ChannelManager reset(long... fields)
manager.reset(ChannelManager.NAME, ChannelManager.PARENT);
Flag Constants:
reset
in class net.dv8tion.jda.core.managers.impl.ManagerBase
fields
- Integer values containing the flags to reset.@CheckReturnValue public ChannelManager reset()
reset
in class net.dv8tion.jda.core.managers.impl.ManagerBase
public ChannelManager clearOverridesAdded()
putPermissionOverride(IPermissionHolder, Collection, Collection)
.public ChannelManager clearOverridesRemoved()
removePermissionOverride(IPermissionHolder)
.@CheckReturnValue public ChannelManager putPermissionOverride(IPermissionHolder permHolder, long allow, long deny)
IPermissionHolder
with the provided raw bitmasks as allowed and denied permissions. If the permission holder already
had an override on this channel it will be updated instead.permHolder
- The permission holderallow
- The bitmask to grantdeny
- The bitmask to denyjava.lang.IllegalArgumentException
- If the provided permission holder is null
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_PERMISSIONS
in this channelputPermissionOverride(IPermissionHolder, Collection, Collection)
,
Permission.getRaw(Permission...)
@CheckReturnValue public ChannelManager putPermissionOverride(IPermissionHolder permHolder, java.util.Collection<Permission> allow, java.util.Collection<Permission> deny)
IPermissionHolder
with the provided permission sets as allowed and denied permissions. If the permission holder already
had an override on this channel it will be updated instead.
putPermissionOverride(guild.getSelfMember(), EnumSet.of(Permission.MESSAGE_WRITE, Permission.MESSAGE_READ), null)
permHolder
- The permission holderallow
- The permissions to grant, or nulldeny
- The permissions to deny, or nulljava.lang.IllegalArgumentException
- If the provided permission holder is null
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_PERMISSIONS
in this channelputPermissionOverride(IPermissionHolder, long, long)
,
EnumSet
@CheckReturnValue public ChannelManager removePermissionOverride(IPermissionHolder permHolder)
PermissionOverride
for the specified
IPermissionHolder
. If no override existed for this member
this does nothing.permHolder
- The permission holderjava.lang.IllegalArgumentException
- If the provided permission holder is null
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_PERMISSIONS
in this channel@CheckReturnValue public ChannelManager sync()
PermissionOverrides
of this Channel with
its parent (Category
).
After this operation, all PermissionOverrides
will be exactly the same as the ones from the parent.
That means that all current PermissionOverrides are lost!
This behaves as if calling sync(Channel)
with this Channel's Parent
.
java.lang.IllegalStateException
- If this Channel has no parentInsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_PERMISSIONS
in this channel@CheckReturnValue public ChannelManager sync(Channel syncSource)
PermissionOverrides
of this Channel with
the given (Channel
).
After this operation, all PermissionOverrides
will be exactly the same as the ones from the syncSource.
That means that all current PermissionOverrides are lost!
This will only work for Channels of the same Guild
!.
syncSource
- The Channel from where all PermissionOverrides should be copied fromjava.lang.IllegalArgumentException
- If the given snySource is null
, this Channel or from a different Guild.InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_PERMISSIONS
in this channel@CheckReturnValue public ChannelManager setName(java.lang.String name)
Channel
.
A channel name must not be null
nor empty or more than 100 characters long!
TextChannel names may only be populated with alphanumeric (with underscore and dash).
Example: mod-only
or generic_name
Characters will automatically be lowercased by Discord for text channels!
name
- The new name for the selected Channel
java.lang.IllegalArgumentException
- If the provided name is null
or not between 1-100 characters long@CheckReturnValue public ChannelManager setParent(Category category)
Parent Category
of the selected Channel
.category
- The new parent for the selected Channel
java.lang.IllegalStateException
- If the target is a category itselfjava.lang.IllegalArgumentException
- If the provided category is not from the same Guild@CheckReturnValue public ChannelManager setPosition(int position)
Channel
.
To modify multiple channels you should use
Guild.
instead! This is not the same as looping through channels and using this to update positions!getController()
.modifyTextChannelPositions()
position
- The new position for the selected Channel
@CheckReturnValue public ChannelManager setTopic(java.lang.String topic)
TextChannel
.
A channel topic must not be more than 1024
characters long!
This is only available to TextChannels
topic
- The new topic for the selected TextChannel
,
null
or empty String to resetjava.lang.UnsupportedOperationException
- If the selected Channel
's type is not TEXT
java.lang.IllegalArgumentException
- If the provided topic is greater than 1024
in length@CheckReturnValue public ChannelManager setNSFW(boolean nsfw)
TextChannel
.nsfw
- The new nsfw flag for the selected TextChannel
,InsufficientPermissionException
- If the currently logged in account does not have the Permission MANAGE_CHANNEL
java.lang.IllegalStateException
- If the selected Channel
's type is not TEXT
@CheckReturnValue public ChannelManager setSlowmode(int slowmode)
TextChannel
.
0
to reset the slowmode of the TextChannel
A channel slowmode must not be negative nor greater than 120
!
This is only available to TextChannels
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 new slowmode for the selected TextChannel
java.lang.IllegalStateException
- If the selected Channel
's type is not TEXT
java.lang.IllegalArgumentException
- If the provided slowmode is negative or greater than 120
@CheckReturnValue public ChannelManager setUserLimit(int userLimit)
VoiceChannel
.
0
to reset the user-limit of the VoiceChannel
A channel user-limit must not be negative nor greater than 99
!
This is only available to VoiceChannels
userLimit
- The new user-limit for the selected VoiceChannel
java.lang.IllegalStateException
- If the selected Channel
's type is not VOICE
java.lang.IllegalArgumentException
- If the provided user-limit is negative or greater than 99
@CheckReturnValue public ChannelManager setBitrate(int bitrate)
VoiceChannel
.
64000
A channel bitrate must not be less than 8000
nor greater than 96000
(for non-vip Guilds)!
VIP Guilds
allow a bitrate for up to 128000
.
This is only available to VoiceChannels
bitrate
- The new bitrate for the selected VoiceChannel
java.lang.IllegalStateException
- If the selected Channel
's type is not VOICE
java.lang.IllegalArgumentException
- If the provided bitrate is not between 8000-96000 (or 128000 for VIP Guilds)Guild.getFeatures()