ISnowflake
Category
, TextChannel
, VoiceChannel
public interface Channel extends ISnowflake
Guild
channel.Modifier and Type | Method | Description |
---|---|---|
default ChannelAction |
createCopy() |
Creates a copy of the specified
Channel . |
ChannelAction |
createCopy(Guild guild) |
|
InviteAction |
createInvite() |
Creates a new
InviteAction which can be used to create a
new Invite . |
PermissionOverrideAction |
createPermissionOverride(Member member) |
Creates a
PermissionOverride
for the specified Member in this Channel. |
PermissionOverrideAction |
createPermissionOverride(Role role) |
Creates a
PermissionOverride
for the specified Role in this Channel. |
AuditableRestAction<java.lang.Void> |
delete() |
Deletes this Channel.
|
Guild |
getGuild() |
Returns the
Guild that this Channel is part of. |
RestAction<java.util.List<Invite>> |
getInvites() |
Returns all invites for this channel.
|
JDA |
getJDA() |
Returns the
JDA instance of this Channel |
ChannelManager |
getManager() |
Returns the
ChannelManager for this Channel. |
java.util.List<PermissionOverride> |
getMemberPermissionOverrides() |
|
java.util.List<Member> |
getMembers() |
A List of all
Members that are in this Channel
For TextChannels ,
this returns all Members with the Permission.MESSAGE_READ Permission. |
java.lang.String |
getName() |
The human readable name of the Channel.
|
Category |
getParent() |
Parent
Category of this
Channel. |
PermissionOverride |
getPermissionOverride(Member member) |
The
PermissionOverride relating to the specified Member . |
PermissionOverride |
getPermissionOverride(Role role) |
The
PermissionOverride relating to the specified Role . |
java.util.List<PermissionOverride> |
getPermissionOverrides() |
Gets all of the
PermissionOverrides that are part
of this Channel . |
int |
getPosition() |
The position this Channel is displayed at.
|
int |
getPositionRaw() |
The actual position of the
Channel as stored and given by Discord. |
java.util.List<PermissionOverride> |
getRolePermissionOverrides() |
|
ChannelType |
getType() |
The
ChannelType for this Channel |
PermissionOverrideAction |
putPermissionOverride(Member member) |
Creates a
PermissionOverride
for the specified Member in this Channel. |
PermissionOverrideAction |
putPermissionOverride(Role role) |
Creates a
PermissionOverride
for the specified Role in this Channel. |
getCreationTime, getId, getIdLong
ChannelType getType()
ChannelType
for this Channeljava.lang.String getName()
Guild getGuild()
Guild
that this Channel is part of.Guild
that this Channel is part of.Category getParent()
Category
of this
Channel. Channels need not have a parent Category.
Category
will
always return null
for this method as nested categories are not supported.Category
for this Channeljava.util.List<Member> getMembers()
Members
that are in this Channel
For TextChannels
,
this returns all Members with the Permission.MESSAGE_READ
Permission.
In VoiceChannels
,
this returns all Members that joined that VoiceChannel.Members
that are in this Channel.int getPosition()
Guild
do not have to have continuous positionsint getPositionRaw()
Channel
as stored and given by Discord.
Role positions are actually based on a pairing of the creation time (as stored in the snowflake id)
and the position. If 2 or more roles share the same position then they are sorted based on their creation date.
The more recent a role was created, the lower it is in the hierarchy. This is handled by getPosition()
and it is most likely the method you want. If, for some reason, you want the actual position of the
Role then this method will give you that value.Channel
.JDA getJDA()
JDA
instance of this ChannelPermissionOverride getPermissionOverride(Member member)
PermissionOverride
relating to the specified Member
.
If there is no PermissionOverride
for this Channel
relating to the provided Member
, then this returns null
.member
- The Member
whose
PermissionOverride
is requested.PermissionOverride
relating to the provided Member
.PermissionOverride getPermissionOverride(Role role)
PermissionOverride
relating to the specified Role
.
If there is no PermissionOverride
for this Channel
relating to the provided Role
, then this returns null
.role
- The Role
whose PermissionOverride
is requested.PermissionOverride
relating to the provided Role
.java.util.List<PermissionOverride> getPermissionOverrides()
PermissionOverrides
that are part
of this Channel
.
Member
and Role
overrides.
If you would like only Member
overrides or only Role
overrides, use getMemberPermissionOverrides()
or getRolePermissionOverrides()
respectively.PermissionOverrides
for this Channel
.java.util.List<PermissionOverride> getMemberPermissionOverrides()
PermissionOverrides
for Member
for this Channel
.java.util.List<PermissionOverride> getRolePermissionOverrides()
PermissionOverrides
for Roles
for this Channel
.@CheckReturnValue ChannelAction createCopy(Guild guild)
Channel
in the specified Guild
.
This copies the following elements:
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
guild
- The Guild
to create the channel inChannelAction
java.lang.IllegalArgumentException
- If the provided guild is null
PermissionException
- If the currently logged in account does not have the MANAGE_CHANNEL
Permission@CheckReturnValue default ChannelAction createCopy()
Channel
.
This copies the following elements:
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
ChannelAction
PermissionException
- If the currently logged in account does not have the MANAGE_CHANNEL
PermissionChannelManager getManager()
ChannelManager
for this Channel.
RestAction.queue()
.InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_CHANNEL
@CheckReturnValue AuditableRestAction<java.lang.Void> delete()
Possible ErrorResponses include:
UNKNOWN_CHANNEL
MISSING_PERMISSIONS
Permission.MANAGE_CHANNEL
in the channel.MISSING_ACCESS
AuditableRestAction
InsufficientPermissionException
- if the currently logged in account doesn't have MANAGE_CHANNEL
for the channel.@CheckReturnValue PermissionOverrideAction createPermissionOverride(Member member)
PermissionOverride
for the specified Member
in this Channel.
You can use putPermissionOverride(Member)
to replace existing overrides.
Possible ErrorResponses include:
UNKNOWN_CHANNEL
MISSING_ACCESS
member
- The Member to create an override forPermissionOverrideAction
Provides the newly created PermissionOverride for the specified RoleInsufficientPermissionException
- if we don't have the permission to MANAGE_PERMISSIONS
java.lang.IllegalArgumentException
- if the specified Member is null or the Member is not from getGuild()
java.lang.IllegalStateException
- If the specified Member already has a PermissionOverride. Use getPermissionOverride(Member)
to retrieve it.
You can use putPermissionOverride(Member)
to replace existing overrides.createPermissionOverride(Role)
,
putPermissionOverride(Member)
@CheckReturnValue PermissionOverrideAction createPermissionOverride(Role role)
PermissionOverride
for the specified Role
in this Channel.
You can use putPermissionOverride(Role)
to replace existing overrides.
Possible ErrorResponses include:
UNKNOWN_CHANNEL
MISSING_ACCESS
role
- The Role to create an override forPermissionOverrideAction
Provides the newly created PermissionOverride for the specified RoleInsufficientPermissionException
- if we don't have the permission to MANAGE_PERMISSIONS
java.lang.IllegalArgumentException
- if the specified Role is null or the Role is not from getGuild()
java.lang.IllegalStateException
- If the specified Role already has a PermissionOverride. Use getPermissionOverride(Role)
to retrieve it.
You can use putPermissionOverride(Role)
to replace existing overrides.createPermissionOverride(Member)
,
putPermissionOverride(Role)
@CheckReturnValue PermissionOverrideAction putPermissionOverride(Member member)
PermissionOverride
for the specified Member
in this Channel.
member
- The Member to create the override forPermissionOverrideAction
Provides the newly created PermissionOverride for the specified MemberInsufficientPermissionException
- if we don't have the permission to MANAGE_PERMISSIONS
java.lang.IllegalArgumentException
- If the provided member is null or from a different guildputPermissionOverride(Role)
@CheckReturnValue PermissionOverrideAction putPermissionOverride(Role role)
PermissionOverride
for the specified Role
in this Channel.
role
- The Role to create the override forPermissionOverrideAction
Provides the newly created PermissionOverride for the specified RoleInsufficientPermissionException
- if we don't have the permission to MANAGE_PERMISSIONS
java.lang.IllegalArgumentException
- If the provided role is null or from a different guildputPermissionOverride(Member)
@CheckReturnValue InviteAction createInvite()
InviteAction
which can be used to create a
new Invite
.
CREATE_INSTANT_INVITE
in this channel.InviteAction
InsufficientPermissionException
- If the account does not have CREATE_INSTANT_INVITE
in this channeljava.lang.IllegalArgumentException
- If this is an instance of a Category
InviteAction
@CheckReturnValue RestAction<java.util.List<Invite>> getInvites()
MANAGE_CHANNEL
in this channel.
Will throw a InsufficientPermissionException
otherwise.RestAction
- Type: List<Invite
>
InsufficientPermissionException
- if the account does not have MANAGE_CHANNEL
in this channelGuild.getInvites()