Interface Guild
-
- All Superinterfaces:
ISnowflake
public interface Guild extends ISnowflake
Represents a DiscordGuild. This should contain all information provided from Discord about a Guild.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classGuild.BanRepresents a Ban object.static classGuild.BoostTierThe boost tier for this guild.static classGuild.ExplicitContentLevelThe Explicit-Content-Filter Level of a Guild.static classGuild.MFALevelRepresents the Multifactor Authentication level required by the Guild.static classGuild.NotificationLevelRepresents the Notification-level of the Guild.static classGuild.TimeoutRepresents the idle time allowed until a user is moved to the AFKVoiceChannelif one is set (Guild.getAfkChannel()).static classGuild.VerificationLevelRepresents the Verification-Level of the Guild.
-
Field Summary
Fields Modifier and Type Field Description static StringBANNER_URLTemplate forgetBannerUrl().static StringICON_URLTemplate forgetIconUrl().static StringSPLASH_URLTemplate forgetSplashUrl().
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default MemberActionaddMember(String accessToken, long userId)Adds the user represented by the provided id to this guild.MemberActionaddMember(String accessToken, String userId)Adds the user represented by the provided id to this guild.default MemberActionaddMember(String accessToken, User user)Adds the provided user to this guild.default AuditableRestAction<Void>addRoleToMember(long userId, Role role)Atomically assigns the providedRoleto the specified member by their user id.default AuditableRestAction<Void>addRoleToMember(String userId, Role role)Atomically assigns the providedRoleto the specified member by their user id.AuditableRestAction<Void>addRoleToMember(Member member, Role role)default AuditableRestAction<Void>ban(String userId, int delDays)Bans the user specified by the userId and deletes messages sent by the user based on the amount of delDays.AuditableRestAction<Void>ban(String userId, int delDays, String reason)Bans the user specified by the userId and deletes messages sent by the user based on the amount of delDays.default AuditableRestAction<Void>ban(Member member, int delDays)Bans theMemberand deletes messages sent by the user based on the amount of delDays.default AuditableRestAction<Void>ban(Member member, int delDays, String reason)Bans theMemberand deletes messages sent by the user based on the amount of delDays.default AuditableRestAction<Void>ban(User user, int delDays)Bans theMemberand deletes messages sent by the user based on the amount of delDays.AuditableRestAction<Void>ban(User user, int delDays, String reason)Bans theUserand deletes messages sent by the user based on the amount of delDays.booleancheckVerification()Checks if the current Verification-level of this guild allows JDA to send messages to it.ChannelAction<Category>createCategory(String name)Creates a newCategoryin this Guild.default <T extends GuildChannel>
ChannelAction<T>createCopyOfChannel(T channel)Creates a copy of the specifiedGuildChannelin thisGuild.default RoleActioncreateCopyOfRole(Role role)AuditableRestAction<Emote>createEmote(String name, Icon icon, Role... roles)Creates a newEmotein this Guild.RoleActioncreateRole()Creates a newRolein this Guild.ChannelAction<TextChannel>createTextChannel(String name)Creates a newTextChannelin this Guild.ChannelAction<VoiceChannel>createVoiceChannel(String name)Creates a newVoiceChannelin this Guild.AuditableRestAction<Void>deafen(Member member, boolean deafen)Sets the Guild Deafened state state of theMemberbased on the provided boolean.RestAction<Void>delete()Used to completely delete a Guild.RestAction<Void>delete(String mfaCode)Used to completely delete a guild.VoiceChannelgetAfkChannel()Provides theVoiceChannelthat has been set as the channel whichMemberswill be moved to after they have been inactive in aVoiceChannelfor longer thangetAfkTimeout().Guild.TimeoutgetAfkTimeout()TheTimeoutset for this Guild representing the amount of time that must pass for a Member to have had no activity in aVoiceChannelto be considered AFK.AudioManagergetAudioManager()TheAudioManagerthat represents the audio connection for this Guild.StringgetBannerId()The guild banner id.default StringgetBannerUrl()The guild banner url.intgetBoostCount()The amount of boosts this server currently has.List<Member>getBoosters()Sorted list ofMembersthat boost this guild.Guild.BoostTiergetBoostTier()The boost tier for this guild.default List<Category>getCategories()Gets allCategoriesin thisGuild.default List<Category>getCategoriesByName(String name, boolean ignoreCase)Gets a list of allCategoriesin this Guild that have the same name as the one provided.default CategorygetCategoryById(long id)Gets theCategoryfrom this guild that matches the provided id.default CategorygetCategoryById(String id)Gets theCategoryfrom this guild that matches the provided id.SortedSnowflakeCacheView<Category>getCategoryCache()SortedSnowflakeCacheViewof all cachedCategoriesof this Guild.default List<GuildChannel>getChannels()Populated list ofchannelsfor this guild.List<GuildChannel>getChannels(boolean includeHidden)Populated list ofchannelsfor this guild.TextChannelgetDefaultChannel()The defaultTextChannelfor aGuild.Guild.NotificationLevelgetDefaultNotificationLevel()Returns the default message Notification-Level of this Guild.StringgetDescription()The description for this guild.default EmotegetEmoteById(long id)Gets anEmotefrom this guild that has the same id as the one provided.default EmotegetEmoteById(String id)Gets anEmotefrom this guild that has the same id as the one provided.SnowflakeCacheView<Emote>getEmoteCache()SnowflakeCacheViewof all cachedEmotesof this Guild.default List<Emote>getEmotes()default List<Emote>getEmotesByName(String name, boolean ignoreCase)Gets a list of allEmotesin this Guild that have the same name as the one provided.Guild.ExplicitContentLevelgetExplicitContentLevel()The level of content filtering enabled in this Guild.Set<String>getFeatures()The Features of theGuild.default GuildChannelgetGuildChannelById(long id)GetGuildChannelfor the provided ID.default GuildChannelgetGuildChannelById(String id)GetGuildChannelfor the provided ID.default GuildChannelgetGuildChannelById(ChannelType type, long id)GetGuildChannelfor the provided ID.default GuildChannelgetGuildChannelById(ChannelType type, String id)GetGuildChannelfor the provided ID.StringgetIconId()The Discord hash-id of theGuildicon image.default StringgetIconUrl()The URL of theGuildicon image.JDAgetJDA()Returns theJDAinstance of this GuildGuildManagergetManager()Returns theGuildManagerfor this Guild, used to modify all properties and settings of the Guild.default intgetMaxBitrate()The maximum bitrate that can be applied to a voice channel in this guild.default intgetMaxEmotes()The maximum amount of emotes a guild can have based on the guilds boost tier.intgetMaxMembers()The maximum amount of members that can join this guild.intgetMaxPresences()The maximum amount of connected members this guild can have at a time.MembergetMember(User user)default MembergetMemberById(long userId)Gets aMemberobject via the id of the user.default MembergetMemberById(String userId)Gets aMemberobject via the id of the user.default MembergetMemberByTag(String tag)Searches for aMemberthat has the matching Discord Tag.default MembergetMemberByTag(String username, String discriminator)Searches for aMemberthat has the matching Discord Tag.MemberCacheViewgetMemberCache()MemberCacheViewfor all cachedMembersof this Guild.intgetMemberCount()The expected member count for this guild.default List<Member>getMembers()A list of allMembersin this Guild.default List<Member>getMembersByEffectiveName(String name, boolean ignoreCase)Gets a list of allMemberswho have the same effective name as the one provided.default List<Member>getMembersByName(String name, boolean ignoreCase)Gets a list of allMemberswho have the same name as the one provided.default List<Member>getMembersByNickname(String nickname, boolean ignoreCase)Gets a list of allMemberswho have the same nickname as the one provided.default List<Member>getMembersWithRoles(Collection<Role> roles)default List<Member>getMembersWithRoles(Role... roles)StringgetName()The human readable name of theGuild.MembergetOwner()TheMemberobject for the owner of this Guild.default StringgetOwnerId()The ID for the current owner of this guild.longgetOwnerIdLong()The ID for the current owner of this guild.RolegetPublicRole()default RegiongetRegion()The VoiceRegionthat this Guild is using for audio connections.StringgetRegionRaw()The raw voice region name that this Guild is using for audio connections.Guild.MFALevelgetRequiredMFALevel()Returns the level of multifactor authentication required to execute administrator restricted functions in this guild.default RolegetRoleById(long id)Gets aRolefrom this guild that has the same id as the one provided.default RolegetRoleById(String id)Gets aRolefrom this guild that has the same id as the one provided.SortedSnowflakeCacheView<Role>getRoleCache()SortedSnowflakeCacheViewof all cachedRolesof this Guild.default List<Role>getRoles()default List<Role>getRolesByName(String name, boolean ignoreCase)Gets a list of allRolesin this Guild that have the same name as the one provided.MembergetSelfMember()Gets theMemberobject of the currently logged in account in this guild.StringgetSplashId()The Discord hash-id of the splash image for this Guild.default StringgetSplashUrl()The URL of the splash image for this Guild.default StoreChannelgetStoreChannelById(long id)Gets aStoreChannelfrom this guild that has the same id as the one provided.default StoreChannelgetStoreChannelById(String id)Gets aStoreChannelfrom this guild that has the same id as the one provided.SortedSnowflakeCacheView<StoreChannel>getStoreChannelCache()SortedSnowflakeCacheViewof all cachedStoreChannelsof this Guild.default List<StoreChannel>getStoreChannels()Gets allStoreChannelsin thisGuild.default List<StoreChannel>getStoreChannelsByName(String name, boolean ignoreCase)Gets a list of allStoreChannelsin this Guild that have the same name as the one provided.TextChannelgetSystemChannel()Provides theTextChannelthat has been set as the channel which newly joinedMemberswill be announced in.default TextChannelgetTextChannelById(long id)Gets aTextChannelfrom this guild that has the same id as the one provided.default TextChannelgetTextChannelById(String id)Gets aTextChannelfrom this guild that has the same id as the one provided.SortedSnowflakeCacheView<TextChannel>getTextChannelCache()SortedSnowflakeCacheViewof all cachedTextChannelsof this Guild.default List<TextChannel>getTextChannels()Gets allTextChannelsin thisGuild.default List<TextChannel>getTextChannelsByName(String name, boolean ignoreCase)Gets a list of allTextChannelsin this Guild that have the same name as the one provided.StringgetVanityCode()The vanity url code for this Guild.default StringgetVanityUrl()The vanity url for this Guild.Guild.VerificationLevelgetVerificationLevel()Returns the verification-Level of this Guild.default VoiceChannelgetVoiceChannelById(long id)Gets aVoiceChannelfrom this guild that has the same id as the one provided.default VoiceChannelgetVoiceChannelById(String id)Gets aVoiceChannelfrom this guild that has the same id as the one provided.SortedSnowflakeCacheView<VoiceChannel>getVoiceChannelCache()SortedSnowflakeCacheViewof all cachedVoiceChannelsof this Guild.default List<VoiceChannel>getVoiceChannels()Gets allVoiceChannelsin thisGuild.default List<VoiceChannel>getVoiceChannelsByName(String name, boolean ignoreCase)Gets a list of allVoiceChannelsin this Guild that have the same name as the one provided.List<GuildVoiceState>getVoiceStates()booleanisAvailable()Deprecated.This will be removed in a future version, unavailable guilds are now removed from cache.booleanisLoaded()Whether this guild has loaded members.booleanisMember(User user)Used to determine if the providedUseris a member of this Guild.default AuditableRestAction<Void>kick(String userId)AuditableRestAction<Void>kick(String userId, String reason)default AuditableRestAction<Void>kick(Member member)AuditableRestAction<Void>kick(Member member, String reason)default RestAction<Void>kickVoiceMember(Member member)Used to kick aMemberfrom aVoiceChannel.RestAction<Void>leave()Used to leave a Guild.ChannelOrderActionmodifyCategoryPositions()Modifies the positional order ofGuild.getCategories()using a specificRestActionextension to allow moving Channelsup/downortoa specific position.AuditableRestAction<Void>modifyMemberRoles(Member member, Collection<Role> roles)AuditableRestAction<Void>modifyMemberRoles(Member member, Collection<Role> rolesToAdd, Collection<Role> rolesToRemove)default AuditableRestAction<Void>modifyMemberRoles(Member member, Role... roles)AuditableRestAction<Void>modifyNickname(Member member, String nickname)Changes the Member's nickname in this guild.default RoleOrderActionmodifyRolePositions()Modifies the positional order ofGuild.getRoles()using a specificRestActionextension to allow moving Rolesup/downortoa specific position.RoleOrderActionmodifyRolePositions(boolean useAscendingOrder)Modifies the positional order ofGuild.getRoles()using a specificRestActionextension to allow moving Rolesup/downortoa specific position.ChannelOrderActionmodifyTextChannelPositions()Modifies the positional order ofGuild.getTextChannels()using a specificRestActionextension to allow moving Channelsup/downortoa specific position.CategoryOrderActionmodifyTextChannelPositions(Category category)Modifies the positional order ofCategory#getTextChannels()using an extension ofChannelOrderActionspecialized for ordering the nestedTextChannelsof thisCategory.ChannelOrderActionmodifyVoiceChannelPositions()Modifies the positional order ofGuild.getVoiceChannels()using a specificRestActionextension to allow moving Channelsup/downortoa specific position.CategoryOrderActionmodifyVoiceChannelPositions(Category category)Modifies the positional order ofCategory#getVoiceChannels()using an extension ofChannelOrderActionspecialized for ordering the nestedVoiceChannelsof thisCategory.RestAction<Void>moveVoiceMember(Member member, VoiceChannel voiceChannel)AuditableRestAction<Void>mute(Member member, boolean mute)Sets the Guild Muted state state of theMemberbased on the provided boolean.AuditableRestAction<Integer>prune(int days)This method will prune (kick) all members who were offline for at least days days.default AuditableRestAction<Void>removeRoleFromMember(long userId, Role role)Atomically removes the providedRolefrom the specified member by their user id.default AuditableRestAction<Void>removeRoleFromMember(String userId, Role role)Atomically removes the providedRolefrom the specified member by their user id.AuditableRestAction<Void>removeRoleFromMember(Member member, Role role)AuditLogPaginationActionretrieveAuditLogs()default RestAction<Guild.Ban>retrieveBan(User bannedUser)Retrieves aBanof the providedUser
If you wish to ban or unban a user, use eitherban(User, int)orunban(User).default RestAction<Guild.Ban>retrieveBanById(long userId)Retrieves aBanof the provided ID
If you wish to ban or unban a user, use eitherban(String, int)ban(id, int)} orunban(String)unban(id)}.RestAction<Guild.Ban>retrieveBanById(String userId)Retrieves aBanof the provided ID
If you wish to ban or unban a user, use eitherban(id, int)orunban(id).RestAction<List<Guild.Ban>>retrieveBanList()Retrieves an immutable list of the currently bannedUsers.default RestAction<ListedEmote>retrieveEmote(Emote emote)Retrieves a listed emote together with its respective creator.default RestAction<ListedEmote>retrieveEmoteById(long id)Retrieves a listed emote together with its respective creator.RestAction<ListedEmote>retrieveEmoteById(String id)Retrieves a listed emote together with its respective creator.RestAction<List<ListedEmote>>retrieveEmotes()Retrieves an immutable list of emotes together with their respective creators.RestAction<List<Invite>>retrieveInvites()Retrieves allInvitesfor this guild.default RestAction<Member>retrieveMember(User user)Load the member for the specified user.RestAction<Member>retrieveMemberById(long id)Load the member for the specified user.default RestAction<Member>retrieveMemberById(String id)Load the member for the specified user.CompletableFuture<Void>retrieveMembers()Requests member chunks for this guild.default RestAction<Member>retrieveOwner()Shortcut forguild.retrieveMemberById(guild.getOwnerIdLong()).RestAction<Integer>retrievePrunableMemberCount(int days)The method calculates the amount of Members that would be pruned ifprune(int)was executed.default RestAction<EnumSet<Region>>retrieveRegions()Retrieves the available regions for this Guild
Shortcut forretrieveRegions(true)
This will include deprecated voice regions by default.RestAction<EnumSet<Region>>retrieveRegions(boolean includeDeprecated)Retrieves the available regions for this GuildRestAction<String>retrieveVanityUrl()Deprecated.RestAction<List<Webhook>>retrieveWebhooks()Retrieves allWebhooksfor this Guild.AuditableRestAction<Void>transferOwnership(Member newOwner)Transfers the Guild ownership to the specifiedMember
Only available if the currently logged in account is the owner of this GuildAuditableRestAction<Void>unban(String userId)Unbans the a user specified by the userId from this Guild.default AuditableRestAction<Void>unban(User user)Unbans the specifiedUserfrom this Guild.-
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
-
-
-
Field Detail
-
ICON_URL
static final String ICON_URL
Template forgetIconUrl().- See Also:
- Constant Field Values
-
SPLASH_URL
static final String SPLASH_URL
Template forgetSplashUrl().- See Also:
- Constant Field Values
-
BANNER_URL
static final String BANNER_URL
Template forgetBannerUrl().- See Also:
- Constant Field Values
-
-
Method Detail
-
retrieveRegions
@Nonnull @CheckReturnValue default RestAction<EnumSet<Region>> retrieveRegions()
Retrieves the available regions for this Guild
Shortcut forretrieveRegions(true)
This will include deprecated voice regions by default.- Returns:
RestAction- TypeEnumSet
-
retrieveRegions
@Nonnull @CheckReturnValue RestAction<EnumSet<Region>> retrieveRegions(boolean includeDeprecated)
Retrieves the available regions for this Guild- Parameters:
includeDeprecated- Whether to include deprecated regions- Returns:
RestAction- TypeEnumSet
-
addMember
@Nonnull @CheckReturnValue MemberAction addMember(@Nonnull String accessToken, @Nonnull String userId)
Adds the user represented by the provided id to this guild.
This requires an OAuth2 Access Token with the scopeguilds.join.- Parameters:
accessToken- The access tokenuserId- The user id- Returns:
MemberAction- Throws:
IllegalArgumentException- If the user id or access token is blank, empty, or null, or if the provided user is already in this guildInsufficientPermissionException- If the currently logged in account does not havePermission.CREATE_INSTANT_INVITE- Since:
- 3.7.0
- See Also:
- Discord OAuth2 Documentation
-
addMember
@Nonnull @CheckReturnValue default MemberAction addMember(@Nonnull String accessToken, @Nonnull User user)
Adds the provided user to this guild.
This requires an OAuth2 Access Token with the scopeguilds.join.- Parameters:
accessToken- The access tokenuser- The user- Returns:
MemberAction- Throws:
IllegalArgumentException- If the user or access token is blank, empty, or null, or if the provided user is already in this guildInsufficientPermissionException- If the currently logged in account does not havePermission.CREATE_INSTANT_INVITE- Since:
- 3.7.0
- See Also:
- Discord OAuth2 Documentation
-
addMember
@Nonnull @CheckReturnValue default MemberAction addMember(@Nonnull String accessToken, long userId)
Adds the user represented by the provided id to this guild.
This requires an OAuth2 Access Token with the scopeguilds.join.- Parameters:
accessToken- The access tokenuserId- The user id- Returns:
MemberAction- Throws:
IllegalArgumentException- If the user id or access token is blank, empty, or null, or if the provided user is already in this guildInsufficientPermissionException- If the currently logged in account does not havePermission.CREATE_INSTANT_INVITE- Since:
- 3.7.0
- See Also:
- Discord OAuth2 Documentation
-
isLoaded
boolean isLoaded()
Whether this guild has loaded members.
This will always be false if guild subscriptions have been disabled.- Returns:
- True, if members are loaded.
-
getMemberCount
int getMemberCount()
The expected member count for this guild.
If this guild is not lazy loaded this should be identical to the size returned bygetMemberCache().When guild subscriptions are disabled, this will not be updated.
- Returns:
- The expected member count for this guild
-
getName
@Nonnull String getName()
The human readable name of theGuild.This value can be modified using
GuildManager.setName(String).- Returns:
- Never-null String containing the Guild's name.
-
getIconId
@Nullable String getIconId()
The Discord hash-id of theGuildicon image. If no icon has been set, this returnsnull.The Guild icon can be modified using
GuildManager.setIcon(Icon).- Returns:
- Possibly-null String containing the Guild's icon hash-id.
-
getIconUrl
@Nullable default String getIconUrl()
The URL of theGuildicon image. If no icon has been set, this returnsnull.The Guild icon can be modified using
GuildManager.setIcon(Icon).- Returns:
- Possibly-null String containing the Guild's icon URL.
-
getFeatures
@Nonnull Set<String> getFeatures()
The Features of theGuild.Possible known features:
- ANIMATED_ICON - Guild can have an animated icon
- BANNER - Guild can have a banner
- COMMERCE - Guild can sell software through a store channel
- DISCOVERABLE - Guild shows up in discovery tab
- INVITE_SPLASH - Guild has custom invite splash. See
getSplashId()andgetSplashUrl() - MORE_EMOJI - Guild is able to use more than 50 emoji
- NEWS - Guild can create news channels
- PARTNERED - Guild is "partnered"
- PUBLIC - Guild is public
- VANITY_URL - Guild a vanity URL (custom invite link). See
getVanityUrl() - VERIFIED - Guild is "verified"
- VIP_REGIONS - Guild has VIP voice regions
- Returns:
- Never-null, unmodifiable Set containing all of the Guild's features.
-
getSplashId
@Nullable String getSplashId()
The Discord hash-id of the splash image for this Guild. A Splash image is an image displayed when viewing a Discord Guild Invite on the web or in client just before accepting or declining the invite. If no splash has been set, this returnsnull.
Splash images are VIP/Partner Guild only.The Guild splash can be modified using
GuildManager.setSplash(Icon).- Returns:
- Possibly-null String containing the Guild's splash hash-id
-
getSplashUrl
@Nullable default String getSplashUrl()
The URL of the splash image for this Guild. A Splash image is an image displayed when viewing a Discord Guild Invite on the web or in client just before accepting or declining the invite. If no splash has been set, this returnsnull.
Splash images are VIP/Partner Guild only.The Guild splash can be modified using
GuildManager.setSplash(Icon).- Returns:
- Possibly-null String containing the Guild's splash URL.
-
retrieveVanityUrl
@Nonnull @Deprecated @ForRemoval @DeprecatedSince("4.0.0") @ReplaceWith("getVanityCode()") @CheckReturnValue RestAction<String> retrieveVanityUrl()
Deprecated.Gets the vanity url for this Guild. The vanity url is the custom invite code of partnered / official Guilds. The returned String will be the code that can be provided todiscord.gg/{code}to get the invite link.
You can checkgetFeatures()to see if this Guild has a vanity urlThis action requires the
MANAGE_SERVERpermission.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The ban list cannot be fetched due to a permission discrepancy
- Returns:
RestAction- Type: String
The vanity url of this server- Throws:
InsufficientPermissionException- If the logged in account does not have theMANAGE_SERVERpermission.IllegalStateException- If the guild doesn't have the VANITY_URL feature- See Also:
getFeatures(),getVanityCode()
-
getVanityCode
@Nullable String getVanityCode()
The vanity url code for this Guild. The vanity url is the custom invite code of partnered / official / boosted Guilds.
The returned String will be the code that can be provided todiscord.gg/{code}to get the invite link.The Vanity Code can be modified using
GuildManager.setVanityCode(String).- Returns:
- The vanity code or null
- Since:
- 4.0.0
- See Also:
getVanityUrl()
-
getVanityUrl
@Nullable default String getVanityUrl()
The vanity url for this Guild. The vanity url is the custom invite code of partnered / official / boosted Guilds.
The returned String will be the vanity invite link to this guild.The Vanity Code can be modified using
GuildManager.setVanityCode(String).- Returns:
- The vanity url or null
- Since:
- 4.0.0
-
getDescription
@Nullable String getDescription()
The description for this guild.
This is displayed in the server browser below the guild name for verified guilds.The description can be modified using
GuildManager.setDescription(String).- Returns:
- The description
- Since:
- 4.0.0
-
getBannerId
@Nullable String getBannerId()
The guild banner id.
This is shown in guilds below the guild name.The banner can be modified using
GuildManager.setBanner(Icon).- Returns:
- The guild banner id or null
- Since:
- 4.0.0
- See Also:
getBannerUrl()
-
getBannerUrl
@Nullable default String getBannerUrl()
The guild banner url.
This is shown in guilds below the guild name.The banner can be modified using
GuildManager.setBanner(Icon).- Returns:
- The guild banner url or null
- Since:
- 4.0.0
-
getBoostTier
@Nonnull Guild.BoostTier getBoostTier()
The boost tier for this guild.
Each tier unlocks new perks for a guild that can be seen in thefeatures.- Returns:
- The boost tier.
- Since:
- 4.0.0
-
getBoostCount
int getBoostCount()
The amount of boosts this server currently has.- Returns:
- The boost count
- Since:
- 4.0.0
-
getBoosters
@Nonnull List<Member> getBoosters()
Sorted list ofMembersthat boost this guild.
The list is sorted byMember.getTimeBoosted()ascending. This means the first element will be the member who has been boosting for the longest time.- Returns:
- Possibly-immutable list of members who boost this guild
-
getMaxBitrate
default int getMaxBitrate()
The maximum bitrate that can be applied to a voice channel in this guild.
This depends on the features of this guild that can be unlocked for partners or through boosting.- Returns:
- The maximum bitrate
- Since:
- 4.0.0
-
getMaxEmotes
default int getMaxEmotes()
The maximum amount of emotes a guild can have based on the guilds boost tier.- Returns:
- The maximum amount of emotes
- Since:
- 4.0.0
-
getMaxMembers
int getMaxMembers()
The maximum amount of members that can join this guild.- Returns:
- The maximum amount of members
- Since:
- 4.0.0
-
getMaxPresences
int getMaxPresences()
The maximum amount of connected members this guild can have at a time.
This includes members that are invisible but still connected to discord. If too many members are online the guild will become unavailable for others.- Returns:
- The maximum amount of connected members this guild can have
- Since:
- 4.0.0
-
getAfkChannel
@Nullable VoiceChannel getAfkChannel()
Provides theVoiceChannelthat has been set as the channel whichMemberswill be moved to after they have been inactive in aVoiceChannelfor longer thangetAfkTimeout().
If no channel has been set as the AFK channel, this returnsnull.This value can be modified using
GuildManager.setAfkChannel(VoiceChannel).- Returns:
- Possibly-null
VoiceChannelthat is the AFK Channel.
-
getSystemChannel
@Nullable TextChannel getSystemChannel()
Provides theTextChannelthat has been set as the channel which newly joinedMemberswill be announced in.
If no channel has been set as the system channel, this returnsnull.This value can be modified using
GuildManager.setSystemChannel(TextChannel).- Returns:
- Possibly-null
TextChannelthat is the system Channel.
-
getOwner
@Nullable Member getOwner()
TheMemberobject for the owner of this Guild.
This is null when the owner is no longer in this guild or not yet loaded (lazy loading). Sometimes owners of guilds delete their account or get banned by Discord.If lazy-loading is used it is recommended to use
retrieveOwner()instead.Ownership can be transferred using
transferOwnership(Member).- Returns:
- Possibly-null Member object for the Guild owner.
- See Also:
getOwnerIdLong(),retrieveOwner()
-
getOwnerIdLong
long getOwnerIdLong()
The ID for the current owner of this guild.
This is useful for debugging purposes or as a shortcut.- Returns:
- The ID for the current owner
- See Also:
getOwner()
-
getOwnerId
@Nonnull default String getOwnerId()
The ID for the current owner of this guild.
This is useful for debugging purposes or as a shortcut.- Returns:
- The ID for the current owner
- See Also:
getOwner()
-
getAfkTimeout
@Nonnull Guild.Timeout getAfkTimeout()
TheTimeoutset for this Guild representing the amount of time that must pass for a Member to have had no activity in aVoiceChannelto be considered AFK. IfgetAfkChannel()is notnull(thus an AFK channel has been set) then Member will be automatically moved to the AFK channel after they have been inactive for longer than the returned Timeout.
Default is300 seconds (5 minutes).This value can be modified using
GuildManager.setAfkTimeout(net.dv8tion.jda.api.entities.Guild.Timeout).- Returns:
- The
Timeoutset for this Guild.
-
getRegion
@Nonnull default Region getRegion()
The VoiceRegionthat this Guild is using for audio connections.
If the Region is not recognized, returnsUNKNOWNbut you can still use thegetRegionRaw()to retrieve the raw name this region has.This value can be modified using
GuildManager.setRegion(net.dv8tion.jda.api.Region).- Returns:
- The the audio Region this Guild is using for audio connections. Can return Region.UNKNOWN.
-
getRegionRaw
@Nonnull String getRegionRaw()
The raw voice region name that this Guild is using for audio connections.
This is resolved to an enum constant ofRegionbygetRegion()!This value can be modified using
GuildManager.setRegion(net.dv8tion.jda.api.Region).- Returns:
- Raw region name
-
isMember
boolean isMember(@Nonnull User user)
Used to determine if the providedUseris a member of this Guild.- Parameters:
user- The user to determine whether or not they are a member of this guild.- Returns:
- True - if this user is present in this guild.
-
getSelfMember
@Nonnull Member getSelfMember()
Gets theMemberobject of the currently logged in account in this guild.
This is basicallyJDA.getSelfUser()being provided togetMember(User).- Returns:
- The Member object of the currently logged in account.
-
getMember
@Nullable Member getMember(@Nonnull User user)
Gets the Guild specificMemberobject for the providedUser.
If the user is not in this guild,nullis returned.- Parameters:
user- TheUserwhich to retrieve a related Member object for.- Returns:
- Possibly-null
Memberfor the relatedUser. - Throws:
IllegalArgumentException- If the provided user is null
-
getMemberById
@Nullable default Member getMemberById(@Nonnull String userId)
Gets aMemberobject via the id of the user. The id relates toISnowflake.getId(), and this method is similar toJDA.getUserById(String)
This is more efficient that usingJDA.getUserById(String)andgetMember(User).
If no Member in this Guild has theuserIdprovided, this returnsnull.- Parameters:
userId- The Discord id of the User for which a Member object is requested.- Returns:
- Possibly-null
Memberwith the relateduserId. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getMemberById
@Nullable default Member getMemberById(long userId)
Gets aMemberobject via the id of the user. The id relates toISnowflake.getIdLong(), and this method is similar toJDA.getUserById(long)
This is more efficient that usingJDA.getUserById(long)andgetMember(User).
If no Member in this Guild has theuserIdprovided, this returnsnull.- Parameters:
userId- The Discord id of the User for which a Member object is requested.- Returns:
- Possibly-null
Memberwith the relateduserId.
-
getMemberByTag
@Nullable default Member getMemberByTag(@Nonnull String tag)
Searches for aMemberthat has the matching Discord Tag.
Format has to be in the formUsername#Discriminatorwhere the username must be between 2 and 32 characters (inclusive) matching the exact casing and the discriminator must be exactly 4 digits.
This does not check thenicknameof the member but the username.This only checks users that are in this guild. If a user exists with the tag that is not available in the
Member-Cacheit will not be detected.
Currently Discord does not offer a way to retrieve a user by their discord tag.- Parameters:
tag- The Discord Tag in the formatUsername#Discriminator- Returns:
- The
Memberfor the discord tag or null if no member has the provided tag - Throws:
IllegalArgumentException- If the provided tag is null or not in the described format- See Also:
JDA.getUserByTag(String)
-
getMemberByTag
@Nullable default Member getMemberByTag(@Nonnull String username, @Nonnull String discriminator)
Searches for aMemberthat has the matching Discord Tag.
Format has to be in the formUsername#Discriminatorwhere the username must be between 2 and 32 characters (inclusive) matching the exact casing and the discriminator must be exactly 4 digits.
This does not check thenicknameof the member but the username.This only checks users that are in this guild. If a user exists with the tag that is not available in the
Member-Cacheit will not be detected.
Currently Discord does not offer a way to retrieve a user by their discord tag.- Parameters:
username- The name of the userdiscriminator- The discriminator of the user- Returns:
- The
Memberfor the discord tag or null if no member has the provided tag - Throws:
IllegalArgumentException- If the provided arguments are null or not in the described format
-
getMembers
@Nonnull default List<Member> getMembers()
A list of allMembersin this Guild.
The Members are not provided in any particular order.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getMemberCache()and use its more efficient versions of handling these values.- Returns:
- Immutable list of all members in this Guild.
-
getMembersByName
@Nonnull default List<Member> getMembersByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allMemberswho have the same name as the one provided.
This compares againstMember.getUser().getName()
If there are noMemberswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returned Members.ignoreCase- Determines if the comparison ignores case when comparing. True - case insensitive.- Returns:
- Possibly-empty immutable list of all Members with the same name as the name provided.
-
getMembersByNickname
@Nonnull default List<Member> getMembersByNickname(@Nullable String nickname, boolean ignoreCase)
Gets a list of allMemberswho have the same nickname as the one provided.
This compares againstMember.getNickname(). If a Member does not have a nickname, the comparison results as false.
If there are noMemberswith the provided name, then this returns an empty list.- Parameters:
nickname- The nickname used to filter the returned Members.ignoreCase- Determines if the comparison ignores case when comparing. True - case insensitive.- Returns:
- Possibly-empty immutable list of all Members with the same nickname as the nickname provided.
-
getMembersByEffectiveName
@Nonnull default List<Member> getMembersByEffectiveName(@Nonnull String name, boolean ignoreCase)
Gets a list of allMemberswho have the same effective name as the one provided.
This compares againstMember.getEffectiveName()}.
If there are noMemberswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returned Members.ignoreCase- Determines if the comparison ignores case when comparing. True - case insensitive.- Returns:
- Possibly-empty immutable list of all Members with the same effective name as the name provided.
-
getMembersWithRoles
@Nonnull default List<Member> getMembersWithRoles(@Nonnull Role... roles)
Gets a list ofMembersthat have allRolesprovided.
If there are noMemberswith all provided roles, then this returns an empty list.- Parameters:
roles- TheRolesthat aMembermust have to be included in the returned list.- Returns:
- Possibly-empty immutable list of Members with all provided Roles.
- Throws:
IllegalArgumentException- If a providedRoleis from a different guild or null.
-
getMembersWithRoles
@Nonnull default List<Member> getMembersWithRoles(@Nonnull Collection<Role> roles)
Gets a list ofMembersthat have all providedRoles.
If there are noMemberswith all provided roles, then this returns an empty list.- Parameters:
roles- TheRolesthat aMembermust have to be included in the returned list.- Returns:
- Possibly-empty immutable list of Members with all provided Roles.
- Throws:
IllegalArgumentException- If a providedRoleis from a different guild or null.
-
getMemberCache
@Nonnull MemberCacheView getMemberCache()
MemberCacheViewfor all cachedMembersof this Guild.- Returns:
MemberCacheView
-
getGuildChannelById
@Nullable default GuildChannel getGuildChannelById(@Nonnull String id)
GetGuildChannelfor the provided ID.
This checks if any of the channel types in this guild have the provided ID and returns the first match.
To get more specific channel types you can use one of the following:- Parameters:
id- The ID of the channel- Returns:
- The GuildChannel or null
- Throws:
IllegalArgumentException- If the provided ID is nullNumberFormatException- If the provided ID is not a snowflake
-
getGuildChannelById
@Nullable default GuildChannel getGuildChannelById(long id)
GetGuildChannelfor the provided ID.
This checks if any of the channel types in this guild have the provided ID and returns the first match.
To get more specific channel types you can use one of the following:- Parameters:
id- The ID of the channel- Returns:
- The GuildChannel or null
-
getGuildChannelById
@Nullable default GuildChannel getGuildChannelById(@Nonnull ChannelType type, @Nonnull String id)
GetGuildChannelfor the provided ID.
This is meant for systems that use a dynamicChannelTypeand can profit from a simple function to get the channel instance. To get more specific channel types you can use one of the following:- Parameters:
type- TheChannelTypeid- The ID of the channel- Returns:
- The GuildChannel or null
- Throws:
IllegalArgumentException- If the provided ID is nullNumberFormatException- If the provided ID is not a snowflake
-
getGuildChannelById
@Nullable default GuildChannel getGuildChannelById(@Nonnull ChannelType type, long id)
GetGuildChannelfor the provided ID.
This is meant for systems that use a dynamicChannelTypeand can profit from a simple function to get the channel instance. To get more specific channel types you can use one of the following:- Parameters:
type- TheChannelTypeid- The ID of the channel- Returns:
- The GuildChannel or null
-
getCategoryById
@Nullable default Category getCategoryById(@Nonnull String id)
Gets theCategoryfrom this guild that matches the provided id. This method is similar toJDA.getCategoryById(String), but it only checks in this specific Guild.
If there is no matchingCategorythis returnsnull.- Parameters:
id- The snowflake ID of the wanted Category- Returns:
- Possibly-null
Categoryfor the provided ID. - Throws:
IllegalArgumentException- If the provided ID is not a validlong
-
getCategoryById
@Nullable default Category getCategoryById(long id)
Gets theCategoryfrom this guild that matches the provided id. This method is similar toJDA.getCategoryById(String), but it only checks in this specific Guild.
If there is no matchingCategorythis returnsnull.- Parameters:
id- The snowflake ID of the wanted Category- Returns:
- Possibly-null
Categoryfor the provided ID.
-
getCategories
@Nonnull default List<Category> getCategories()
Gets allCategoriesin thisGuild.
The returned categories will be sorted according to their position.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getCategoryCache()and use its more efficient versions of handling these values.- Returns:
- An immutable list of all
Categoriesin this Guild.
-
getCategoriesByName
@Nonnull default List<Category> getCategoriesByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allCategoriesin this Guild that have the same name as the one provided.
If there are no matching categories this will return an empty list.- Parameters:
name- The name to checkignoreCase- Whether to ignore case on name checking- Returns:
- Immutable list of all categories matching the provided name
- Throws:
IllegalArgumentException- If the provided name isnull
-
getCategoryCache
@Nonnull SortedSnowflakeCacheView<Category> getCategoryCache()
SortedSnowflakeCacheViewof all cachedCategoriesof this Guild.
Categories are sorted according to their position.- Returns:
SortedSnowflakeCacheView
-
getStoreChannelById
@Nullable default StoreChannel getStoreChannelById(@Nonnull String id)
Gets aStoreChannelfrom this guild that has the same id as the one provided. This method is similar toJDA.getStoreChannelById(String), but it only checks this specific Guild for a StoreChannel.
If there is noStoreChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theStoreChannel.- Returns:
- Possibly-null
StoreChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)- Since:
- 4.0.0
-
getStoreChannelById
@Nullable default StoreChannel getStoreChannelById(long id)
Gets aStoreChannelfrom this guild that has the same id as the one provided. This method is similar toJDA.getStoreChannelById(long), but it only checks this specific Guild for a StoreChannel.
If there is noStoreChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theStoreChannel.- Returns:
- Possibly-null
StoreChannelwith matching id. - Since:
- 4.0.0
-
getStoreChannels
@Nonnull default List<StoreChannel> getStoreChannels()
Gets allStoreChannelsin thisGuild.
The channels returned will be sorted according to their position.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getStoreChannelCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of all
StoreChannelin this Guild. - Since:
- 4.0.0
-
getStoreChannelsByName
@Nonnull default List<StoreChannel> getStoreChannelsByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allStoreChannelsin this Guild that have the same name as the one provided.
If there are noStoreChannelswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returnedStoreChannels.ignoreCase- Determines if the comparison ignores case when comparing. True - case insensitive.- Returns:
- Possibly-empty immutable list of all StoreChannels with names that match the provided name.
- Since:
- 4.0.0
-
getStoreChannelCache
@Nonnull SortedSnowflakeCacheView<StoreChannel> getStoreChannelCache()
SortedSnowflakeCacheViewof all cachedStoreChannelsof this Guild.
TextChannels are sorted according to their position.- Returns:
SortedSnowflakeCacheView- Since:
- 4.0.0
-
getTextChannelById
@Nullable default TextChannel getTextChannelById(@Nonnull String id)
Gets aTextChannelfrom this guild that has the same id as the one provided. This method is similar toJDA.getTextChannelById(String), but it only checks this specific Guild for a TextChannel.
If there is noTextChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theTextChannel.- Returns:
- Possibly-null
TextChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getTextChannelById
@Nullable default TextChannel getTextChannelById(long id)
Gets aTextChannelfrom this guild that has the same id as the one provided. This method is similar toJDA.getTextChannelById(long), but it only checks this specific Guild for a TextChannel.
If there is noTextChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theTextChannel.- Returns:
- Possibly-null
TextChannelwith matching id.
-
getTextChannels
@Nonnull default List<TextChannel> getTextChannels()
Gets allTextChannelsin thisGuild.
The channels returned will be sorted according to their position.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getTextChannelCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of all
TextChannelsin this Guild.
-
getTextChannelsByName
@Nonnull default List<TextChannel> getTextChannelsByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allTextChannelsin this Guild that have the same name as the one provided.
If there are noTextChannelswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returnedTextChannels.ignoreCase- Determines if the comparison ignores case when comparing. True - case insensitive.- Returns:
- Possibly-empty immutable list of all TextChannels names that match the provided name.
-
getTextChannelCache
@Nonnull SortedSnowflakeCacheView<TextChannel> getTextChannelCache()
SortedSnowflakeCacheViewof all cachedTextChannelsof this Guild.
TextChannels are sorted according to their position.- Returns:
SortedSnowflakeCacheView
-
getVoiceChannelById
@Nullable default VoiceChannel getVoiceChannelById(@Nonnull String id)
Gets aVoiceChannelfrom this guild that has the same id as the one provided. This method is similar toJDA.getVoiceChannelById(String), but it only checks this specific Guild for a VoiceChannel.
If there is noVoiceChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theVoiceChannel.- Returns:
- Possibly-null
VoiceChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getVoiceChannelById
@Nullable default VoiceChannel getVoiceChannelById(long id)
Gets aVoiceChannelfrom this guild that has the same id as the one provided. This method is similar toJDA.getVoiceChannelById(long), but it only checks this specific Guild for a VoiceChannel.
If there is noVoiceChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theVoiceChannel.- Returns:
- Possibly-null
VoiceChannelwith matching id.
-
getVoiceChannels
@Nonnull default List<VoiceChannel> getVoiceChannels()
Gets allVoiceChannelsin thisGuild.
The channels returned will be sorted according to their position.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getVoiceChannelCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of
VoiceChannels.
-
getVoiceChannelsByName
@Nonnull default List<VoiceChannel> getVoiceChannelsByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allVoiceChannelsin this Guild that have the same name as the one provided.
If there are noVoiceChannelswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returnedVoiceChannels.ignoreCase- Determines if the comparison ignores case when comparing. True - case insensitive.- Returns:
- Possibly-empty immutable list of all VoiceChannel names that match the provided name.
-
getVoiceChannelCache
@Nonnull SortedSnowflakeCacheView<VoiceChannel> getVoiceChannelCache()
SortedSnowflakeCacheViewof all cachedVoiceChannelsof this Guild.
VoiceChannels are sorted according to their position.- Returns:
SortedSnowflakeCacheView
-
getChannels
@Nonnull default List<GuildChannel> getChannels()
Populated list ofchannelsfor this guild. This includes all types of channels, such as category/voice/text.
This includes hidden channels by default.The returned list is ordered in the same fashion as it would be by the official discord client.
- TextChannel and StoreChannel without parent
- VoiceChannel without parent
- Categories
- TextChannel and StoreChannel with category as parent
- VoiceChannel with category as parent
- Returns:
- Immutable list of channels for this guild
- See Also:
getChannels(boolean)
-
getChannels
@Nonnull List<GuildChannel> getChannels(boolean includeHidden)
Populated list ofchannelsfor this guild. This includes all types of channels, such as category/voice/text.The returned list is ordered in the same fashion as it would be by the official discord client.
- TextChannel and StoreChannel without parent
- VoiceChannel without parent
- Categories
- TextChannel and StoreChannel with category as parent
- VoiceChannel with category as parent
- Parameters:
includeHidden- Whether to include channels with deniedView Channel Permission- Returns:
- Immutable list of channels for this guild
- See Also:
getChannels()
-
getRoleById
@Nullable default Role getRoleById(@Nonnull String id)
Gets aRolefrom this guild that has the same id as the one provided.
If there is noRolewith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theRole.- Returns:
- Possibly-null
Rolewith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getRoles
@Nonnull default List<Role> getRoles()
Gets allRolesin thisGuild.
The roles returned will be sorted according to their position. The highest role being at index 0 and the lowest at the last index.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getRoleCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of
Roles.
-
getRolesByName
@Nonnull default List<Role> getRolesByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allRolesin this Guild that have the same name as the one provided.
If there are noRoleswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returnedRoles.ignoreCase- Determines if the comparison ignores case when comparing. True - case insensitive.- Returns:
- Possibly-empty immutable list of all Role names that match the provided name.
-
getRoleCache
@Nonnull SortedSnowflakeCacheView<Role> getRoleCache()
SortedSnowflakeCacheViewof all cachedRolesof this Guild.
Roles are sorted according to their position.- Returns:
SortedSnowflakeCacheView
-
getEmoteById
@Nullable default Emote getEmoteById(@Nonnull String id)
Gets anEmotefrom this guild that has the same id as the one provided.
If there is noEmotewith an id that matches the provided one, then this returnsnull.
This will be null ifCacheFlag.EMOTEis disabled.Unicode emojis are not included as
Emote!- Parameters:
id- the emote id- Returns:
- An Emote matching the specified Id.
- Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getEmoteById
@Nullable default Emote getEmoteById(long id)
Gets anEmotefrom this guild that has the same id as the one provided.
If there is noEmotewith an id that matches the provided one, then this returnsnull.
This will be null ifCacheFlag.EMOTEis disabled.Unicode emojis are not included as
Emote!- Parameters:
id- the emote id- Returns:
- An Emote matching the specified Id.
-
getEmotes
@Nonnull default List<Emote> getEmotes()
Gets all customEmotesbelonging to thisGuild.
Emotes are not ordered in any specific way in the returned list.Unicode emojis are not included as
Emote!This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getEmoteCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of
Emotes.
-
getEmotesByName
@Nonnull default List<Emote> getEmotesByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allEmotesin this Guild that have the same name as the one provided.
If there are noEmoteswith the provided name, then this returns an empty list.
This will be empty ifCacheFlag.EMOTEis disabled.Unicode emojis are not included as
Emote!- Parameters:
name- The name used to filter the returnedEmotes. Without colons.ignoreCase- Determines if the comparison ignores case when comparing. True - case insensitive.- Returns:
- Possibly-empty immutable list of all Emotes that match the provided name.
-
getEmoteCache
@Nonnull SnowflakeCacheView<Emote> getEmoteCache()
SnowflakeCacheViewof all cachedEmotesof this Guild.
This will be empty ifCacheFlag.EMOTEis disabled.- Returns:
SnowflakeCacheView
-
retrieveEmotes
@Nonnull @CheckReturnValue RestAction<List<ListedEmote>> retrieveEmotes()
Retrieves an immutable list of emotes together with their respective creators.Note that
ListedEmote.getUser()is only available if the currently logged in account hasPermission.MANAGE_EMOTES.- Returns:
RestAction- Type: List ofListedEmote- Since:
- 3.8.0
-
retrieveEmoteById
@Nonnull @CheckReturnValue RestAction<ListedEmote> retrieveEmoteById(@Nonnull String id)
Retrieves a listed emote together with its respective creator.
This does not include unicode emoji.Note that
ListedEmote.getUser()is only available if the currently logged in account hasPermission.MANAGE_EMOTES.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:UNKNOWN_EMOJI
If the provided id does not correspond to an emote in this guild
- Parameters:
id- The emote id- Returns:
RestAction- Type:ListedEmote- Throws:
IllegalArgumentException- If the provided id is not a valid snowflake- Since:
- 3.8.0
-
retrieveEmoteById
@Nonnull @CheckReturnValue default RestAction<ListedEmote> retrieveEmoteById(long id)
Retrieves a listed emote together with its respective creator.Note that
ListedEmote.getUser()is only available if the currently logged in account hasPermission.MANAGE_EMOTES.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:UNKNOWN_EMOJI
If the provided id does not correspond to an emote in this guild
- Parameters:
id- The emote id- Returns:
RestAction- Type:ListedEmote- Since:
- 3.8.0
-
retrieveEmote
@Nonnull @CheckReturnValue default RestAction<ListedEmote> retrieveEmote(@Nonnull Emote emote)
Retrieves a listed emote together with its respective creator.Note that
ListedEmote.getUser()is only available if the currently logged in account hasPermission.MANAGE_EMOTES.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:UNKNOWN_EMOJI
If the provided emote does not correspond to an emote in this guild anymore
- Parameters:
emote- The emote- Returns:
RestAction- Type:ListedEmote- Since:
- 3.8.0
-
retrieveBanList
@Nonnull @CheckReturnValue RestAction<List<Guild.Ban>> retrieveBanList()
Retrieves an immutable list of the currently bannedUsers.
If you wish to ban or unban a user, use eitherban(User, int)orunban(User).Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The ban list cannot be fetched due to a permission discrepancy
- Returns:
RestAction- Type: List<Ban>
Retrieves an immutable list of all users currently banned from this Guild- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.
-
retrieveBanById
@Nonnull @CheckReturnValue default RestAction<Guild.Ban> retrieveBanById(long userId)
Retrieves aBanof the provided ID
If you wish to ban or unban a user, use eitherban(String, int)ban(id, int)} orunban(String)unban(id)}.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The ban list cannot be fetched due to a permission discrepancyUNKNOWN_BAN
Either the ban was removed before finishing the task or it did not exist in the first place
- Parameters:
userId- the id of the banned user- Returns:
RestAction- Type:Ban
An unmodifiable ban object for the user banned from this guild- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.
-
retrieveBanById
@Nonnull @CheckReturnValue RestAction<Guild.Ban> retrieveBanById(@Nonnull String userId)
Retrieves aBanof the provided ID
If you wish to ban or unban a user, use eitherban(id, int)orunban(id).Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The ban list cannot be fetched due to a permission discrepancyUNKNOWN_BAN
Either the ban was removed before finishing the task or it did not exist in the first place
- Parameters:
userId- the id of the banned user- Returns:
RestAction- Type:Ban
An unmodifiable ban object for the user banned from this guild- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.
-
retrieveBan
@Nonnull @CheckReturnValue default RestAction<Guild.Ban> retrieveBan(@Nonnull User bannedUser)
Retrieves aBanof the providedUser
If you wish to ban or unban a user, use eitherban(User, int)orunban(User).Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The ban list cannot be fetched due to a permission discrepancyUNKNOWN_BAN
Either the ban was removed before finishing the task or it did not exist in the first place
- Parameters:
bannedUser- the banned user- Returns:
RestAction- Type:Ban
An unmodifiable ban object for the user banned from this guild- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.
-
retrievePrunableMemberCount
@Nonnull @CheckReturnValue RestAction<Integer> retrievePrunableMemberCount(int days)
The method calculates the amount of Members that would be pruned ifprune(int)was executed. Prunability is determined by a Member being offline for at least days days.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The prune count cannot be fetched due to a permission discrepancy
- Parameters:
days- Minimum number of days since a member has been offline to get affected.- Returns:
RestAction- Type: Integer
The amount of Members that would be affected.- Throws:
InsufficientPermissionException- If the account doesn't haveKICK_MEMBERPermission.IllegalArgumentException- If the provided days are less than1or more than30
-
getPublicRole
@Nonnull Role getPublicRole()
The @everyoneRoleof thisGuild.
This role is special because itspositionis calculated as-1. All other role positions are 0 or greater. This implies that the public role is always below any custom roles created in this Guild. Additionally, all members of this guild are implied to have this role so it is not included in the list returned byMember.getRoles().
The ID of this Role is the Guild's ID thus it is equivalent to usinggetRoleById(getIdLong()).- Returns:
- The @everyone
Role
-
getDefaultChannel
@Nullable TextChannel getDefaultChannel()
The defaultTextChannelfor aGuild.
This is the channel that the Discord client will default to opening when a Guild is opened for the first time when accepting an invite that is not directed at a specificTextChannel.Note: This channel is the first channel in the guild (ordered by position) that the
getPublicRole()has thePermission.MESSAGE_READin.- Returns:
- The
TextChannelrepresenting the default channel for this guild
-
getManager
@Nonnull GuildManager getManager()
Returns theGuildManagerfor this Guild, used to modify all properties and settings of the Guild.
You modify multiple fields in one request by chaining setters before callingRestAction.queue().- Returns:
- The Manager of this Guild
- Throws:
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_SERVER
-
retrieveAuditLogs
@Nonnull @CheckReturnValue AuditLogPaginationAction retrieveAuditLogs()
APaginationActionimplementation that allows toiterateover allAuditLogEntriesof this Guild.
This iterates from the most recent action to the first logged one. (Limit 90 days into history by discord api)Examples
public boolean isLogged(Guild guild, ActionType type, long targetId) { for (AuditLogEntry entry : guild.retrieveAuditLogs().cache(false)) { if (entry.getType() == type&& entry.getTargetIdLong() == targetId) return true; // The action is logged } return false; // nothing found in audit logs } publicList<AuditLogEntry> getActionsBy(Guild guild, User user) { return guild.retrieveAuditLogs().cache(false).stream() .filter(it-> it.getUser().equals(user)) .collect(Collectors.toList()); // collects actions done by user }- Returns:
AuditLogPaginationAction- Throws:
InsufficientPermissionException- If the currently logged in account does not have the permissionVIEW_AUDIT_LOGS
-
leave
@Nonnull @CheckReturnValue RestAction<Void> leave()
Used to leave a Guild. If the currently logged in account is the owner of this guild (getOwner()) then ownership of the Guild needs to be transferred to a differentMemberbefore leaving usingtransferOwnership(Member).- Returns:
RestAction- Type:Void- Throws:
IllegalStateException- Thrown if the currently logged in account is the Owner of this Guild.
-
delete
@Nonnull @CheckReturnValue RestAction<Void> delete()
Used to completely delete a Guild. This can only be done if the currently logged in account is the owner of the Guild.
If the account has MFA enabled, usedelete(String)instead to provide the MFA code.- Returns:
RestAction- Type:Void- Throws:
PermissionException- Thrown if the currently logged in account is not the owner of this Guild.IllegalStateException- If the currently logged in account has MFA enabled. (SelfUser.isMfaEnabled()).
-
delete
@Nonnull @CheckReturnValue RestAction<Void> delete(@Nullable String mfaCode)
Used to completely delete a guild. This can only be done if the currently logged in account is the owner of the Guild.
This method is specifically used for when MFA is enabled on the logged in accountSelfUser.isMfaEnabled(). If MFA is not enabled, usedelete().- Parameters:
mfaCode- The Multifactor Authentication code generated by an app like Google Authenticator.
This is not the MFA token given to you by Discord. The code is typically 6 characters long.- Returns:
RestAction- Type:Void- Throws:
PermissionException- Thrown if the currently logged in account is not the owner of this Guild.IllegalArgumentException- If the providedmfaCodeisnullor empty whenSelfUser.isMfaEnabled()is true.
-
getAudioManager
@Nonnull AudioManager getAudioManager()
TheAudioManagerthat represents the audio connection for this Guild.
If no AudioManager exists for this Guild, this will create a new one.
This operation is synchronized on all audio managers for this JDA instance, this means that calling getAudioManager() on any other guild while a thread is accessing this method may be locked.- Returns:
- The AudioManager for this Guild.
- See Also:
JDA.getAudioManagerCache()
-
getJDA
@Nonnull JDA getJDA()
Returns theJDAinstance of this Guild- Returns:
- the corresponding JDA instance
-
retrieveInvites
@Nonnull @CheckReturnValue RestAction<List<Invite>> retrieveInvites()
Retrieves allInvitesfor this guild.
RequiresMANAGE_SERVERin this guild. Will throw aInsufficientPermissionExceptionotherwise.To get all invites for a
GuildChanneluseGuildChannel.retrieveInvites()- Returns:
RestAction- Type: List<Invite>
The list of expanded Invite objects- Throws:
InsufficientPermissionException- if the account does not haveMANAGE_SERVERin this Guild.- See Also:
GuildChannel.retrieveInvites()
-
retrieveWebhooks
@Nonnull @CheckReturnValue RestAction<List<Webhook>> retrieveWebhooks()
Retrieves allWebhooksfor this Guild.
RequiresMANAGE_WEBHOOKSin this Guild.To get all webhooks for a specific
TextChannel, useTextChannel.retrieveWebhooks()- Returns:
RestAction- Type: List<Webhook>
A list of all Webhooks in this Guild.- Throws:
InsufficientPermissionException- if the account does not haveMANAGE_WEBHOOKSin this Guild.- See Also:
TextChannel.retrieveWebhooks()
-
getVoiceStates
@Nonnull List<GuildVoiceState> getVoiceStates()
A list containing theGuildVoiceStateof everyMemberin thisGuild.
This will never return an empty list because if it were empty, that would imply that there are noMembersin thisGuild, which is impossible.- Returns:
- Never-empty immutable list containing all the
GuildVoiceStateson thisGuild.
-
getVerificationLevel
@Nonnull Guild.VerificationLevel getVerificationLevel()
Returns the verification-Level of this Guild. Verification level is one of the factors that determines if a Member can send messages in a Guild.
For a short description of the different values, seeGuild.VerificationLevel.This value can be modified using
GuildManager.setVerificationLevel(net.dv8tion.jda.api.entities.Guild.VerificationLevel).- Returns:
- The Verification-Level of this Guild.
-
getDefaultNotificationLevel
@Nonnull Guild.NotificationLevel getDefaultNotificationLevel()
Returns the default message Notification-Level of this Guild. Notification level determines when Members get notification for messages. The value returned is the default level set for any new Members that join the Guild.
For a short description of the different values, seeNotificationLevel.This value can be modified using
GuildManager.setDefaultNotificationLevel(net.dv8tion.jda.api.entities.Guild.NotificationLevel).- Returns:
- The default message Notification-Level of this Guild.
-
getRequiredMFALevel
@Nonnull Guild.MFALevel getRequiredMFALevel()
Returns the level of multifactor authentication required to execute administrator restricted functions in this guild.
For a short description of the different values, seeMFALevel.This value can be modified using
GuildManager.setRequiredMFALevel(net.dv8tion.jda.api.entities.Guild.MFALevel).- Returns:
- The MFA-Level required by this Guild.
-
getExplicitContentLevel
@Nonnull Guild.ExplicitContentLevel getExplicitContentLevel()
The level of content filtering enabled in this Guild.
This decides which messages sent by which Members will be scanned for explicit content.- Returns:
ExplicitContentLevelfor this Guild
-
checkVerification
boolean checkVerification()
Checks if the current Verification-level of this guild allows JDA to send messages to it.- Returns:
- True if Verification-level allows sending of messages, false if not.
- See Also:
VerificationLevel Enum with a list of possible verification-levels and their requirements
-
isAvailable
@ForRemoval @Deprecated @DeprecatedSince("4.1.0") @ReplaceWith("getJDA().isUnavailable(guild.getIdLong())") boolean isAvailable()
Deprecated.This will be removed in a future version, unavailable guilds are now removed from cache. Replace withJDA.isUnavailable(long)Whether or not this Guild is available. A Guild can be unavailable, if the Discord server has problems.
If a Guild is unavailable, it will be removed from the guild cache. You cannot receive events for unavailable guilds.- Returns:
- If the Guild is available
-
retrieveMembers
@Nonnull CompletableFuture<Void> retrieveMembers()
Requests member chunks for this guild.
This returns a completed future if the member demand is already matched. Whenguild subscriptionsare disabled this will do nothing since member caching is disabled.Calling
CompletableFuture.cancel(boolean)will not cancel the chunking process.- Returns:
CompletableFuturerepresenting the chunking task
-
retrieveMember
@Nonnull default RestAction<Member> retrieveMember(@Nonnull User user)
Load the member for the specified user.
If the member is already loaded it will be retrieved fromgetMemberById(long)and immediately provided.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Parameters:
user- The user to load the member from- Returns:
RestAction- Type:Member- Throws:
IllegalArgumentException- If provided with null
-
retrieveMemberById
@Nonnull default RestAction<Member> retrieveMemberById(@Nonnull String id)
Load the member for the specified user.
If the member is already loaded it will be retrieved fromgetMemberById(long)and immediately provided.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Parameters:
id- The user id to load the member from- Returns:
RestAction- Type:Member- Throws:
IllegalArgumentException- If the provided id is empty or nullNumberFormatException- If the provided id is not a snowflake
-
retrieveMemberById
@Nonnull RestAction<Member> retrieveMemberById(long id)
Load the member for the specified user.
If the member is already loaded it will be retrieved fromgetMemberById(long)and immediately provided.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Parameters:
id- The user id to load the member from- Returns:
RestAction- Type:Member
-
retrieveOwner
@Nonnull default RestAction<Member> retrieveOwner()
Shortcut forguild.retrieveMemberById(guild.getOwnerIdLong()).
This will retrieve the current owner of the guild. It is possible that the owner of a guild is no longer a registered discord user in which case this will fail.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Returns:
RestAction- Type:Member- See Also:
getOwner(),getOwnerIdLong(),retrieveMemberById(long)
-
moveVoiceMember
@Nonnull @CheckReturnValue RestAction<Void> moveVoiceMember(@Nonnull Member member, @Nullable VoiceChannel voiceChannel)
Used to move aMemberfrom oneVoiceChannelto anotherVoiceChannel.
As a note, you cannot move a Member that isn't already in a VoiceChannel. Also they must be in a VoiceChannel in the same Guild as the one that you are moving them to.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be moved due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNELpermission was removedUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the taskUNKNOWN_CHANNEL
The specified channel was deleted before finishing the task
- Parameters:
member- TheMemberthat you are moving.voiceChannel- The destinationVoiceChannelto which the member is being moved to. Or null to perform a voice kick.- Returns:
RestAction- Throws:
IllegalStateException- If the Member isn't currently in a VoiceChannel in this Guild, orCacheFlag.VOICE_STATEis disabled.IllegalArgumentException-InsufficientPermissionException-- If this account doesn't have
Permission.VOICE_MOVE_OTHERSin the VoiceChannel that the Member is currently in. - If this account AND the Member being moved don't have
Permission.VOICE_CONNECTfor the destination VoiceChannel.
- If this account doesn't have
-
kickVoiceMember
@Nonnull @CheckReturnValue default RestAction<Void> kickVoiceMember(@Nonnull Member member)
Used to kick aMemberfrom aVoiceChannel.
As a note, you cannot kick a Member that isn't already in a VoiceChannel. Also they must be in a VoiceChannel in the same Guild.Equivalent to
moveVoiceMember(member, null).Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be moved due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the taskUNKNOWN_CHANNEL
The specified channel was deleted before finishing the task
- Parameters:
member- TheMemberthat you are moving.- Returns:
RestAction- Throws:
IllegalStateException- If the Member isn't currently in a VoiceChannel in this Guild, orCacheFlag.VOICE_STATEis disabled.IllegalArgumentException-InsufficientPermissionException- If this account doesn't havePermission.VOICE_MOVE_OTHERSin the VoiceChannel that the Member is currently in.
-
modifyNickname
@Nonnull @CheckReturnValue AuditableRestAction<Void> modifyNickname(@Nonnull Member member, @Nullable String nickname)
Changes the Member's nickname in this guild. The nickname is visible to all members of this guild.To change the nickname for the currently logged in account only the Permission
NICKNAME_CHANGEis required.
To change the nickname of anyMemberfor thisGuildthe PermissionNICKNAME_MANAGEis required.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The nickname of the target Member is not modifiable due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
member- TheMemberfor which the nickname should be changed.nickname- The new nickname of theMember, providenullor an empty String to reset the nickname- Returns:
AuditableRestAction- Throws:
IllegalArgumentException- If the specifiedMemberis not from the sameGuild. Or if the provided member isnullInsufficientPermissionException-- If attempting to set nickname for self and the logged in account has neither
Permission.NICKNAME_CHANGEorPermission.NICKNAME_MANAGE - If attempting to set nickname for another member and the logged in account does not have
Permission.NICKNAME_MANAGE
- If attempting to set nickname for self and the logged in account has neither
HierarchyException- If attempting to set nickname for another member and the logged in account cannot manipulate the other user due to permission hierarchy position.
SeeMember.canInteract(Member)
-
prune
@Nonnull @CheckReturnValue AuditableRestAction<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 useretrievePrunableMemberCount(int)to determine how many Members would be pruned if you were to call this method.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The prune cannot finished due to a permission discrepancy
- Parameters:
days- Minimum number of days since a member has been offline to get affected.- Returns:
AuditableRestAction- Type: Integer
The amount of Members that were pruned from the Guild.- Throws:
InsufficientPermissionException- If the account doesn't haveKICK_MEMBERPermission.IllegalArgumentException- If the provided days are less than1or more than30
-
kick
@Nonnull @CheckReturnValue AuditableRestAction<Void> kick(@Nonnull Member member, @Nullable String reason)
Kicks theMemberfrom theGuild.Note:
getMembers()will still contain theUseruntil Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be kicked due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
member- TheMemberto kick from the from theGuild.reason- The reason for this action ornullif there is no specified reason- Returns:
AuditableRestActionKicks the provided Member from the current Guild- Throws:
IllegalArgumentException- If the provided member is not a Member of this Guild or isnullInsufficientPermissionException- If the logged in account does not have thePermission.KICK_MEMBERSpermission.HierarchyException- If the logged in account cannot kick the other member due to permission hierarchy position.
SeeMember.canInteract(Member)
-
kick
@Nonnull @CheckReturnValue AuditableRestAction<Void> kick(@Nonnull String userId, @Nullable String reason)
Kicks theMemberspecified by the userId from the from theGuild.Note:
getMembers()will still contain theUseruntil Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be kicked due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
userId- The id of theUserto kick from the from theGuild.reason- The reason for this action ornullif there is no specified reason- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.KICK_MEMBERSpermission.HierarchyException- If the logged in account cannot kick the other member due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException- If the user for the provided id cannot be kicked from this Guild or the provideduserIdis blank/null.
-
kick
@Nonnull @CheckReturnValue default AuditableRestAction<Void> kick(@Nonnull Member member)
Kicks aMemberfrom theGuild.Note:
getMembers()will still contain theUseruntil Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be kicked due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
member- TheMemberto kick from the from theGuild.- Returns:
AuditableRestActionKicks the provided Member from the current Guild- Throws:
IllegalArgumentException- If the provided member is not a Member of this Guild or isnullInsufficientPermissionException- If the logged in account does not have thePermission.KICK_MEMBERSpermission.HierarchyException- If the logged in account cannot kick the other member due to permission hierarchy position.
SeeMember.canInteract(Member)
-
kick
@Nonnull @CheckReturnValue default AuditableRestAction<Void> kick(@Nonnull String userId)
Kicks theMemberspecified by the userId from the from theGuild.Note:
getMembers()will still contain theUseruntil Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be kicked due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
userId- The id of theUserto kick from the from theGuild.- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.KICK_MEMBERSpermission.HierarchyException- If the logged in account cannot kick the other member due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException- If the userId provided does not correspond to a Member in this Guild or the provideduserIdis blank/null.
-
ban
@Nonnull @CheckReturnValue AuditableRestAction<Void> ban(@Nonnull User user, int delDays, @Nullable String reason)
Bans theUserand 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.You can unban a user with
Guild.unban(User).Note:
getMembers()will still contain theUser'sMemberobject (if the User was in the Guild) until Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be banned due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
user- TheUserto ban.delDays- The history of messages, in days, that will be deleted.reason- The reason for this action ornullif there is no specified reason- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.HierarchyException- If the logged in account cannot ban the other user due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException-- If the provided amount of days (delDays) is less than 0.
- If the provided amount of days (delDays) is bigger than 7.
- If the provided user is null
-
ban
@Nonnull @CheckReturnValue AuditableRestAction<Void> ban(@Nonnull String userId, int delDays, @Nullable String reason)
Bans the 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.You can unban a user with
Guild.unban(User).Note:
getMembers()will still contain theUser'sMemberobject (if the User was in the Guild) until Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be banned due to a permission discrepancyUNKNOWN_USER
The specified User does not exit
- Parameters:
userId- The id of theUserto ban.delDays- The history of messages, in days, that will be deleted.reason- The reason for this action ornullif there is no specified reason- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.HierarchyException- If the logged in account cannot ban the other user due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException-- If the provided amount of days (delDays) is less than 0.
- If the provided amount of days (delDays) is bigger than 7.
- If the provided userId is null
-
ban
@Nonnull @CheckReturnValue default AuditableRestAction<Void> ban(@Nonnull Member member, int delDays, @Nullable String reason)
Bans theMemberand 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.You can unban a user with
Guild.unban(User).Note:
getMembers()will still contain theMemberuntil Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be banned due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
member- TheMemberto ban.delDays- The history of messages, in days, that will be deleted.reason- The reason for this action ornullif there is no specified reason- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.HierarchyException- If the logged in account cannot ban the other user due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException-- If the provided amount of days (delDays) is less than 0.
- If the provided amount of days (delDays) is bigger than 7.
- If the provided member is
null
-
ban
@Nonnull @CheckReturnValue default AuditableRestAction<Void> ban(@Nonnull Member member, int delDays)
Bans theMemberand 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.You can unban a user with
Guild.unban(User).Note:
getMembers()will still contain theMemberuntil Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be banned due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
member- TheMemberto ban.delDays- The history of messages, in days, that will be deleted.- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.HierarchyException- If the logged in account cannot ban the other user due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException-- If the provided amount of days (delDays) is less than 0.
- If the provided amount of days (delDays) is bigger than 7.
- If the provided member is
null
-
ban
@Nonnull @CheckReturnValue default AuditableRestAction<Void> ban(@Nonnull User user, int delDays)
Bans theMemberand 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.You can unban a user with
Guild.unban(User).Note:
getMembers()will still contain theMemberuntil Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be banned due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
user- TheUserto ban.delDays- The history of messages, in days, that will be deleted.- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.HierarchyException- If the logged in account cannot ban the other user due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException-- If the provided amount of days (delDays) is less than 0.
- If the provided amount of days (delDays) is bigger than 7.
- If the provided user is
null
-
ban
@Nonnull @CheckReturnValue default AuditableRestAction<Void> ban(@Nonnull String userId, int delDays)
Bans the 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.You can unban a user with
Guild.unban(User).Note:
getMembers()will still contain theUser'sMemberobject (if the User was in the Guild) until Discord sends theGuildMemberLeaveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be banned due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
userId- The id of theUserto ban.delDays- The history of messages, in days, that will be deleted.- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.HierarchyException- If the logged in account cannot ban the other user due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException-- If the provided amount of days (delDays) is less than 0.
- If the provided amount of days (delDays) is bigger than 7.
- If the provided userId is
null
-
unban
@Nonnull @CheckReturnValue default AuditableRestAction<Void> unban(@Nonnull User user)
Unbans the specifiedUserfrom this Guild.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be unbanned due to a permission discrepancyUNKNOWN_USER
The specified User is invalid
- Parameters:
user- The id of theUserto unban.- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.IllegalArgumentException- If the provided user is null
-
unban
@Nonnull @CheckReturnValue AuditableRestAction<Void> unban(@Nonnull String userId)
Unbans the a user specified by the userId from this Guild.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be unbanned due to a permission discrepancyUNKNOWN_USER
The specified User does not exist
- Parameters:
userId- The id of theUserto unban.- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.IllegalArgumentException- If the provided id is null or blank
-
deafen
@Nonnull @CheckReturnValue AuditableRestAction<Void> deafen(@Nonnull Member member, boolean deafen)
Sets the Guild Deafened state state of theMemberbased on the provided boolean.Note: The Member's
GuildVoiceState.isGuildDeafened()value won't change until JDA receives theGuildVoiceGuildDeafenEventevent related to this change.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be deafened due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the taskUSER_NOT_CONNECTED
The specified Member is not connected to a voice channel
- Parameters:
member- TheMemberwho'sVoiceStateis being changed.deafen- Whether thisMembershould be deafened or undeafened.- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.VOICE_DEAF_OTHERSpermission.IllegalArgumentException- If the provided member is not from this Guild or null.IllegalStateException- If the provided member is not currently connected to a voice channel.
-
mute
@Nonnull @CheckReturnValue AuditableRestAction<Void> mute(@Nonnull Member member, boolean mute)
Sets the Guild Muted state state of theMemberbased on the provided boolean.Note: The Member's
GuildVoiceState.isGuildMuted()value won't change until JDA receives theGuildVoiceGuildMuteEventevent related to this change.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be muted due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the taskUSER_NOT_CONNECTED
The specified Member is not connected to a voice channel
- Parameters:
member- TheMemberwho'sVoiceStateis being changed.mute- Whether thisMembershould be muted or unmuted.- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.VOICE_DEAF_OTHERSpermission.IllegalArgumentException- If the provided member is not from this Guild or null.IllegalStateException- If the provided member is not currently connected to a voice channel.
-
addRoleToMember
@Nonnull @CheckReturnValue AuditableRestAction<Void> addRoleToMember(@Nonnull Member member, @Nonnull Role role)
Atomically assigns the providedRoleto the specifiedMember.
This can be used together with other role modification methods as it does not require an updated cache!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
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the taskUNKNOWN_ROLE
If the specified Role does not exist
- Parameters:
member- The target member who will receive the new rolerole- The role which should be assigned atomically- Returns:
AuditableRestAction- Throws:
IllegalArgumentException-- If the specified member/role are not from the current Guild
- Either member or role are
null
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESHierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
-
addRoleToMember
@Nonnull @CheckReturnValue default AuditableRestAction<Void> addRoleToMember(long userId, @Nonnull Role role)
Atomically assigns the providedRoleto the specified member by their user id.
This can be used together with other role modification methods as it does not require an updated cache!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
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the taskUNKNOWN_ROLE
If the specified Role does not exist
- Parameters:
userId- The id of the target member who will receive the new rolerole- The role which should be assigned atomically- Returns:
AuditableRestAction- Throws:
IllegalArgumentException-- If the specified role is not from the current Guild
- If the role is
null
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESHierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
-
addRoleToMember
@Nonnull @CheckReturnValue default AuditableRestAction<Void> addRoleToMember(@Nonnull String userId, @Nonnull Role role)
Atomically assigns the providedRoleto the specified member by their user id.
This can be used together with other role modification methods as it does not require an updated cache!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
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the taskUNKNOWN_ROLE
If the specified Role does not exist
- Parameters:
userId- The id of the target member who will receive the new rolerole- The role which should be assigned atomically- Returns:
AuditableRestAction- Throws:
IllegalArgumentException-- If the specified role is not from the current Guild
- If the role is
null
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESHierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
-
removeRoleFromMember
@Nonnull @CheckReturnValue AuditableRestAction<Void> removeRoleFromMember(@Nonnull Member member, @Nonnull Role role)
Atomically removes the providedRolefrom the specifiedMember.
This can be used together with other role modification methods as it does not require an updated cache!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
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the taskUNKNOWN_ROLE
If the specified Role does not exist
- Parameters:
member- The target member who will lose the specified rolerole- The role which should be removed atomically- Returns:
AuditableRestAction- Throws:
IllegalArgumentException-- If the specified member/role are not from the current Guild
- Either member or role are
null
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESHierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
-
removeRoleFromMember
@Nonnull @CheckReturnValue default AuditableRestAction<Void> removeRoleFromMember(long userId, @Nonnull Role role)
Atomically removes the providedRolefrom the specified member by their user id.
This can be used together with other role modification methods as it does not require an updated cache!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
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the taskUNKNOWN_ROLE
If the specified Role does not exist
- Parameters:
userId- The id of the target member who will lose the specified rolerole- The role which should be removed atomically- Returns:
AuditableRestAction- Throws:
IllegalArgumentException-- If the specified role is not from the current Guild
- The role is
null
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESHierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
-
removeRoleFromMember
@Nonnull @CheckReturnValue default AuditableRestAction<Void> removeRoleFromMember(@Nonnull String userId, @Nonnull Role role)
Atomically removes the providedRolefrom the specified member by their user id.
This can be used together with other role modification methods as it does not require an updated cache!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
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the taskUNKNOWN_ROLE
If the specified Role does not exist
- Parameters:
userId- The id of the target member who will lose the specified rolerole- The role which should be removed atomically- Returns:
AuditableRestAction- Throws:
IllegalArgumentException-- If the specified role is not from the current Guild
- The role is
null
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESHierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
-
modifyMemberRoles
@Nonnull @CheckReturnValue AuditableRestAction<Void> modifyMemberRoles(@Nonnull Member member, @Nullable Collection<Role> rolesToAdd, @Nullable Collection<Role> rolesToRemove)
Modifies theRolesof the specifiedMemberby adding and removing a collection of roles.
None of the provided roles may be the Public Role of the current Guild.
If a role is both inrolesToAddandrolesToRemoveit will be removed.Warning
This may not be used together with any other role add/remove/modify methods for the same Member within one event listener cycle! The changes made by this require cache updates which are triggered by lifecycle events which are received later. This may only be called again once the specific Member has been updated by aGenericGuildMemberEventtargeting the same Member.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the task
Example
public static void promote(Member member) { Guild guild = member.getGuild(); List<Role> pleb = guild.getRolesByName("Pleb", true); // remove all roles named "pleb" List<Role> knight = guild.getRolesByName("Knight", true); // add all roles named "knight" // update roles in single request guild.modifyMemberRoles(member, knight, pleb).queue(); }- Parameters:
member- TheMemberthat should be modifiedrolesToAdd- ACollectionofRolesto add to the current Roles the specifiedMemberalready has, or nullrolesToRemove- ACollectionofRolesto remove from the current Roles the specifiedMemberalready has, or null- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESHierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in accountIllegalArgumentException-- If the target member is
null - If any of the specified Roles is managed or is the
Public Roleof the Guild
- If the target member is
-
modifyMemberRoles
@Nonnull @CheckReturnValue default AuditableRestAction<Void> modifyMemberRoles(@Nonnull Member member, @Nonnull Role... roles)
Modifies the completeRoleset of the specifiedMember
The provided roles will replace all current Roles of the specified Member.Warning
This may not be used together with any other role add/remove/modify methods for the same Member within one event listener cycle! The changes made by this require cache updates which are triggered by lifecycle events which are received later. This may only be called again once the specific Member has been updated by aGenericGuildMemberEventtargeting the same Member.The new roles must not contain the Public Role of the Guild
Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the task
Example
public static void removeRoles(Member member) { Guild guild = member.getGuild(); // pass no role, this means we set the roles of the member to an empty array. guild.modifyMemberRoles(member).queue(); }- Parameters:
member- AMemberof which to override the Roles ofroles- New collection ofRolesfor the specified Member- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESHierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in accountIllegalArgumentException-- See Also:
modifyMemberRoles(Member, Collection)
-
modifyMemberRoles
@Nonnull @CheckReturnValue AuditableRestAction<Void> modifyMemberRoles(@Nonnull Member member, @Nonnull Collection<Role> roles)
Modifies the completeRoleset of the specifiedMember
The provided roles will replace all current Roles of the specified Member.The new roles must not contain the Public Role of the Guild
Warning
This may not be used together with any other role add/remove/modify methods for the same Member within one event listener cycle! The changes made by this require cache updates which are triggered by lifecycle events which are received later. This may only be called again once the specific Member has been updated by aGenericGuildMemberEventtargeting the same Member.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the task
Example
public static void makeModerator(Member member) { Guild guild = member.getGuild(); List<Role> roles = new ArrayList<>(member.getRoles()); // modifiable copy List<Role> modRoles = guild.getRolesByName("moderator", true); // get roles with name "moderator" roles.addAll(modRoles); // add new roles // update the member with new roles guild.modifyMemberRoles(member, roles).queue(); }- Parameters:
member- AMemberof which to override the Roles ofroles- New collection ofRolesfor the specified Member- Returns:
AuditableRestAction- Throws:
InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESHierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in accountIllegalArgumentException-- See Also:
modifyMemberRoles(Member, Collection)
-
transferOwnership
@Nonnull @CheckReturnValue AuditableRestAction<Void> transferOwnership(@Nonnull Member newOwner)
Transfers the Guild ownership to the specifiedMember
Only available if the currently logged in account is the owner of this GuildPossible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The currently logged in account lost ownership before completing the taskUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the task
- Parameters:
newOwner- Not-null Member to transfer ownership to- Returns:
AuditableRestAction- Throws:
PermissionException- If the currently logged in account is not the owner of this GuildIllegalArgumentException-- If the specified Member is
nullor not from the same Guild - If the specified Member already is the Guild owner
- If the specified Member is a bot account (
AccountType.BOT)
- If the specified Member is
-
createTextChannel
@Nonnull @CheckReturnValue ChannelAction<TextChannel> createTextChannel(@Nonnull String name)
Creates a newTextChannelin this Guild. For this to be successful, the logged in account has to have theMANAGE_CHANNELPermissionPossible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
name- The name of the TextChannel to create- Returns:
- A specific
ChannelAction
This action allows to set fields for the new TextChannel before creating it - Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_CHANNELpermissionIllegalArgumentException- If the provided name isnullor empty or greater than 100 characters in length
-
createVoiceChannel
@Nonnull @CheckReturnValue ChannelAction<VoiceChannel> createVoiceChannel(@Nonnull String name)
Creates a newVoiceChannelin this Guild. For this to be successful, the logged in account has to have theMANAGE_CHANNELPermission.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
name- The name of the VoiceChannel to create- Returns:
- A specific
ChannelAction
This action allows to set fields for the new VoiceChannel before creating it - Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_CHANNELpermissionIllegalArgumentException- If the provided name isnullor empty or greater than 100 characters in length
-
createCategory
@Nonnull @CheckReturnValue ChannelAction<Category> createCategory(@Nonnull String name)
Creates a newCategoryin this Guild. For this to be successful, the logged in account has to have theMANAGE_CHANNELPermission.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
name- The name of the Category to create- Returns:
- A specific
ChannelAction
This action allows to set fields for the new Category before creating it - Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_CHANNELpermissionIllegalArgumentException- If the provided name isnullor empty or greater than 100 characters in length
-
createCopyOfChannel
@Nonnull @CheckReturnValue default <T extends GuildChannel> ChannelAction<T> createCopyOfChannel(@Nonnull T channel)
Creates a copy of the specifiedGuildChannelin thisGuild.
The provided channel need not be in the same Guild for this to work!This copies the following elements:
- Name
- Parent Category (if present)
- Voice Elements (Bitrate, Userlimit)
- Text Elements (Topic, NSFW)
- All permission overrides for Members/Roles
Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceeded
- Type Parameters:
T- The channel type- Parameters:
channel- TheGuildChannelto use for the copy template- Returns:
- A specific
ChannelAction
This action allows to set fields for the new GuildChannel before creating it! - Throws:
IllegalArgumentException- If the provided channel isnullInsufficientPermissionException- If the currently logged in account does not have theMANAGE_CHANNELPermission- Since:
- 3.1
- See Also:
createTextChannel(String),createVoiceChannel(String),ChannelAction
-
createRole
@Nonnull @CheckReturnValue RoleAction createRole()
Creates a newRolein this Guild.
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 theMANAGE_ROLESPermissionPossible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The role could not be created due to a permission discrepancyMAX_ROLES_PER_GUILD
There are too many roles in this Guild
- Returns:
RoleAction
Creates a new role with previously selected field values- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_ROLESPermission
-
createCopyOfRole
@Nonnull @CheckReturnValue default RoleAction createCopyOfRole(@Nonnull Role role)
Creates a newRolein thisGuildwith the same settings as the givenRole.
The position of the specified Role does not matter in this case!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 theMANAGE_ROLESPermission and allPermissionsthe givenRolehas.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The role could not be created due to a permission discrepancyMAX_ROLES_PER_GUILD
There are too many roles in this Guild
- Parameters:
role- TheRolethat should be copied- Returns:
RoleAction
RoleAction with already copied values from the specifiedRole- Throws:
InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_ROLESPermission and every Permission the provided Role hasIllegalArgumentException- If the specified role isnull
-
createEmote
@Nonnull @CheckReturnValue AuditableRestAction<Emote> createEmote(@Nonnull String name, @Nonnull Icon icon, @Nonnull Role... roles)
Creates a newEmotein this Guild.
If one or more Roles are specified the new Emote will only be available to Members with any of the specified Roles (seeMember.canInteract(Emote))
For this to be successful, the logged in account has to have theMANAGE_EMOTESPermission.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_EMOJIfeature (seeGuild.getFeatures()).
Due to simplicity we do not check for these limits.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The emote could not be created due to a permission discrepancy
- Parameters:
name- The name for the new Emoteicon- TheIconfor the new Emoteroles- TheRolesthe new Emote should be restricted to
If no roles are provided the Emote will be available to all Members of this Guild- Returns:
AuditableRestAction- Type:Emote- Throws:
InsufficientPermissionException- If the logged in account does not have theMANAGE_EMOTESPermission
-
modifyCategoryPositions
@Nonnull @CheckReturnValue ChannelOrderAction modifyCategoryPositions()
Modifies the positional order ofGuild.getCategories()using a specificRestActionextension to allow moving Channelsup/downortoa specific position.
This uses ascending order with a 0 based index.Possible
ErrorResponsesinclude:UNNKOWN_CHANNEL
One of the channels has been deleted before the completion of the taskMISSING_ACCESS
The currently logged in account was removed from the Guild
- Returns:
ChannelOrderAction- Type:Category
-
modifyTextChannelPositions
@Nonnull @CheckReturnValue ChannelOrderAction modifyTextChannelPositions()
Modifies the positional order ofGuild.getTextChannels()using a specificRestActionextension to allow moving Channelsup/downortoa specific position.
This uses ascending order with a 0 based index.Possible
ErrorResponsesinclude:UNNKOWN_CHANNEL
One of the channels has been deleted before the completion of the taskMISSING_ACCESS
The currently logged in account was removed from the Guild
- Returns:
ChannelOrderAction- Type:TextChannel
-
modifyVoiceChannelPositions
@Nonnull @CheckReturnValue ChannelOrderAction modifyVoiceChannelPositions()
Modifies the positional order ofGuild.getVoiceChannels()using a specificRestActionextension to allow moving Channelsup/downortoa specific position.
This uses ascending order with a 0 based index.Possible
ErrorResponsesinclude:UNNKOWN_CHANNEL
One of the channels has been deleted before the completion of the taskMISSING_ACCESS
The currently logged in account was removed from the Guild
- Returns:
ChannelOrderAction- Type:VoiceChannel
-
modifyTextChannelPositions
@Nonnull @CheckReturnValue CategoryOrderAction modifyTextChannelPositions(@Nonnull Category category)
Modifies the positional order ofCategory#getTextChannels()using an extension ofChannelOrderActionspecialized for ordering the nestedTextChannelsof thisCategory.
LikeChannelOrderAction, the returnedCategoryOrderActioncan be used to move TextChannelsup,down, ortoa specific position.
This uses ascending order with a 0 based index.Possible
ErrorResponsesinclude:UNNKOWN_CHANNEL
One of the channels has been deleted before the completion of the task.MISSING_ACCESS
The currently logged in account was removed from the Guild.
- Parameters:
category- TheCategoryto orderTextChannelsfrom.- Returns:
CategoryOrderAction- Type:TextChannel
-
modifyVoiceChannelPositions
@Nonnull @CheckReturnValue CategoryOrderAction modifyVoiceChannelPositions(@Nonnull Category category)
Modifies the positional order ofCategory#getVoiceChannels()using an extension ofChannelOrderActionspecialized for ordering the nestedVoiceChannelsof thisCategory.
LikeChannelOrderAction, the returnedCategoryOrderActioncan be used to move VoiceChannelsup,down, ortoa specific position.
This uses ascending order with a 0 based index.Possible
ErrorResponsesinclude:UNNKOWN_CHANNEL
One of the channels has been deleted before the completion of the task.MISSING_ACCESS
The currently logged in account was removed from the Guild.
- Parameters:
category- TheCategoryto orderVoiceChannelsfrom.- Returns:
CategoryOrderAction- Type:VoiceChannels
-
modifyRolePositions
@Nonnull @CheckReturnValue default RoleOrderAction modifyRolePositions()
Modifies the positional order ofGuild.getRoles()using a specificRestActionextension to allow moving Rolesup/downortoa specific position.This uses ascending ordering which means the lowest role is first!
This means the highest role appears at indexn - 1and the lower role at index0.
ProvidingtruetomodifyRolePositions(boolean)will result in the ordering being in ascending order, with the lower role at indexn - 1and the highest at index0.
As a note:Member.getRoles()andGuild.getRoles()are both in descending order.Possible
ErrorResponsesinclude:UNKNOWN_ROLE
One of the roles was deleted before the completion of the taskMISSING_ACCESS
The currently logged in account was removed from the Guild
- Returns:
RoleOrderAction
-
modifyRolePositions
@Nonnull @CheckReturnValue RoleOrderAction modifyRolePositions(boolean useAscendingOrder)
Modifies the positional order ofGuild.getRoles()using a specificRestActionextension to allow moving Rolesup/downortoa specific position.Possible
ErrorResponsesinclude:UNKNOWN_ROLE
One of the roles was deleted before the completion of the taskMISSING_ACCESS
The currently logged in account was removed from the Guild
- Parameters:
useAscendingOrder- Defines the ordering of the OrderAction. Iffalse, the OrderAction will be in the ordering defined by Discord for roles, which is Descending. This means that the highest role appears at index0and the lowest role at indexn - 1. Providingtruewill result in the ordering being in ascending order, with the lower role at index0and the highest at indexn - 1.
As a note:Member.getRoles()andGuild.getRoles()are both in descending order.- Returns:
RoleOrderAction
-
-