public class GuildController
extends java.lang.Object
Constructor and Description |
---|
GuildController(Guild guild) |
Modifier and Type | Method and Description |
---|---|
RestAction<java.lang.Void> |
addRolesToMember(Member member,
java.util.Collection<Role> roles) |
RestAction<java.lang.Void> |
addRolesToMember(Member member,
Role... roles) |
RestAction<java.lang.Void> |
ban(Member member,
int delDays)
Bans a
Member and deletes messages sent by the user
based on the amount of delDays.If you wish to ban a member without deleting any messages, provide delDays with a value of 0. |
RestAction<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.
If you wish to ban a user without deleting any messages, provide delDays with a value of 0. |
RestAction<java.lang.Void> |
ban(User user,
int delDays)
Bans a
User and deletes messages sent by the user
based on the amount of delDays.If you wish to ban a user without deleting any messages, provide delDays with a value of 0. |
RestAction<Role> |
createCopyOfRole(Role role)
|
RestAction<Emote> |
createEmote(java.lang.String name,
Icon icon,
Role... roles)
Creates a new
Emote in this Guild.For this to be successful, the logged in account has to have the MANAGE_EMOTES Permission . |
RestAction<Role> |
createRole()
Creates a new
Role in this Guild. |
RestAction<TextChannel> |
createTextChannel(java.lang.String name)
Creates a new
TextChannel in this Guild. |
RestAction<VoiceChannel> |
createVoiceChannel(java.lang.String name)
Creates a new
VoiceChannel in this Guild. |
RestAction<java.util.List<User>> |
getBans()
Gets an unmodifiable list of the currently banned
Users .If you wish to ban or unban a user, please ban(net.dv8tion.jda.core.entities.User, int) or
unban(net.dv8tion.jda.core.entities.User) ; |
Guild |
getGuild() |
JDA |
getJDA() |
RestAction<java.lang.Integer> |
getPrunableMemberCount(int days)
The method calculates the amount of Members that would be pruned if
prune(int) was executed. |
RestAction<java.lang.Void> |
kick(Member member)
|
RestAction<java.lang.Void> |
kick(java.lang.String userId)
|
RestAction<java.lang.Void> |
modifyMemberRoles(Member member,
java.util.Collection<Role> roles) |
RestAction<java.lang.Void> |
modifyMemberRoles(Member member,
java.util.Collection<Role> rolesToAdd,
java.util.Collection<Role> rolesToRemove) |
RestAction<java.lang.Void> |
modifyMemberRoles(Member member,
Role... roles) |
RestAction<java.lang.Void> |
moveVoiceMember(Member member,
VoiceChannel voiceChannel)
Used to move a
Member from one VoiceChannel
to another VoiceChannel .As a note, you cannot move a Member that isn't already in a VoiceChannel. |
RestAction<java.lang.Integer> |
prune(int days)
This method will prune (kick) all members who were offline for at least days days.
The RestAction returned from this method will return the amount of Members that were pruned. You can use getPrunableMemberCount(int) to determine how many Members would be pruned if you were to
call this method. |
RestAction<java.lang.Void> |
removeRolesFromMember(Member member,
java.util.Collection<Role> roles) |
RestAction<java.lang.Void> |
removeRolesFromMember(Member member,
Role... roles) |
RestAction<java.lang.Void> |
setDeafen(Member member,
boolean deafen)
Sets the Guild Deafened state state of the
Member based on the provided
boolean. |
RestAction<java.lang.Void> |
setMute(Member member,
boolean mute)
Sets the Guild Muted state state of the
Member based on the provided
boolean. |
RestAction<java.lang.Void> |
setNickname(Member member,
java.lang.String nickname)
Changes a member's nickname in this guild.
|
RestAction<java.lang.Void> |
transferOwnership(Member newOwner) |
RestAction<java.lang.Void> |
unban(java.lang.String userId)
Unbans the a user specified by the userId from this Guild.
|
RestAction<java.lang.Void> |
unban(User user)
Unbans the specified
User from this Guild. |
public GuildController(Guild guild)
public Guild getGuild()
public JDA getJDA()
public RestAction<java.lang.Void> setNickname(Member member, java.lang.String nickname)
NICKNAME_MANAGE
for others and self, however if only modifying self,
then only NICKNAME_CHANGE
is needed.member
- The member for which the nickname should be changed.nickname
- The new nickname of the member, or null / "" to resetRestAction
- PermissionException
- Permission.NICKNAME_CHANGE
nor Permission.NICKNAME_MANAGE
Permission.NICKNAME_MANAGE
GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<java.lang.Void> moveVoiceMember(Member member, VoiceChannel voiceChannel)
Member
from one VoiceChannel
to another VoiceChannel
.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.java.lang.IllegalArgumentException
- PermissionException
- Permission.VOICE_MOVE_OTHERS
in the VoiceChannel that
the Member is currently in.Permission.VOICE_CONNECT
for the destination VoiceChannel.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<java.lang.Integer> prune(int days)
getPrunableMemberCount(int)
to determine how many Members would be pruned if you were to
call this method.days
- Minimum number of days since a member has been offline to get affected.RestAction
- Integer
PermissionException
- If the account doesn't have KICK_MEMBER
Permission.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<java.lang.Integer> getPrunableMemberCount(int days)
prune(int)
was executed.
Prunability is determined by a member being offline for at least days days.days
- Minimum number of days since a member has been offline to get affected.RestAction
- Integer
PermissionException
- If the account doesn't have KICK_MEMBER
Permission.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<java.lang.Void> kick(Member member)
Member
from the Guild
.
Note: Guild.getMembers()
will still contain the User
until Discord sends the GuildMemberLeaveEvent
.
member
- The Member
to kick from the from the Guild
.RestAction
- PermissionException
- Permission.KICK_MEMBERS
permission.java.lang.IllegalArgumentException
- If the provided member is not a Member of this Guild.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<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
.
userId
- The id of the User
to kick from the from the Guild
.RestAction
- PermissionException
- Permission.KICK_MEMBERS
permission.java.lang.IllegalArgumentException
- If the userId provided does not correspond to a Member in this Guild.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<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
.
member
- The Member
to ban.delDays
- The history of messages, in days, that will be deleted.RestAction
- PermissionException
- Permission.BAN_MEMBERS
permission.java.lang.IllegalArgumentException
- If the provided amount of days (delDays) is less than 0.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<java.lang.Void> ban(User user, int delDays)
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
.
user
- The User
to ban.delDays
- The history of messages, in days, that will be deleted.RestAction
- PermissionException
- Permission.BAN_MEMBERS
permission.java.lang.IllegalArgumentException
- If the provided amount of days (delDays) is less than 0.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<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
.
userId
- The id of the User
to ban.delDays
- The history of messages, in days, that will be deleted.RestAction
- PermissionException
- Permission.BAN_MEMBERS
permission.java.lang.IllegalArgumentException
- If the provided amount of days (delDays) is less than 0.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<java.lang.Void> unban(User user)
User
from this Guild.user
- The id of the User
to unban.RestAction
- PermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<java.lang.Void> unban(java.lang.String userId)
userId
- The id of the User
to unban.RestAction
- PermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<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.
member
- The Member
who's VoiceState
is being changed.deafen
- Whether this Member
should be deafened or undeafened.RestAction
- PermissionException
- Permission.VOICE_DEAF_OTHERS
permission.java.lang.IllegalArgumentException
- If the provided member is not from this Guild.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<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.
member
- The Member
who's VoiceState
is being changed.mute
- Whether this Member
should be muted or unmuted.RestAction
- PermissionException
- Permission.VOICE_MUTE_OTHERS
permission.java.lang.IllegalArgumentException
- If the provided member is not from this Guild.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<java.util.List<User>> getBans()
Users
.ban(net.dv8tion.jda.core.entities.User, int)
or
unban(net.dv8tion.jda.core.entities.User)
;RestAction
- List
<User
>PermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.GuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<java.lang.Void> addRolesToMember(Member member, Role... roles)
public RestAction<java.lang.Void> addRolesToMember(Member member, java.util.Collection<Role> roles)
public RestAction<java.lang.Void> removeRolesFromMember(Member member, Role... roles)
public RestAction<java.lang.Void> removeRolesFromMember(Member member, java.util.Collection<Role> roles)
public RestAction<java.lang.Void> modifyMemberRoles(Member member, java.util.Collection<Role> rolesToAdd, java.util.Collection<Role> rolesToRemove)
public RestAction<java.lang.Void> modifyMemberRoles(Member member, Role... roles)
public RestAction<java.lang.Void> modifyMemberRoles(Member member, java.util.Collection<Role> roles)
public RestAction<java.lang.Void> transferOwnership(Member newOwner)
public RestAction<TextChannel> createTextChannel(java.lang.String name)
TextChannel
in this Guild.
For this to be successful, the logged in account has to have the
MANAGE_CHANNEL
Permissionname
- the name of the TextChannel to createRestAction
- TextChannel
TextChannel
PermissionException
- If the logged in account does not have the Permission.MANAGE_CHANNEL
permission.java.lang.IllegalArgumentException
- If the provided name is less than 2 characters or greater than 100 characters in lengthGuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<VoiceChannel> 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.name
- the name of the VoiceChannel to createRestAction
- VoiceChannel
VoiceChannel
PermissionException
- If the logged in account does not have the Permission.MANAGE_CHANNEL
permission.java.lang.IllegalArgumentException
- If the provided name is less than 2 characters or greater than 100 characters in lengthGuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<Role> createRole()
Role
in this Guild.
For this to be successful, the logged in account has to have the MANAGE_ROLES Permission
RestAction
- Role
Role
PermissionException
- If the logged in account does not have the Permission.MANAGE_ROLES
permission.java.lang.IllegalArgumentException
- If the provided name is less than 2 characters or greater than 100 characters in lengthGuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<Role> 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 @everyone 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.role
- The Role
that should be copiedRestAction
- Role
Role
after it has been created and had settings from the provided role copied to it.PermissionException
- If the logged in account does not have the Permission.MANAGE_ROLES
permission and every Permission the provided Role has.java.lang.IllegalArgumentException
- If the provided name is less than 2 characters or greater than 100 characters in lengthGuildUnavailableException
- if the guild is temporarily unavailablepublic RestAction<Emote> createEmote(java.lang.String name, Icon icon, Role... roles)
Emote
in this Guild.MANAGE_EMOTES Permission
.name
- The name for the new Emoteicon
- The Icon
for the new Emoteroles
- The Roles
the new Emote should be restricted toRestAction
- Emote
Emote
GuildUnavailableException
- if the guild is temporarily unavailablePermissionException
- if the logged in account does not have the Permission.MANAGE_EMOTES
permission.AccountTypeException
- if the logged in account is not from AccountType#Client