Class GuildAction.ChannelData
- java.lang.Object
-
- net.dv8tion.jda.api.requests.restaction.GuildAction.ChannelData
-
- All Implemented Interfaces:
SerializableData
- Enclosing interface:
- GuildAction
public static class GuildAction.ChannelData extends java.lang.Object implements SerializableData
GuildChannel information used for the creation ofChannels
within the construction of aGuild
via GuildAction.Use with
GuildAction.addChannel(ChannelData)
.
-
-
Constructor Summary
Constructors Constructor Description ChannelData(ChannelType type, java.lang.String name)
Constructs a data object containing information on aGuildChannel
to be used in the construction of aGuild
!
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GuildAction.ChannelData
addPermissionOverride(GuildAction.RoleData role, long allow, long deny)
Adds aPermissionOverride
to this channel with the providedRoleData
!
UseGuildAction.newRole()
to retrieve an instance of RoleData.GuildAction.ChannelData
addPermissionOverride(GuildAction.RoleData role, java.util.Collection<Permission> allow, java.util.Collection<Permission> deny)
Adds aPermissionOverride
to this channel with the providedRoleData
!
UseGuildAction.newRole()
to retrieve an instance of RoleData.GuildAction.ChannelData
setBitrate(java.lang.Integer bitrate)
Sets the bitrate for this channel.GuildAction.ChannelData
setNSFW(java.lang.Boolean nsfw)
Sets the whether this channel should be marked NSFW.GuildAction.ChannelData
setPosition(java.lang.Integer position)
Sets the position for this channel.GuildAction.ChannelData
setTopic(java.lang.String topic)
Sets the topic for this channel.GuildAction.ChannelData
setUserlimit(java.lang.Integer userlimit)
Sets the userlimit for this channel.DataObject
toData()
SerializedDataObject
for this object.
-
-
-
Constructor Detail
-
ChannelData
public ChannelData(ChannelType type, java.lang.String name)
Constructs a data object containing information on aGuildChannel
to be used in the construction of aGuild
!- Parameters:
type
- TheChannelType
of the resulting GuildChannel
This may be of typeTEXT
orVOICE
!name
- The name of the channel. This must be alphanumeric with underscores for type TEXT- Throws:
java.lang.IllegalArgumentException
-- If provided with an invalid ChannelType
- If the provided name is
null
or blank - If the provided name is not between 2-100 characters long
- If the type is TEXT and the provided name is not alphanumeric with underscores
-
-
Method Detail
-
setTopic
@Nonnull public GuildAction.ChannelData setTopic(@Nullable java.lang.String topic)
Sets the topic for this channel.
These are only relevant to channels of typeTEXT
.- Parameters:
topic
- The topic for the channel- Returns:
- This ChannelData instance for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided topic is bigger than 1024 characters
-
setNSFW
@Nonnull public GuildAction.ChannelData setNSFW(@Nullable java.lang.Boolean nsfw)
Sets the whether this channel should be marked NSFW.
These are only relevant to channels of typeTEXT
.- Parameters:
nsfw
- Whether this channel should be marked NSFW- Returns:
- This ChannelData instance for chaining convenience
-
setBitrate
@Nonnull public GuildAction.ChannelData setBitrate(@Nullable java.lang.Integer bitrate)
Sets the bitrate for this channel.
These are only relevant to channels of typeVOICE
.- Parameters:
bitrate
- The bitrate for the channel (8000-96000)- Returns:
- This ChannelData instance for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided bitrate is not between 8000-96000
-
setUserlimit
@Nonnull public GuildAction.ChannelData setUserlimit(@Nullable java.lang.Integer userlimit)
Sets the userlimit for this channel.
These are only relevant to channels of typeVOICE
.- Parameters:
userlimit
- The userlimit for the channel (0-99)- Returns:
- This ChannelData instance for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided userlimit is not between 0-99
-
setPosition
@Nonnull public GuildAction.ChannelData setPosition(@Nullable java.lang.Integer position)
Sets the position for this channel.- Parameters:
position
- The position for the channel- Returns:
- This ChannelData instance for chaining convenience
-
addPermissionOverride
@Nonnull public GuildAction.ChannelData addPermissionOverride(@Nonnull GuildAction.RoleData role, long allow, long deny)
Adds aPermissionOverride
to this channel with the providedRoleData
!
UseGuildAction.newRole()
to retrieve an instance of RoleData.- Parameters:
role
- The target roleallow
- The permissions to grant in the overridedeny
- The permissions to deny in the override- Returns:
- This ChannelData instance for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided role isnull
-
addPermissionOverride
@Nonnull public GuildAction.ChannelData addPermissionOverride(@Nonnull GuildAction.RoleData role, @Nullable java.util.Collection<Permission> allow, @Nullable java.util.Collection<Permission> deny)
Adds aPermissionOverride
to this channel with the providedRoleData
!
UseGuildAction.newRole()
to retrieve an instance of RoleData.- Parameters:
role
- The target roleallow
- The permissions to grant in the overridedeny
- The permissions to deny in the override- Returns:
- This ChannelData instance for chaining convenience
- Throws:
java.lang.IllegalArgumentException
-- If the provided role is
null
- If any permission is
null
- If the provided role is
-
toData
@Nonnull public DataObject toData()
Description copied from interface:SerializableData
SerializedDataObject
for this object.- Specified by:
toData
in interfaceSerializableData
- Returns:
DataObject
-
-