public class ChannelManagerUpdatable
extends java.lang.Object
updatable
manager that allows
to modify channel settings like the name
or for TextChannels
or the topic
.
This manager allows to modify multiple fields at once
by getting the ChannelFields
for specific
properties and setting or resetting their values; followed by a call of update()
!
The ChannelManager
implementation
simplifies this process by giving simple setters that return the update
RestAction
Note: To update
this manager
the currently logged in account requires the Permission MANAGE_CHANNEL
Constructor and Description |
---|
ChannelManagerUpdatable(Channel channel)
Creates a new ChannelManagerUpdatable instance
|
Modifier and Type | Method and Description |
---|---|
ChannelField<java.lang.Integer> |
getBitrateField()
An
ChannelField
for the bitrate of the selected Channel . |
Channel |
getChannel()
The
Channel that will
be modified by this Manager instance |
Guild |
getGuild()
|
JDA |
getJDA()
The
JDA instance of this Manager |
ChannelField<java.lang.String> |
getNameField()
An
ChannelField
for the name of the selected Channel . |
ChannelField<java.lang.Boolean> |
getNSFWField()
An
ChannelField
for the nsfw flag of the selected Channel . |
ChannelField<java.lang.String> |
getTopicField()
An
ChannelField
for the topic of the selected Channel . |
ChannelField<java.lang.Integer> |
getUserLimitField()
An
ChannelField
for the user-limit of the selected Channel . |
void |
reset()
Resets all
Fields
for this manager instance by calling Field.reset() sequentially
This is automatically called by update() |
AuditableRestAction<java.lang.Void> |
update()
Creates a new
RestAction instance
that will apply all changes that have been made to this manager instance. |
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
public ChannelField<java.lang.String> getNameField()
ChannelField
for the name of the selected Channel
.
To set the value use setValue(String)
on the returned ChannelField
instance.
A channel name must not be null
nor less than 2 characters or more than 100 characters long!
Otherwise Field.setValue(...)
will
throw an IllegalArgumentException
.
ChannelField
- Type: String
public ChannelField<java.lang.String> getTopicField()
ChannelField
for the topic of the selected Channel
.
To set the value use setValue(String)
on the returned ChannelField
instance.
A channel topic must not be more than 1024
characters long!
Otherwise Field.setValue(...)
will
throw an IllegalArgumentException
.
This is only available to TextChannels
ChannelField
- Type: String
java.lang.UnsupportedOperationException
- If the selected Channel
's type is not TEXT
public ChannelField<java.lang.Integer> getUserLimitField()
ChannelField
for the user-limit of the selected Channel
.
To set the value use setValue(Integer)
on the returned ChannelField
instance.
A channel user-limit must not be negative nor greater than 99
!
Otherwise Field.setValue(...)
will
throw an IllegalArgumentException
.
This is only available to VoiceChannels
ChannelField
- Type: Integer
java.lang.UnsupportedOperationException
- If the selected Channel
's type is not VOICE
public ChannelField<java.lang.Boolean> getNSFWField()
ChannelField
for the nsfw flag of the selected Channel
.
To set the value use setValue(Boolean)
on the returned ChannelField
instance.
This is only available to TextChannels
ChannelField
- Type: boolean
java.lang.UnsupportedOperationException
- If the selected Channel
's type is not TEXT
public ChannelField<java.lang.Integer> getBitrateField()
ChannelField
for the bitrate of the selected Channel
.
To set the value use setValue(Integer)
on the returned ChannelField
instance.
A channel bitrate must not be less than 8000
and cannot exceed 96000
(for non-vip Guilds)!
Otherwise Field.setValue(...)
will
throw an IllegalArgumentException
.
This is only available to VoiceChannels
ChannelField
- Type: Integer
java.lang.UnsupportedOperationException
- If the selected Channel
's type is not VOICE
public void reset()
Fields
for this manager instance by calling Field.reset()
sequentially
update()
@CheckReturnValue public AuditableRestAction<java.lang.Void> update()
RestAction
instance
that will apply all changes that have been made to this manager instance.
EmptyRestAction
.
Before applying new changes it is recommended to call reset()
to reset previous changes.
This is automatically called if this method returns successfully.
Possible ErrorResponses
for this
update include the following:
UNKNOWN_CHANNEL
MISSING_ACCESS
MISSING_PERMISSIONS
MANAGE_CHANNEL Permission
before finishing the taskAuditableRestAction
InsufficientPermissionException
- If the currently logged in account does not have the Permission MANAGE_CHANNEL
in the underlying Channel
.