public class GuildController
extends java.lang.Object
Constructor | Description |
---|---|
GuildController(Guild guild) |
Creates a new GuildController instance
for the specified Guild instance
|
Modifier and Type | Method | Description |
---|---|---|
AuditableRestAction<java.lang.Void> |
addRolesToMember(Member member,
java.util.Collection<Role> roles) |
|
AuditableRestAction<java.lang.Void> |
addRolesToMember(Member member,
Role... roles) |
|
AuditableRestAction<java.lang.Void> |
addSingleRoleToMember(Member member,
Role role) |
|
AuditableRestAction<java.lang.Void> |
ban(java.lang.String userId,
int delDays) |
Bans the a user specified by the userId and deletes messages sent by the user
based on the amount of delDays.
|
AuditableRestAction<java.lang.Void> |
ban(java.lang.String userId,
int delDays,
java.lang.String reason) |
Bans the a user specified by the userId and deletes messages sent by the user
based on the amount of delDays.
|
AuditableRestAction<java.lang.Void> |
ban(Member member,
int delDays) |
Bans a
Member and deletes messages sent by the user
based on the amount of delDays. |
AuditableRestAction<java.lang.Void> |
ban(Member member,
int delDays,
java.lang.String reason) |
Bans a
Member and deletes messages sent by the user
based on the amount of delDays. |
AuditableRestAction<java.lang.Void> |
ban(User user,
int delDays) |
Bans a
Member and deletes messages sent by the user
based on the amount of delDays. |
AuditableRestAction<java.lang.Void> |
ban(User user,
int delDays,
java.lang.String reason) |
Bans a
User and deletes messages sent by the user
based on the amount of delDays. |
ChannelAction |
createCategory(java.lang.String name) |
Creates a new
Category in this Guild. |
ChannelAction |
createCopyOfChannel(Channel channel) |
|
RoleAction |
createCopyOfRole(Role role) |
|
AuditableRestAction<Emote> |
createEmote(java.lang.String name,
Icon icon,
Role... roles) |
Creates a new
Emote in this Guild. |
RoleAction |
createRole() |
Creates a new
Role in this Guild. |
ChannelAction |
createTextChannel(java.lang.String name) |
Creates a new
TextChannel in this Guild. |
ChannelAction |
createVoiceChannel(java.lang.String name) |
Creates a new
VoiceChannel in this Guild. |
Guild |
getGuild() |
The underlying
Guild instance |
JDA |
getJDA() |
The
JDA instance of this GuildController |
AuditableRestAction<java.lang.Void> |
kick(java.lang.String userId) |
|
AuditableRestAction<java.lang.Void> |
kick(java.lang.String userId,
java.lang.String reason) |
|
AuditableRestAction<java.lang.Void> |
kick(Member member) |
|
AuditableRestAction<java.lang.Void> |
kick(Member member,
java.lang.String reason) |
|
ChannelOrderAction<Category> |
modifyCategoryPositions() |
Modifies the positional order of
Guild.getCategories()
using a specific RestAction extension to allow moving Channels
up /down
or to a specific position. |
AuditableRestAction<java.lang.Void> |
modifyMemberRoles(Member member,
java.util.Collection<Role> roles) |
|
AuditableRestAction<java.lang.Void> |
modifyMemberRoles(Member member,
java.util.Collection<Role> rolesToAdd,
java.util.Collection<Role> rolesToRemove) |
|
AuditableRestAction<java.lang.Void> |
modifyMemberRoles(Member member,
Role... roles) |
|
RoleOrderAction |
modifyRolePositions() |
Modifies the positional order of
Guild.getRoles()
using a specific RestAction extension to allow moving Roles
up /down
or to a specific position. |
RoleOrderAction |
modifyRolePositions(boolean useDiscordOrder) |
Modifies the positional order of
Guild.getRoles()
using a specific RestAction extension to allow moving Roles
up /down
or to a specific position. |
ChannelOrderAction<TextChannel> |
modifyTextChannelPositions() |
Modifies the positional order of
Guild.getTextChannels()
using a specific RestAction extension to allow moving Channels
up /down
or to a specific position. |
CategoryOrderAction<TextChannel> |
modifyTextChannelPositions(Category category) |
Modifies the positional order of
Category#getTextChannels()
using an extension of ChannelOrderAction
specialized for ordering the nested TextChannels of this
Category . |
ChannelOrderAction<VoiceChannel> |
modifyVoiceChannelPositions() |
Modifies the positional order of
Guild.getVoiceChannels()
using a specific RestAction extension to allow moving Channels
up /down
or to a specific position. |
CategoryOrderAction<VoiceChannel> |
modifyVoiceChannelPositions(Category category) |
Modifies the positional order of
Category#getVoiceChannels()
using an extension of ChannelOrderAction
specialized for ordering the nested VoiceChannels of this
Category . |
RestAction<java.lang.Void> |
moveVoiceMember(Member member,
VoiceChannel voiceChannel) |
|
AuditableRestAction<java.lang.Integer> |
prune(int days) |
This method will prune (kick) all members who were offline for at least days days.
|
AuditableRestAction<java.lang.Void> |
removeRolesFromMember(Member member,
java.util.Collection<Role> roles) |
|
AuditableRestAction<java.lang.Void> |
removeRolesFromMember(Member member,
Role... roles) |
|
AuditableRestAction<java.lang.Void> |
removeSingleRoleFromMember(Member member,
Role role) |
|
AuditableRestAction<java.lang.Void> |
setDeafen(Member member,
boolean deafen) |
Sets the Guild Deafened state state of the
Member based on the provided
boolean. |
AuditableRestAction<java.lang.Void> |
setMute(Member member,
boolean mute) |
Sets the Guild Muted state state of the
Member based on the provided
boolean. |
AuditableRestAction<java.lang.Void> |
setNickname(Member member,
java.lang.String nickname) |
Changes a Member's nickname in this guild.
|
AuditableRestAction<java.lang.Void> |
transferOwnership(Member newOwner) |
Transfers the Guild ownership to the specified
Member
Only available if the currently logged in account is the owner of this Guild |
AuditableRestAction<java.lang.Void> |
unban(java.lang.String userId) |
Unbans the a user specified by the userId from this Guild.
|
AuditableRestAction<java.lang.Void> |
unban(User user) |
Unbans the specified
User from this Guild. |
public Guild getGuild()
Guild
instanceGuild
instancepublic JDA getJDA()
JDA
instance of this GuildController@CheckReturnValue public RestAction<java.lang.Void> moveVoiceMember(Member member, VoiceChannel voiceChannel)
Member
from one VoiceChannel
to another VoiceChannel
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
UNKNOWN_CHANNEL
member
- The Member
that you are moving.voiceChannel
- The destination VoiceChannel
to which the member is being
moved to.RestAction
java.lang.IllegalStateException
- If the Member isn't currently in a VoiceChannel in this Guild, or CacheFlag.VOICE_STATE
is disabled.java.lang.IllegalArgumentException
- InsufficientPermissionException
- Permission.VOICE_MOVE_OTHERS
in the VoiceChannel that the Member is currently in.Permission.VOICE_CONNECT
for the destination VoiceChannel.@CheckReturnValue public AuditableRestAction<java.lang.Void> setNickname(Member member, java.lang.String nickname)
To change the nickname for the currently logged in account
only the Permission NICKNAME_CHANGE
is required.
To change the nickname of any Member
for this Guild
the Permission NICKNAME_MANAGE
is required.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- The Member
for which the nickname should be changed.nickname
- The new nickname of the Member
, provide null
or an
empty String to reset the nicknameAuditableRestAction
java.lang.IllegalArgumentException
- If the specified Member
is not from the same Guild
.
Or if the provided member is null
InsufficientPermissionException
- Permission.NICKNAME_CHANGE
or Permission.NICKNAME_MANAGE
Permission.NICKNAME_MANAGE
HierarchyException
- If attempting to set nickname for another member and the logged in account cannot manipulate the other user due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
@CheckReturnValue public AuditableRestAction<java.lang.Integer> prune(int days)
Guild.getPrunableMemberCount(int)
to determine how many Members would be pruned if you were to
call this method.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
days
- Minimum number of days since a member has been offline to get affected.AuditableRestAction
- Type: Integer
InsufficientPermissionException
- If the account doesn't have KICK_MEMBER
Permission.java.lang.IllegalArgumentException
- If the provided days are less than 1
@CheckReturnValue public AuditableRestAction<java.lang.Void> kick(Member member, java.lang.String reason)
Member
from the Guild
.
Note: Guild.getMembers()
will still contain the User
until Discord sends the GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- The Member
to kick
from the from the Guild
.reason
- The reason for this action or null
if there is no specified reasonAuditableRestAction
Kicks the provided Member from the current Guildjava.lang.IllegalArgumentException
- If the provided member is not a Member of this Guild or is null
InsufficientPermissionException
- If the logged in account does not have the Permission.KICK_MEMBERS
permission.HierarchyException
- If the logged in account cannot kick the other member due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
@CheckReturnValue public AuditableRestAction<java.lang.Void> kick(java.lang.String userId, java.lang.String reason)
Member
specified by the userId from the from the Guild
.
Note: Guild.getMembers()
will still contain the User
until Discord sends the GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
userId
- The id of the User
to kick
from the from the Guild
.reason
- The reason for this action or null
if there is no specified reasonAuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.KICK_MEMBERS
permission.HierarchyException
- If the logged in account cannot kick the other member due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
java.lang.IllegalArgumentException
- If the userId provided does not correspond to a Member in this Guild or the provided userId
is blank/null.@CheckReturnValue public AuditableRestAction<java.lang.Void> kick(Member member)
Member
from the Guild
.
Note: Guild.getMembers()
will still contain the User
until Discord sends the GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- The Member
to kick from the from the Guild
.AuditableRestAction
Kicks the provided Member from the current Guildjava.lang.IllegalArgumentException
- If the provided member is not a Member of this Guild or is null
InsufficientPermissionException
- If the logged in account does not have the Permission.KICK_MEMBERS
permission.HierarchyException
- If the logged in account cannot kick the other member due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
@CheckReturnValue public AuditableRestAction<java.lang.Void> kick(java.lang.String userId)
Member
specified by the userId from the from the Guild
.
Note: Guild.getMembers()
will still contain the User
until Discord sends the GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
userId
- The id of the User
to kick from the from the Guild
.AuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.KICK_MEMBERS
permission.HierarchyException
- If the logged in account cannot kick the other member due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
java.lang.IllegalArgumentException
- If the userId provided does not correspond to a Member in this Guild or the provided userId
is blank/null.@CheckReturnValue public AuditableRestAction<java.lang.Void> ban(Member member, int delDays, java.lang.String reason)
Member
and deletes messages sent by the user
based on the amount of delDays.
Note: Guild.getMembers()
will still contain the
Member
until Discord sends the
GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- The Member
to ban.delDays
- The history of messages, in days, that will be deleted.reason
- The reason for this action or null
if there is no specified reasonAuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.HierarchyException
- If the logged in account cannot ban the other user due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
java.lang.IllegalArgumentException
- null
@CheckReturnValue public AuditableRestAction<java.lang.Void> ban(User user, int delDays, java.lang.String reason)
User
and deletes messages sent by the user
based on the amount of delDays.
Note: Guild.getMembers()
will still contain the User's
Member
object (if the User was in the Guild)
until Discord sends the GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
user
- The User
to ban.delDays
- The history of messages, in days, that will be deleted.reason
- The reason for this action or null
if there is no specified reasonAuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.HierarchyException
- If the logged in account cannot ban the other user due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
java.lang.IllegalArgumentException
- @CheckReturnValue public AuditableRestAction<java.lang.Void> ban(java.lang.String userId, int delDays, java.lang.String reason)
Note: Guild.getMembers()
will still contain the User's
Member
object (if the User was in the Guild)
until Discord sends the GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
userId
- The id of the User
to ban.delDays
- The history of messages, in days, that will be deleted.reason
- The reason for this action or null
if there is no specified reasonAuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.HierarchyException
- If the logged in account cannot ban the other user due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
java.lang.IllegalArgumentException
- @CheckReturnValue public AuditableRestAction<java.lang.Void> ban(Member member, int delDays)
Member
and deletes messages sent by the user
based on the amount of delDays.
Note: Guild.getMembers()
will still contain the
Member
until Discord sends the
GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- The Member
to ban.delDays
- The history of messages, in days, that will be deleted.AuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.HierarchyException
- If the logged in account cannot ban the other user due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
java.lang.IllegalArgumentException
- null
@CheckReturnValue public AuditableRestAction<java.lang.Void> ban(User user, int delDays)
Member
and deletes messages sent by the user
based on the amount of delDays.
Note: Guild.getMembers()
will still contain the
Member
until Discord sends the
GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
user
- The User
to ban.delDays
- The history of messages, in days, that will be deleted.AuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.HierarchyException
- If the logged in account cannot ban the other user due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
java.lang.IllegalArgumentException
- null
@CheckReturnValue public AuditableRestAction<java.lang.Void> ban(java.lang.String userId, int delDays)
Note: Guild.getMembers()
will still contain the User's
Member
object (if the User was in the Guild)
until Discord sends the GuildMemberLeaveEvent
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
userId
- The id of the User
to ban.delDays
- The history of messages, in days, that will be deleted.AuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.HierarchyException
- If the logged in account cannot ban the other user due to permission hierarchy position.
PermissionUtil.canInteract(Member, Member)
java.lang.IllegalArgumentException
- null
@CheckReturnValue public AuditableRestAction<java.lang.Void> unban(User user)
User
from this Guild.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_USER
user
- The id of the User
to unban.AuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.java.lang.IllegalArgumentException
- If the provided user is null@CheckReturnValue public AuditableRestAction<java.lang.Void> unban(java.lang.String userId)
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_USER
userId
- The id of the User
to unban.AuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.java.lang.IllegalArgumentException
- If the provided id is null or blank@CheckReturnValue public AuditableRestAction<java.lang.Void> setDeafen(Member member, boolean deafen)
Member
based on the provided
boolean.
Note: The Member's GuildVoiceState.isGuildDeafened()
value won't change
until JDA receives the GuildVoiceGuildDeafenEvent
event related to this change.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- The Member
who's VoiceState
is being changed.deafen
- Whether this Member
should be deafened or undeafened.AuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.VOICE_DEAF_OTHERS
permission.HierarchyException
- If the provided member is the Guild's owner. You cannot modify the owner of a Guild.java.lang.IllegalArgumentException
- If the provided member is not from this Guild or null.@CheckReturnValue public AuditableRestAction<java.lang.Void> setMute(Member member, boolean mute)
Member
based on the provided
boolean.
Note: The Member's GuildVoiceState.isGuildMuted()
value won't change
until JDA receives the GuildVoiceGuildMuteEvent
event related to this change.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- The Member
who's VoiceState
is being changed.mute
- Whether this Member
should be muted or unmuted.AuditableRestAction
InsufficientPermissionException
- If the logged in account does not have the Permission.VOICE_DEAF_OTHERS
permission.HierarchyException
- If the provided member is the Guild's owner. You cannot modify the owner of a Guild.java.lang.IllegalArgumentException
- If the provided member is not from this Guild or null.@CheckReturnValue public AuditableRestAction<java.lang.Void> addSingleRoleToMember(Member member, Role role)
Role
to the specified Member
.
If multiple roles should be added/removed (efficiently) in one request
you may use modifyMemberRoles(Member, Collection, Collection)
or similar methods.
If the specified role is already present in the member's set of roles this does nothing.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
UNKNOWN_ROLE
member
- The target member who will receive the new rolerole
- The role which should be assigned atomicallyAuditableRestAction
java.lang.IllegalArgumentException
- null
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_ROLES
HierarchyException
- If the provided roles are higher in the Guild's hierarchy
and thus cannot be modified by the currently logged in account@CheckReturnValue public AuditableRestAction<java.lang.Void> removeSingleRoleFromMember(Member member, Role role)
Role
from the specified Member
.
If multiple roles should be added/removed (efficiently) in one request
you may use modifyMemberRoles(Member, Collection, Collection)
or similar methods.
If the specified role is not present in the member's set of roles this does nothing.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
UNKNOWN_ROLE
member
- The target member who will lose the specified rolerole
- The role which should be removed atomicallyAuditableRestAction
java.lang.IllegalArgumentException
- null
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_ROLES
HierarchyException
- If the provided roles are higher in the Guild's hierarchy
and thus cannot be modified by the currently logged in account@CheckReturnValue public AuditableRestAction<java.lang.Void> addRolesToMember(Member member, Role... roles)
Roles
to the specified Member
GuildMemberRoleAddEvent
.
modifyMemberRoles(Member, Collection, Collection)
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- Not-null Member
that will receive all provided rolesroles
- Not-null Roles that should be added to the specified MemberAuditableRestAction
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_ROLES
HierarchyException
- If the provided roles are higher in the Guild's hierarchy
and thus cannot be modified by the currently logged in accountjava.lang.IllegalArgumentException
- addRolesToMember(Member, Collection)
,
modifyMemberRoles(Member, Role...)
@CheckReturnValue public AuditableRestAction<java.lang.Void> addRolesToMember(Member member, java.util.Collection<Role> roles)
Roles
to the specified Member
GuildMemberRoleAddEvent
.
modifyMemberRoles(Member, Collection, Collection)
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- Not-null Member
that will receive all provided rolesroles
- Not-null Roles that should be added to the specified MemberAuditableRestAction
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_ROLES
HierarchyException
- If the provided roles are higher in the Guild's hierarchy
and thus cannot be modified by the currently logged in accountjava.lang.IllegalArgumentException
- addRolesToMember(Member, Role...)
,
modifyMemberRoles(Member, Collection)
@CheckReturnValue public AuditableRestAction<java.lang.Void> removeRolesFromMember(Member member, Role... roles)
Roles
from the specified Member
GuildMemberRoleRemoveEvent
.
modifyMemberRoles(Member, Collection, Collection)
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- Not-null Member
from which to remove the Roles
roles
- Not-null Roles that should be removed from the specified MemberAuditableRestAction
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_ROLES
HierarchyException
- If the provided roles are higher in the Guild's hierarchy
and thus cannot be modified by the currently logged in accountjava.lang.IllegalArgumentException
- addRolesToMember(Member, Collection)
,
modifyMemberRoles(Member, Role...)
@CheckReturnValue public AuditableRestAction<java.lang.Void> removeRolesFromMember(Member member, java.util.Collection<Role> roles)
Roles
from the specified Member
GuildMemberRoleRemoveEvent
.
modifyMemberRoles(Member, Collection, Collection)
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- Not-null Member
from which to remove the Roles
roles
- Not-null Roles that should be removed from the specified MemberAuditableRestAction
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_ROLES
HierarchyException
- If the provided roles are higher in the Guild's hierarchy
and thus cannot be modified by the currently logged in accountjava.lang.IllegalArgumentException
- addRolesToMember(Member, Role...)
,
modifyMemberRoles(Member, Collection)
@CheckReturnValue public AuditableRestAction<java.lang.Void> modifyMemberRoles(Member member, java.util.Collection<Role> rolesToAdd, java.util.Collection<Role> rolesToRemove)
Roles
of the specified Member
by adding and removing a collection of roles.
rolesToAdd
and rolesToRemove
it will be removed.
None of the provided collections may be null
To only add or remove roles use either removeRolesFromMember(Member, Collection)
or addRolesToMember(Member, Collection)
GenericGuildMemberEvent
targeting the same Member.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- The Member
that should be modifiedrolesToAdd
- A Collection
of Roles
to add to the current Roles the specified Member
already hasrolesToRemove
- A Collection
of Roles
to remove from the current Roles the specified Member
already hasAuditableRestAction
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_ROLES
HierarchyException
- If the provided roles are higher in the Guild's hierarchy
and thus cannot be modified by the currently logged in accountjava.lang.IllegalArgumentException
- null
Public Role
of the Guild@CheckReturnValue public AuditableRestAction<java.lang.Void> modifyMemberRoles(Member member, Role... roles)
Role
set of the specified Member
GenericGuildMemberEvent
targeting the same Member.
The new roles must not contain the Public Role of the Guild
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- A Member
of which to override the Roles ofroles
- New collection of Roles
for the specified MemberAuditableRestAction
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_ROLES
HierarchyException
- If the provided roles are higher in the Guild's hierarchy
and thus cannot be modified by the currently logged in accountjava.lang.IllegalArgumentException
- modifyMemberRoles(Member, Collection)
@CheckReturnValue public AuditableRestAction<java.lang.Void> modifyMemberRoles(Member member, java.util.Collection<Role> roles)
Role
set of the specified Member
The new roles must not contain the Public Role of the Guild
GenericGuildMemberEvent
targeting the same Member.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
member
- A Member
of which to override the Roles ofroles
- New collection of Roles
for the specified MemberAuditableRestAction
InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_ROLES
HierarchyException
- If the provided roles are higher in the Guild's hierarchy
and thus cannot be modified by the currently logged in accountjava.lang.IllegalArgumentException
- modifyMemberRoles(Member, Collection)
@CheckReturnValue public AuditableRestAction<java.lang.Void> transferOwnership(Member newOwner)
Member
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_MEMBER
newOwner
- Not-null Member to transfer ownership toAuditableRestAction
PermissionException
- If the currently logged in account is not the owner of this Guildjava.lang.IllegalArgumentException
- null
or not from the same GuildAccountType.BOT
)@CheckReturnValue public ChannelAction createTextChannel(java.lang.String name)
TextChannel
in this Guild.
For this to be successful, the logged in account has to have the MANAGE_CHANNEL
Permission
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
name
- The name of the TextChannel to createChannelAction
InsufficientPermissionException
- If the logged in account does not have the Permission.MANAGE_CHANNEL
permissionjava.lang.IllegalArgumentException
- If the provided name is null
or empty or greater than 100 characters in length@CheckReturnValue public ChannelAction createVoiceChannel(java.lang.String name)
VoiceChannel
in this Guild.
For this to be successful, the logged in account has to have the MANAGE_CHANNEL
Permission.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
name
- The name of the VoiceChannel to createChannelAction
InsufficientPermissionException
- If the logged in account does not have the Permission.MANAGE_CHANNEL
permissionjava.lang.IllegalArgumentException
- If the provided name is null
or empty or greater than 100 characters in length@CheckReturnValue public ChannelAction createCategory(java.lang.String name)
Category
in this Guild.
For this to be successful, the logged in account has to have the MANAGE_CHANNEL
Permission.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
name
- The name of the Category to createChannelAction
InsufficientPermissionException
- If the logged in account does not have the Permission.MANAGE_CHANNEL
permissionjava.lang.IllegalArgumentException
- If the provided name is null
or empty or greater than 100 characters in length@CheckReturnValue public ChannelAction createCopyOfChannel(Channel channel)
Channel
in this Guild
.
This copies the following elements:
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
channel
- The Channel
to use for the copy templateChannelAction
java.lang.IllegalArgumentException
- If the provided channel is null
InsufficientPermissionException
- If the currently logged in account does not have the MANAGE_CHANNEL
PermissioncreateTextChannel(String)
,
createVoiceChannel(String)
,
ChannelAction
@CheckReturnValue public RoleAction createRole()
Role
in this Guild.
MANAGE_ROLES
Permission
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
MAX_ROLES_PER_GUILD
RoleAction
InsufficientPermissionException
- If the logged in account does not have the Permission.MANAGE_ROLES
Permission@CheckReturnValue public RoleAction createCopyOfRole(Role role)
Role
in this Guild
with the same settings as the given Role
.
It will be placed at the bottom (just over the Public Role) to avoid permission hierarchy conflicts.
For this to be successful, the logged in account has to have the MANAGE_ROLES
Permission
and all Permissions
the given Role
has.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
MAX_ROLES_PER_GUILD
role
- The Role
that should be copiedRoleAction
Role
InsufficientPermissionException
- If the logged in account does not have the Permission.MANAGE_ROLES
Permission and every Permission the provided Role hasjava.lang.IllegalArgumentException
- If the specified role is null
@CheckReturnValue public AuditableRestAction<Emote> createEmote(java.lang.String name, Icon icon, Role... roles)
Emote
in this Guild.
Member.canInteract(Emote)
)
MANAGE_EMOTES
Permission.
Unicode emojis are not included as Emote
!
Note that a guild is limited to 50 normal and 50 animated emotes by default.
Some guilds are able to add additional emotes beyond this limitation due to the
MORE_EMOJI
feature (see Guild.getFeatures()
).
Due to simplicity we do not check for these limits.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
name
- The name for the new Emoteicon
- The Icon
for the new Emoteroles
- The Roles
the new Emote should be restricted to
AuditableRestAction
- Type: Emote
InsufficientPermissionException
- If the logged in account does not have the MANAGE_EMOTES
Permission@CheckReturnValue public ChannelOrderAction<Category> modifyCategoryPositions()
Guild.getCategories()
using a specific RestAction
extension to allow moving Channels
up
/down
or to
a specific position.
Possible ErrorResponses
include:
UNNKOWN_CHANNEL
MISSING_ACCESS
ChannelOrderAction
- Type: Category
@CheckReturnValue public ChannelOrderAction<TextChannel> modifyTextChannelPositions()
Guild.getTextChannels()
using a specific RestAction
extension to allow moving Channels
up
/down
or to
a specific position.
Possible ErrorResponses
include:
UNNKOWN_CHANNEL
MISSING_ACCESS
ChannelOrderAction
- Type: TextChannel
@CheckReturnValue public ChannelOrderAction<VoiceChannel> modifyVoiceChannelPositions()
Guild.getVoiceChannels()
using a specific RestAction
extension to allow moving Channels
up
/down
or to
a specific position.
Possible ErrorResponses
include:
UNNKOWN_CHANNEL
MISSING_ACCESS
ChannelOrderAction
- Type: VoiceChannel
@CheckReturnValue public CategoryOrderAction<TextChannel> modifyTextChannelPositions(Category category)
Category#getTextChannels()
using an extension of ChannelOrderAction
specialized for ordering the nested TextChannels
of this
Category
.
ChannelOrderAction
, the returned CategoryOrderAction
can be used to move TextChannels up
,
down
, or
to
a specific position.
Possible ErrorResponses
include:
UNNKOWN_CHANNEL
MISSING_ACCESS
category
- The Category
to order
TextChannels
from.CategoryOrderAction
- Type: TextChannel
@CheckReturnValue public CategoryOrderAction<VoiceChannel> modifyVoiceChannelPositions(Category category)
Category#getVoiceChannels()
using an extension of ChannelOrderAction
specialized for ordering the nested VoiceChannels
of this
Category
.
ChannelOrderAction
, the returned CategoryOrderAction
can be used to move VoiceChannels up
,
down
, or
to
a specific position.
Possible ErrorResponses
include:
UNNKOWN_CHANNEL
MISSING_ACCESS
category
- The Category
to order
VoiceChannels
from.CategoryOrderAction
- Type: VoiceChannels
@CheckReturnValue public RoleOrderAction modifyRolePositions()
Guild.getRoles()
using a specific RestAction
extension to allow moving Roles
up
/down
or to
a specific position.
This uses the ordering defined by Discord, which is descending!
This means the highest role appears at index 0
and the lower role at index n - 1
.
Providing false
to modifyRolePositions(boolean)
will result in the ordering being
in ascending order, with the lower role at index 0
and the highest at index n - 1
.
As a note: Member.getRoles()
and Guild.getRoles()
are both in descending order.
Possible ErrorResponses
include:
UNKNOWN_ROLE
MISSING_ACCESS
RoleOrderAction
@CheckReturnValue public RoleOrderAction modifyRolePositions(boolean useDiscordOrder)
Guild.getRoles()
using a specific RestAction
extension to allow moving Roles
up
/down
or to
a specific position.
Possible ErrorResponses
include:
UNKNOWN_ROLE
MISSING_ACCESS
useDiscordOrder
- Defines the ordering of the OrderAction. If true
, the OrderAction will be in the ordering
defined by Discord for roles, which is Descending. This means that the highest role appears at index 0
and the lowest role at index n - 1
. Providing false
will result in the ordering being
in ascending order, with the lower role at index 0
and the highest at index n - 1
.
Member.getRoles()
and Guild.getRoles()
are both in descending order.RoleOrderAction