public class GuildManager
extends java.lang.Object
Guild.| Constructor and Description |
|---|
GuildManager(Guild guild)
Creates a
GuildManager that can be used to manage
different aspects of the provided Guild. |
| Modifier and Type | Method and Description |
|---|---|
GuildManager |
addRoleToUser(User user,
Role... roles)
|
void |
ban(java.lang.String userId,
int delDays)
Bans the
User specified by the userId nd 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. |
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. |
java.util.List<User> |
getBans()
Gets an unmodifiable list of the currently banned
Users.If you wish to ban or unban a user, please use one of the ban or unban methods of this Manager |
Guild |
getGuild()
Returns the
Guild object of this Manager. |
void |
kick(java.lang.String userId)
|
void |
kick(User user)
|
void |
leaveOrDelete()
Leaves or Deletes this
Guild. |
void |
moveVoiceUser(User user,
VoiceChannel voiceChannel)
Used to move a
User from one VoiceChannel
to another VoiceChannel.As a note, you cannot move a User that isn't already in a VoiceChannel. |
GuildManager |
removeRoleFromUser(User user,
Role... roles)
|
GuildManager |
setAfkChannel(VoiceChannel channel)
Changes the AFK
VoiceChannel of this Guild
If passed null, this will disable the AFK-Channel. |
GuildManager |
setAfkTimeout(net.dv8tion.jda.managers.GuildManager.Timeout timeout)
Changes the AFK Timeout of this Guild
After given timeout (in seconds) Users being AFK in voice are being moved to the AFK-Channel
Valid timeouts are: 60, 300, 900, 1800, 3600.
|
GuildManager |
setIcon(AvatarUtil.Avatar avatar)
Changes the icon of this Guild.
You can create the icon via the AvatarUtil class. |
GuildManager |
setName(java.lang.String name)
Changes the name of this Guild.
|
GuildManager |
setRegion(Region region)
|
void |
transferOwnership(User newOwner)
Transfers the ownership of this Guild to another user.
|
void |
unBan(java.lang.String userId)
|
void |
unBan(User user)
|
void |
update()
This method will apply all accumulated changes received by setters
|
public GuildManager(Guild guild)
GuildManager that can be used to manage
different aspects of the provided Guild.guild - The Guild which the manager deals with.GuildUnavailableException - if the guild is temporarily unavailablepublic Guild getGuild()
Guild object of this Manager. Useful if this Manager was returned via a create functionGuild of this Managerpublic GuildManager setName(java.lang.String name)
update() is called.
So multiple changes can be made at once.name - the new name of the Guild, or null to keep current oneGuildManager instance. Useful for chaining.GuildUnavailableException - if the guild is temporarily unavailablepublic GuildManager setRegion(Region region)
Region of this Guild.
This change will only be applied, if update() is called.
So multiple changes can be made at once.region - the new Region, or null to keep current oneGuildManager instance. Useful for chaining.GuildUnavailableException - if the guild is temporarily unavailablepublic GuildManager setIcon(AvatarUtil.Avatar avatar)
AvatarUtil class.
Passing in null will keep the current icon,
while DELETE_AVATAR removes the current one.
This change will only be applied, if update() is called.
So multiple changes can be made at once.avatar - the new icon, null to keep current, or AvatarUtil.DELETE_AVATAR to deleteGuildManager instance. Useful for chaining.GuildUnavailableException - if the guild is temporarily unavailablepublic GuildManager setAfkChannel(VoiceChannel channel)
VoiceChannel of this Guild
If passed null, this will disable the AFK-Channel.
This change will only be applied, if update() is called.
So multiple changes can be made at once.channel - the new afk-channelGuildManager instance. Useful for chaining.GuildUnavailableException - if the guild is temporarily unavailablepublic GuildManager setAfkTimeout(net.dv8tion.jda.managers.GuildManager.Timeout timeout)
update() is called.
So multiple changes can be made at once.timeout - the new afk timeout, or null to keep current oneGuildManager instance. Useful for chaining.GuildUnavailableException - if the guild is temporarily unavailablepublic GuildManager addRoleToUser(User user, Role... roles)
User the specified Role.User already has the provided Role
this method will do nothing.
This change will only be applied, if update() is called.
So multiple changes can be made at once.user - The User that is gaining a new Role.roles - The Roles that are being assigned to the User.GuildManager instance. Useful for chaining.GuildUnavailableException - if the guild is temporarily unavailablepublic GuildManager removeRoleFromUser(User user, Role... roles)
Role from the User.User does not have the specified Role
this method will do nothing.
This change will only be applied, if update() is called.
So multiple changes can be made at once.
NOTE: you cannot remove the Guild public role from a User.
Attempting to do so will result in nothing happening.user - The User that is having a Role removed.roles - The Roles that are being removed from the User.GuildManager instance. Useful for chaining.GuildUnavailableException - if the guild is temporarily unavailablepublic void update()
GuildUnavailableException - if the guild is temporarily unavailablepublic void moveVoiceUser(User user, VoiceChannel voiceChannel)
User from one VoiceChannel
to another VoiceChannel.user - The User that you are moving.voiceChannel - The destination VoiceChannel to which the user is being
moved to.java.lang.IllegalStateException - If the User isn't currently in a VoiceChannel in this Guild.java.lang.IllegalArgumentException - GuildPermissionException - Permission.VOICE_MOVE_OTHERS in the VoiceChannel that
the User is currently in.Permission.VOICE_CONNECT for the destination VoiceChannel.public void kick(User user)
User from the Guild.
This change will be applied immediately.
Note: Guild.getUsers() will still contain the User
until Discord sends the GuildMemberLeaveEvent.
user - The User to kick from the from the Guild.GuildUnavailableException - if the guild is temporarily unavailablepublic void kick(java.lang.String userId)
User specified by the userId from the from the Guild.
This change will be applied immediately.
Note: Guild.getUsers() will still contain the User
until Discord sends the GuildMemberLeaveEvent.
userId - The id of the User to kick from the from the Guild.GuildUnavailableException - if the guild is temporarily unavailablepublic void ban(User user, int delDays)
User and deletes messages sent by the user
based on the amount of delDays.
Note: Guild.getUsers() will still contain the User
until Discord sends the GuildMemberLeaveEvent.
user - The User to ban.delDays - The history of messages, in days, that will be deleted.GuildUnavailableException - if the guild is temporarily unavailablepublic void ban(java.lang.String userId,
int delDays)
User specified by the userId nd deletes messages sent by the user
based on the amount of delDays.
Note: Guild.getUsers() will still contain the User
until Discord sends the GuildMemberLeaveEvent.
userId - The id of the User to ban.delDays - The history of messages, in days, that will be deleted.GuildUnavailableException - if the guild is temporarily unavailablepublic java.util.List<User> getBans()
Users.GuildUnavailableException - if the guild is temporarily unavailablepublic void unBan(User user)
user - The User to unban.GuildUnavailableException - if the guild is temporarily unavailablepublic void unBan(java.lang.String userId)
User from the Guild based on the provided userId.
This change will be applied immediately.userId - The id of the User to unban.GuildUnavailableException - if the guild is temporarily unavailablepublic void transferOwnership(User newOwner)
newOwner - the desired new OwnerGuildUnavailableException - if the guild is temporarily unavailablepublic void leaveOrDelete()
Guild.
If the logged in User is the owner of
this Guild, the Guild is deleted.
Otherwise, this guild will be left.
This change will be applied immediately.GuildUnavailableException - if the guild is temporarily unavailable