Interface Guild

    • Method Detail

      • retrieveCommandById

        @Nonnull
        @CheckReturnValue
        RestAction<Command> retrieveCommandById​(@Nonnull
                                                java.lang.String id)
        Retrieves the existing Command instance by id.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        id - The command id
        Returns:
        RestAction - Type: Command
        Throws:
        java.lang.IllegalArgumentException - If the provided id is not a valid snowflake
      • upsertCommand

        @Nonnull
        @CheckReturnValue
        CommandCreateAction upsertCommand​(@Nonnull
                                          CommandData command)
        Creates or updates a command.
        If a command with the same name exists, it will be replaced.

        To specify a complete list of all commands you can use updateCommands() instead.

        You need the OAuth2 scope "applications.commands" in order to add commands to a guild.

        Parameters:
        command - The CommandData for the command
        Returns:
        CommandCreateAction
        Throws:
        java.lang.IllegalArgumentException - If null is provided
      • upsertCommand

        @Nonnull
        @CheckReturnValue
        default CommandCreateAction upsertCommand​(@Nonnull
                                                  java.lang.String name,
                                                  @Nonnull
                                                  java.lang.String description)
        Creates or updates a command.
        If a command with the same name exists, it will be replaced.

        To specify a complete list of all commands you can use updateCommands() instead.

        You need the OAuth2 scope "applications.commands" in order to add commands to a guild.

        Parameters:
        name - The lowercase alphanumeric (with dash) name, 1-32 characters
        description - The description for the command, 1-100 characters
        Returns:
        CommandCreateAction
        Throws:
        java.lang.IllegalArgumentException - If null is provided or the name/description do not meet the requirements
      • updateCommands

        @Nonnull
        @CheckReturnValue
        CommandListUpdateAction updateCommands()
        Configures the complete list of guild commands.
        This will replace the existing command list for this guild. You should only use this once on startup!

        You need the OAuth2 scope "applications.commands" in order to add commands to a guild.

        Examples

        
         // Set list to 2 commands
         guild.updateCommands()
           .addCommands(new CommandData("ping", "Gives the current ping"))
           .addCommands(new CommandData("ban", "Ban the target user")
             .addOption(OptionType.USER, "user", "The user to ban", true))
           .queue();
         // Delete all commands
         guild.updateCommands().queue();
         
        Returns:
        CommandListUpdateAction
      • editCommandById

        @Nonnull
        @CheckReturnValue
        CommandEditAction editCommandById​(@Nonnull
                                          java.lang.String id)
        Edit an existing command by id.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        id - The id of the command to edit
        Returns:
        CommandEditAction used to edit the command
        Throws:
        java.lang.IllegalArgumentException - If the provided id is not a valid snowflake
      • editCommandById

        @Nonnull
        @CheckReturnValue
        default CommandEditAction editCommandById​(long id)
        Edit an existing command by id.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        id - The id of the command to edit
        Returns:
        CommandEditAction used to edit the command
      • deleteCommandById

        @Nonnull
        @CheckReturnValue
        RestAction<java.lang.Void> deleteCommandById​(@Nonnull
                                                     java.lang.String commandId)
        Delete the command for this id.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        commandId - The id of the command that should be deleted
        Returns:
        RestAction
        Throws:
        java.lang.IllegalArgumentException - If the provided id is not a valid snowflake
      • deleteCommandById

        @Nonnull
        @CheckReturnValue
        default RestAction<java.lang.Void> deleteCommandById​(long commandId)
        Delete the command for this id.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        commandId - The id of the command that should be deleted
        Returns:
        RestAction
      • retrieveCommandPrivilegesById

        @Nonnull
        @CheckReturnValue
        RestAction<java.util.List<CommandPrivilege>> retrieveCommandPrivilegesById​(@Nonnull
                                                                                   java.lang.String commandId)
        Retrieves the CommandPrivileges for the command with the specified ID.

        These privileges are used to restrict who can use commands through Role/User whitelists/blacklists.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        commandId - The id of the command, this can be global or guild command
        Returns:
        RestAction - Type: List of CommandPrivilege
        Throws:
        java.lang.IllegalArgumentException - If the id is not a valid snowflake
      • retrieveCommandPrivilegesById

        @Nonnull
        @CheckReturnValue
        default RestAction<java.util.List<CommandPrivilege>> retrieveCommandPrivilegesById​(long commandId)
        Retrieves the CommandPrivileges for the command with the specified ID.

        These privileges are used to restrict who can use commands through Role/User whitelists/blacklists.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        commandId - The id of the command, this can be global or guild command
        Returns:
        RestAction - Type: List of CommandPrivilege
        Throws:
        java.lang.IllegalArgumentException - If the id is not a valid snowflake
      • retrieveCommandPrivileges

        @Nonnull
        @CheckReturnValue
        RestAction<java.util.Map<java.lang.String,​java.util.List<CommandPrivilege>>> retrieveCommandPrivileges()
        Retrieves the CommandPrivileges for the commands in this guild.
        The RestAction provides a Map from the command id to the list of privileges.

        These privileges are used to restrict who can use commands through Role/User whitelists/blacklists.

        Returns:
        RestAction - Type: Map from String Command ID to List of CommandPrivilege
      • updateCommandPrivilegesById

        @Nonnull
        @CheckReturnValue
        RestAction<java.util.List<CommandPrivilege>> updateCommandPrivilegesById​(@Nonnull
                                                                                 java.lang.String id,
                                                                                 @Nonnull
                                                                                 java.util.Collection<? extends CommandPrivilege> privileges)
        Updates the list of CommandPrivileges for the specified command.

        These privileges are used to restrict who can use commands through Role/User whitelists/blacklists.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        id - The id of the command, this can be global or guild command
        privileges - Complete list of up to 10 CommandPrivileges for this command
        Returns:
        RestAction - Type: List or CommandPrivilege The updated list of privileges for this command.
        Throws:
        java.lang.IllegalArgumentException - If null is provided, the id is not a valid snowflake, or more than 10 privileges are provided
      • updateCommandPrivilegesById

        @Nonnull
        @CheckReturnValue
        default RestAction<java.util.List<CommandPrivilege>> updateCommandPrivilegesById​(@Nonnull
                                                                                         java.lang.String id,
                                                                                         @Nonnull
                                                                                         CommandPrivilege... privileges)
        Updates the list of CommandPrivileges for the specified command.

        These privileges are used to restrict who can use commands through Role/User whitelists/blacklists.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        id - The id of the command, this can be global or guild command
        privileges - Complete list of up to 10 CommandPrivileges for this command
        Returns:
        RestAction - Type: List or CommandPrivilege The updated list of privileges for this command.
        Throws:
        java.lang.IllegalArgumentException - If null is provided, the id is not a valid snowflake, or more than 10 privileges are provided
      • updateCommandPrivilegesById

        @Nonnull
        @CheckReturnValue
        default RestAction<java.util.List<CommandPrivilege>> updateCommandPrivilegesById​(long id,
                                                                                         @Nonnull
                                                                                         java.util.Collection<? extends CommandPrivilege> privileges)
        Updates the list of CommandPrivileges for the specified command.

        These privileges are used to restrict who can use commands through Role/User whitelists/blacklists.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        id - The id of the command, this can be global or guild command
        privileges - Complete list of up to 10 CommandPrivileges for this command
        Returns:
        RestAction - Type: List or CommandPrivilege The updated list of privileges for this command.
        Throws:
        java.lang.IllegalArgumentException - If null is provided or more than 10 privileges are provided
      • updateCommandPrivilegesById

        @Nonnull
        @CheckReturnValue
        default RestAction<java.util.List<CommandPrivilege>> updateCommandPrivilegesById​(long id,
                                                                                         @Nonnull
                                                                                         CommandPrivilege... privileges)
        Updates the list of CommandPrivileges for the specified command.

        These privileges are used to restrict who can use commands through Role/User whitelists/blacklists.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        id - The id of the command, this can be global or guild command
        privileges - Complete list of up to 10 CommandPrivileges for this command
        Returns:
        RestAction - Type: List or CommandPrivilege The updated list of privileges for this command.
        Throws:
        java.lang.IllegalArgumentException - If null is provided or more than 10 privileges are provided
      • updateCommandPrivileges

        @Nonnull
        @CheckReturnValue
        RestAction<java.util.Map<java.lang.String,​java.util.List<CommandPrivilege>>> updateCommandPrivileges​(@Nonnull
                                                                                                                   java.util.Map<java.lang.String,​java.util.Collection<? extends CommandPrivilege>> privileges)
        Updates the list of CommandPrivileges for the specified commands.
        The argument for this function is a Map similar to the one returned by retrieveCommandPrivileges().

        These privileges are used to restrict who can use commands through Role/User whitelists/blacklists.

        If there is no command with the provided ID, this RestAction fails with ErrorResponse.UNKNOWN_COMMAND

        Parameters:
        privileges - Complete map of CommandPrivileges for each command
        Returns:
        RestAction - Type: Map from String Command ID to List of CommandPrivilege The updated map of command privileges for this guild.
        Throws:
        java.lang.IllegalArgumentException - If null is provided, any of the map keys is not a valid snowflake, or more than 10 privileges are provided for any command
      • retrieveRegions

        @Nonnull
        @CheckReturnValue
        default RestAction<java.util.EnumSet<Region>> retrieveRegions()
        Retrieves the available regions for this Guild
        Shortcut for retrieveRegions(true)
        This will include deprecated voice regions by default.
        Returns:
        RestAction - Type EnumSet
      • retrieveRegions

        @Nonnull
        @CheckReturnValue
        RestAction<java.util.EnumSet<Region>> retrieveRegions​(boolean includeDeprecated)
        Retrieves the available regions for this Guild
        Parameters:
        includeDeprecated - Whether to include deprecated regions
        Returns:
        RestAction - Type EnumSet
      • addMember

        @Nonnull
        @CheckReturnValue
        MemberAction addMember​(@Nonnull
                               java.lang.String accessToken,
                               @Nonnull
                               java.lang.String userId)
        Adds the user represented by the provided id to this guild.
        This requires an OAuth2 Access Token with the scope guilds.join.
        Parameters:
        accessToken - The access token
        userId - The user id
        Returns:
        MemberAction
        Throws:
        java.lang.IllegalArgumentException - If the user id or access token is blank, empty, or null, or if the provided user is already in this guild
        InsufficientPermissionException - If the currently logged in account does not have Permission.CREATE_INSTANT_INVITE
        Since:
        3.7.0
        See Also:
        Discord OAuth2 Documentation
      • addMember

        @Nonnull
        @CheckReturnValue
        default MemberAction addMember​(@Nonnull
                                       java.lang.String accessToken,
                                       @Nonnull
                                       User user)
        Adds the provided user to this guild.
        This requires an OAuth2 Access Token with the scope guilds.join.
        Parameters:
        accessToken - The access token
        user - The user
        Returns:
        MemberAction
        Throws:
        java.lang.IllegalArgumentException - If the user or access token is blank, empty, or null, or if the provided user is already in this guild
        InsufficientPermissionException - If the currently logged in account does not have Permission.CREATE_INSTANT_INVITE
        Since:
        3.7.0
        See Also:
        Discord OAuth2 Documentation
      • addMember

        @Nonnull
        @CheckReturnValue
        default MemberAction addMember​(@Nonnull
                                       java.lang.String accessToken,
                                       long userId)
        Adds the user represented by the provided id to this guild.
        This requires an OAuth2 Access Token with the scope guilds.join.
        Parameters:
        accessToken - The access token
        userId - The user id
        Returns:
        MemberAction
        Throws:
        java.lang.IllegalArgumentException - If the user id or access token is blank, empty, or null, or if the provided user is already in this guild
        InsufficientPermissionException - If the currently logged in account does not have Permission.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 the GUILD_MEMBERS intent is disabled.
        Returns:
        True, if members are loaded.
      • pruneMemberCache

        void pruneMemberCache()
        Re-apply the MemberCachePolicy of this session to all Members of this Guild.

        Example

        
         // Check if the members of this guild have at least 50% bots (bot collection/farm)
         public void checkBots(Guild guild) {
             // Keep in mind: This requires the GUILD_MEMBERS intent which is disabled in createDefault and createLight by default
             guild.retrieveMembers() // Load members CompletableFuture<Void> (async and eager)
                  .thenApply((v) -> guild.getMemberCache()) // Turn into CompletableFuture<MemberCacheView>
                  .thenAccept((members) -> {
                      int total = members.size();
                      // Casting to double to get a double as result of division, don't need to worry about precision with small counts like this
                      double bots = (double) members.applyStream(stream ->
                          stream.map(Member::getUser)
                                .filter(User::isBot)
                                .count()); // Count bots
                      if (bots / total > 0.5) // Check how many members are bots
                          System.out.println("More than 50% of members in this guild are bots");
                  })
                  .thenRun(guild::pruneMemberCache); // Then prune the cache
         }
         
        See Also:
        unloadMember(long), JDA.unloadUser(long)
      • unloadMember

        boolean unloadMember​(long userId)
        Attempts to remove the user with the provided id from the member cache.
        If you attempt to remove the SelfUser this will simply return false.

        This should be used by an implementation of MemberCachePolicy as an upstream request to remove a member. For example a Least-Recently-Used (LRU) cache might use this to drop old members if the cache capacity is reached. Or a timeout cache could use this to remove expired members.

        Parameters:
        userId - The target user id
        Returns:
        True, if the cache was changed
        See Also:
        pruneMemberCache(), JDA.unloadUser(long)
      • 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 by getMemberCache().

        When GatewayIntent.GUILD_MEMBERS is disabled, this will not be updated.

        Returns:
        The expected member count for this guild
      • getName

        @Nonnull
        java.lang.String getName()
        The human readable name of the Guild.

        This value can be modified using GuildManager.setName(String).

        Returns:
        Never-null String containing the Guild's name.
      • getIconId

        @Nullable
        java.lang.String getIconId()
        The Discord hash-id of the Guild icon image. If no icon has been set, this returns null.

        The Guild icon can be modified using GuildManager.setIcon(Icon).

        Returns:
        Possibly-null String containing the Guild's icon hash-id.
      • getIconUrl

        @Nullable
        default java.lang.String getIconUrl()
        The URL of the Guild icon image. If no icon has been set, this returns null.

        The Guild icon can be modified using GuildManager.setIcon(Icon).

        Returns:
        Possibly-null String containing the Guild's icon URL.
      • getFeatures

        @Nonnull
        java.util.Set<java.lang.String> getFeatures()
        The Features of the Guild.

        List of Features

        Returns:
        Never-null, unmodifiable Set containing all of the Guild's features.
      • getSplashId

        @Nullable
        java.lang.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 returns null.
        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 java.lang.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 returns null.
        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.
      • getVanityCode

        @Nullable
        java.lang.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 to discord.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 java.lang.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
        java.lang.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
      • getLocale

        @Nonnull
        java.util.Locale getLocale()
        The preferred locale for this guild.
        If the guild doesn't have the COMMUNITY feature, this returns the default.
        Default: Locale.US
        Returns:
        The preferred Locale for this guild
        Since:
        4.2.1
      • getBannerId

        @Nullable
        java.lang.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 java.lang.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 the features.
        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
        java.util.List<Member> getBoosters()
        Sorted list of Members that boost this guild.
        The list is sorted by Member.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
      • getMaxFileSize

        default long getMaxFileSize()
        Returns the maximum size for files that can be uploaded to this Guild. This returns 8 MiB for Guilds without a Boost Tier or Guilds with Boost Tier 1, 50 MiB for Guilds with Boost Tier 2 and 100 MiB for Guilds with Boost Tier 3.
        Returns:
        The maximum size for files that can be uploaded to this Guild
        Since:
        4.2.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
        See Also:
        retrieveMetaData()
      • 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
        See Also:
        retrieveMetaData()
      • getRulesChannel

        @Nullable
        TextChannel getRulesChannel()
        Provides the TextChannel that lists the rules of the guild.
        If this guild doesn't have the COMMUNITY feature, this returns null.
        Returns:
        Possibly-null TextChannel that is the rules channel
        See Also:
        getFeatures()
      • getCommunityUpdatesChannel

        @Nullable
        TextChannel getCommunityUpdatesChannel()
        Provides the TextChannel that receives community updates.
        If this guild doesn't have the COMMUNITY feature, this returns null.
        Returns:
        Possibly-null TextChannel that is the community updates channel
        See Also:
        getFeatures()
      • getOwner

        @Nullable
        Member getOwner()
        The Member object 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).

        This only works when the member was added to cache. Lazy loading might load this later.
        See MemberCachePolicy

        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 java.lang.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()
      • isMember

        boolean isMember​(@Nonnull
                         User user)
        Used to determine if the provided User is a member of this Guild.

        This will only check cached members!

        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 the Member object of the currently logged in account in this guild.
        This is basically JDA.getSelfUser() being provided to getMember(User).
        Returns:
        The Member object of the currently logged in account.
      • getNSFWLevel

        @Nonnull
        Guild.NSFWLevel getNSFWLevel()
        Returns the NSFW Level that this guild is classified with.
        For a short description of the different values, see NSFWLevel.

        This value can only be modified by Discord after reviewing the Guild.

        Returns:
        The NSFWLevel of this guild.
      • getMember

        @Nullable
        Member getMember​(@Nonnull
                         User user)
        Gets the Guild specific Member object for the provided User.
        If the user is not in this guild, null is returned.

        This will only check cached members!

        Parameters:
        user - The User which to retrieve a related Member object for.
        Returns:
        Possibly-null Member for the related User.
        Throws:
        java.lang.IllegalArgumentException - If the provided user is null
        See Also:
        retrieveMember(User)
      • getMemberById

        @Nullable
        default Member getMemberById​(@Nonnull
                                     java.lang.String userId)
        Gets a Member object via the id of the user. The id relates to ISnowflake.getId(), and this method is similar to JDA.getUserById(String)
        This is more efficient that using JDA.getUserById(String) and getMember(User).
        If no Member in this Guild has the userId provided, this returns null.

        This will only check cached members!

        Parameters:
        userId - The Discord id of the User for which a Member object is requested.
        Returns:
        Possibly-null Member with the related userId.
        Throws:
        java.lang.NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
        See Also:
        retrieveMemberById(String)
      • getMemberByTag

        @Nullable
        default Member getMemberByTag​(@Nonnull
                                      java.lang.String tag)
        Searches for a Member that has the matching Discord Tag.
        Format has to be in the form Username#Discriminator where 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 the nickname of the member but the username.

        This will only check cached members!
        See MemberCachePolicy

        This only checks users that are in this guild. If a user exists with the tag that is not available in the Member-Cache it 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 format Username#Discriminator
        Returns:
        The Member for the discord tag or null if no member has the provided tag
        Throws:
        java.lang.IllegalArgumentException - If the provided tag is null or not in the described format
        See Also:
        JDA.getUserByTag(String)
      • getMemberByTag

        @Nullable
        default Member getMemberByTag​(@Nonnull
                                      java.lang.String username,
                                      @Nonnull
                                      java.lang.String discriminator)
        Searches for a Member that has the matching Discord Tag.
        Format has to be in the form Username#Discriminator where 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 the nickname of the member but the username.

        This will only check cached members!
        See MemberCachePolicy

        This only checks users that are in this guild. If a user exists with the tag that is not available in the Member-Cache it 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 user
        discriminator - The discriminator of the user
        Returns:
        The Member for the discord tag or null if no member has the provided tag
        Throws:
        java.lang.IllegalArgumentException - If the provided arguments are null or not in the described format
        See Also:
        getMemberByTag(String)
      • getMembers

        @Nonnull
        default java.util.List<Member> getMembers()
        A list of all Members in this Guild.
        The Members are not provided in any particular order.

        This will only check cached members!
        See MemberCachePolicy

        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 cached members in this Guild.
        See Also:
        loadMembers()
      • getMembersByName

        @Nonnull
        default java.util.List<Member> getMembersByName​(@Nonnull
                                                        java.lang.String name,
                                                        boolean ignoreCase)
        Gets a list of all Members who have the same name as the one provided.
        This compares against Member.getUser().getName()
        If there are no Members with the provided name, then this returns an empty list.

        This will only check cached members!
        See MemberCachePolicy

        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.
        Throws:
        java.lang.IllegalArgumentException - If the provided name is null
        See Also:
        retrieveMembersByPrefix(String, int)
      • getMembersByNickname

        @Nonnull
        default java.util.List<Member> getMembersByNickname​(@Nullable
                                                            java.lang.String nickname,
                                                            boolean ignoreCase)
        Gets a list of all Members who have the same nickname as the one provided.
        This compares against Member.getNickname(). If a Member does not have a nickname, the comparison results as false.
        If there are no Members with the provided name, then this returns an empty list.

        This will only check cached members!
        See MemberCachePolicy

        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.
        See Also:
        retrieveMembersByPrefix(String, int)
      • getMembersByEffectiveName

        @Nonnull
        default java.util.List<Member> getMembersByEffectiveName​(@Nonnull
                                                                 java.lang.String name,
                                                                 boolean ignoreCase)
        Gets a list of all Members who have the same effective name as the one provided.
        This compares against Member.getEffectiveName().
        If there are no Members with the provided name, then this returns an empty list.

        This will only check cached members!
        See MemberCachePolicy

        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.
        Throws:
        java.lang.IllegalArgumentException - If the provided name is null
        See Also:
        retrieveMembersByPrefix(String, int)
      • getMembersWithRoles

        @Nonnull
        default java.util.List<Member> getMembersWithRoles​(@Nonnull
                                                           Role... roles)
        Gets a list of Members that have all Roles provided.
        If there are no Members with all provided roles, then this returns an empty list.

        This will only check cached members!
        See MemberCachePolicy

        Parameters:
        roles - The Roles that a Member must have to be included in the returned list.
        Returns:
        Possibly-empty immutable list of Members with all provided Roles.
        Throws:
        java.lang.IllegalArgumentException - If a provided Role is from a different guild or null.
        See Also:
        findMembersWithRoles(Role...)
      • getMembersWithRoles

        @Nonnull
        default java.util.List<Member> getMembersWithRoles​(@Nonnull
                                                           java.util.Collection<Role> roles)
        Gets a list of Members that have all provided Roles.
        If there are no Members with all provided roles, then this returns an empty list.

        This will only check cached members!
        See MemberCachePolicy

        Parameters:
        roles - The Roles that a Member must have to be included in the returned list.
        Returns:
        Possibly-empty immutable list of Members with all provided Roles.
        Throws:
        java.lang.IllegalArgumentException - If a provided Role is from a different guild or null.
        See Also:
        findMembersWithRoles(Collection)
      • getGuildChannelById

        @Nullable
        default GuildChannel getGuildChannelById​(@Nonnull
                                                 java.lang.String id)
        Get GuildChannel for 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:
        java.lang.IllegalArgumentException - If the provided ID is null
        java.lang.NumberFormatException - If the provided ID is not a snowflake
      • getStageChannelsByName

        @Nonnull
        default java.util.List<StageChannel> getStageChannelsByName​(@Nonnull
                                                                    java.lang.String name,
                                                                    boolean ignoreCase)
        Gets a list of all StageChannel in this Guild that have the same name as the one provided.
        If there are no StageChannels with the provided name, then this returns an empty list.
        Parameters:
        name - The name used to filter the returned StageChannels.
        ignoreCase - Determines if the comparison ignores case when comparing. True - case insensitive.
        Returns:
        Possibly-empty immutable list of all StageChannel names that match the provided name.
      • getStageChannelById

        @Nullable
        default StageChannel getStageChannelById​(@Nonnull
                                                 java.lang.String id)
        Gets a StageChannel from this guild that has the same id as the one provided. This method is similar to JDA.getStageChannelById(String), but it only checks this specific Guild for a StageChannel.
        If there is no StageChannel with an id that matches the provided one, then this returns null.
        Parameters:
        id - The id of the StageChannel.
        Returns:
        Possibly-null StageChannel with matching id.
        Throws:
        java.lang.NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getStageChannelById

        @Nullable
        default StageChannel getStageChannelById​(long id)
        Gets a StageChannel from this guild that has the same id as the one provided. This method is similar to JDA.getStageChannelById(long), but it only checks this specific Guild for a StageChannel.
        If there is no StageChannel with an id that matches the provided one, then this returns null.
        Parameters:
        id - The id of the StageChannel.
        Returns:
        Possibly-null StageChannel with matching id.
      • getStageChannels

        @Nonnull
        default java.util.List<StageChannel> getStageChannels()
        Gets all StageChannel in this Guild.
        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.

        Returns:
        An immutable List of StageChannels.
      • getCategoryById

        @Nullable
        default Category getCategoryById​(@Nonnull
                                         java.lang.String id)
        Gets the Category from this guild that matches the provided id. This method is similar to JDA.getCategoryById(String), but it only checks in this specific Guild.
        If there is no matching Category this returns null.
        Parameters:
        id - The snowflake ID of the wanted Category
        Returns:
        Possibly-null Category for the provided ID.
        Throws:
        java.lang.IllegalArgumentException - If the provided ID is not a valid long
      • getCategoryById

        @Nullable
        default Category getCategoryById​(long id)
        Gets the Category from this guild that matches the provided id. This method is similar to JDA.getCategoryById(String), but it only checks in this specific Guild.
        If there is no matching Category this returns null.
        Parameters:
        id - The snowflake ID of the wanted Category
        Returns:
        Possibly-null Category for the provided ID.
      • getCategories

        @Nonnull
        default java.util.List<Category> getCategories()
        Gets all Categories in this Guild.
        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 Categories in this Guild.
      • getCategoriesByName

        @Nonnull
        default java.util.List<Category> getCategoriesByName​(@Nonnull
                                                             java.lang.String name,
                                                             boolean ignoreCase)
        Gets a list of all Categories in 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 check
        ignoreCase - Whether to ignore case on name checking
        Returns:
        Immutable list of all categories matching the provided name
        Throws:
        java.lang.IllegalArgumentException - If the provided name is null
      • getStoreChannelById

        @Nullable
        default StoreChannel getStoreChannelById​(@Nonnull
                                                 java.lang.String id)
        Gets a StoreChannel from this guild that has the same id as the one provided. This method is similar to JDA.getStoreChannelById(String), but it only checks this specific Guild for a StoreChannel.
        If there is no StoreChannel with an id that matches the provided one, then this returns null.
        Parameters:
        id - The id of the StoreChannel.
        Returns:
        Possibly-null StoreChannel with matching id.
        Throws:
        java.lang.NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
        Since:
        4.0.0
      • getStoreChannelById

        @Nullable
        default StoreChannel getStoreChannelById​(long id)
        Gets a StoreChannel from this guild that has the same id as the one provided. This method is similar to JDA.getStoreChannelById(long), but it only checks this specific Guild for a StoreChannel.
        If there is no StoreChannel with an id that matches the provided one, then this returns null.
        Parameters:
        id - The id of the StoreChannel.
        Returns:
        Possibly-null StoreChannel with matching id.
        Since:
        4.0.0
      • getStoreChannels

        @Nonnull
        default java.util.List<StoreChannel> getStoreChannels()
        Gets all StoreChannels in this Guild.
        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 StoreChannel in this Guild.
        Since:
        4.0.0
      • getStoreChannelsByName

        @Nonnull
        default java.util.List<StoreChannel> getStoreChannelsByName​(@Nonnull
                                                                    java.lang.String name,
                                                                    boolean ignoreCase)
        Gets a list of all StoreChannels in this Guild that have the same name as the one provided.
        If there are no StoreChannels with the provided name, then this returns an empty list.
        Parameters:
        name - The name used to filter the returned StoreChannels.
        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
      • getTextChannelById

        @Nullable
        default TextChannel getTextChannelById​(@Nonnull
                                               java.lang.String id)
        Gets a TextChannel from this guild that has the same id as the one provided. This method is similar to JDA.getTextChannelById(String), but it only checks this specific Guild for a TextChannel.
        If there is no TextChannel with an id that matches the provided one, then this returns null.
        Parameters:
        id - The id of the TextChannel.
        Returns:
        Possibly-null TextChannel with matching id.
        Throws:
        java.lang.NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getTextChannelById

        @Nullable
        default TextChannel getTextChannelById​(long id)
        Gets a TextChannel from this guild that has the same id as the one provided. This method is similar to JDA.getTextChannelById(long), but it only checks this specific Guild for a TextChannel.
        If there is no TextChannel with an id that matches the provided one, then this returns null.
        Parameters:
        id - The id of the TextChannel.
        Returns:
        Possibly-null TextChannel with matching id.
      • getTextChannels

        @Nonnull
        default java.util.List<TextChannel> getTextChannels()
        Gets all TextChannels in this Guild.
        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 TextChannels in this Guild.
      • getTextChannelsByName

        @Nonnull
        default java.util.List<TextChannel> getTextChannelsByName​(@Nonnull
                                                                  java.lang.String name,
                                                                  boolean ignoreCase)
        Gets a list of all TextChannels in this Guild that have the same name as the one provided.
        If there are no TextChannels with the provided name, then this returns an empty list.
        Parameters:
        name - The name used to filter the returned TextChannels.
        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.
      • getVoiceChannelById

        @Nullable
        default VoiceChannel getVoiceChannelById​(@Nonnull
                                                 java.lang.String id)
        Gets a VoiceChannel from this guild that has the same id as the one provided. This method is similar to JDA.getVoiceChannelById(String), but it only checks this specific Guild for a VoiceChannel.
        If there is no VoiceChannel with an id that matches the provided one, then this returns null.

        This may also contain StageChannels!

        Parameters:
        id - The id of the VoiceChannel.
        Returns:
        Possibly-null VoiceChannel with matching id.
        Throws:
        java.lang.NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getVoiceChannelById

        @Nullable
        default VoiceChannel getVoiceChannelById​(long id)
        Gets a VoiceChannel from this guild that has the same id as the one provided. This method is similar to JDA.getVoiceChannelById(long), but it only checks this specific Guild for a VoiceChannel.
        If there is no VoiceChannel with an id that matches the provided one, then this returns null.

        This may also contain StageChannels!

        Parameters:
        id - The id of the VoiceChannel.
        Returns:
        Possibly-null VoiceChannel with matching id.
      • getVoiceChannels

        @Nonnull
        default java.util.List<VoiceChannel> getVoiceChannels()
        Gets all VoiceChannels in this Guild.
        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.

        This may also contain StageChannels!

        Returns:
        An immutable List of VoiceChannels.
      • getVoiceChannelsByName

        @Nonnull
        default java.util.List<VoiceChannel> getVoiceChannelsByName​(@Nonnull
                                                                    java.lang.String name,
                                                                    boolean ignoreCase)
        Gets a list of all VoiceChannels in this Guild that have the same name as the one provided.
        If there are no VoiceChannels with the provided name, then this returns an empty list.

        This may also contain StageChannels!

        Parameters:
        name - The name used to filter the returned VoiceChannels.
        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.
      • getChannels

        @Nonnull
        default java.util.List<GuildChannel> getChannels()
        Populated list of channels for 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.

        1. TextChannel and StoreChannel without parent
        2. VoiceChannel without parent
        3. Categories
          1. TextChannel and StoreChannel with category as parent
          2. VoiceChannel with category as parent
        Returns:
        Immutable list of channels for this guild
        See Also:
        getChannels(boolean)
      • getChannels

        @Nonnull
        java.util.List<GuildChannel> getChannels​(boolean includeHidden)
        Populated list of channels for 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.

        1. TextChannel and StoreChannel without parent
        2. VoiceChannel without parent
        3. Categories
          1. TextChannel and StoreChannel with category as parent
          2. VoiceChannel with category as parent
        Parameters:
        includeHidden - Whether to include channels with denied View Channel Permission
        Returns:
        Immutable list of channels for this guild
        See Also:
        getChannels()
      • getRoleById

        @Nullable
        default Role getRoleById​(@Nonnull
                                 java.lang.String id)
        Gets a Role from this guild that has the same id as the one provided.
        If there is no Role with an id that matches the provided one, then this returns null.
        Parameters:
        id - The id of the Role.
        Returns:
        Possibly-null Role with matching id.
        Throws:
        java.lang.NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getRoleById

        @Nullable
        default Role getRoleById​(long id)
        Gets a Role from this guild that has the same id as the one provided.
        If there is no Role with an id that matches the provided one, then this returns null.
        Parameters:
        id - The id of the Role.
        Returns:
        Possibly-null Role with matching id.
      • getRoles

        @Nonnull
        default java.util.List<Role> getRoles()
        Gets all Roles in this Guild.
        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 java.util.List<Role> getRolesByName​(@Nonnull
                                                    java.lang.String name,
                                                    boolean ignoreCase)
        Gets a list of all Roles in this Guild that have the same name as the one provided.
        If there are no Roles with the provided name, then this returns an empty list.
        Parameters:
        name - The name used to filter the returned Roles.
        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.
      • getRoleByBot

        @Nullable
        default Role getRoleByBot​(long userId)
        Looks up a role which is the integration role for a bot.
        These roles are created when the bot requested a list of permission in the authorization URL.

        To check whether a role is a bot role you can use role.getTags().isBot() and you can use Role.RoleTags.getBotIdLong() to check which bot it applies to.

        This requires CacheFlag.ROLE_TAGS to be enabled. See JDABuilder.enableCache(...).

        Parameters:
        userId - The user id of the bot
        Returns:
        The bot role, or null if no role matches
      • getRoleByBot

        @Nullable
        default Role getRoleByBot​(@Nonnull
                                  java.lang.String userId)
        Looks up a role which is the integration role for a bot.
        These roles are created when the bot requested a list of permission in the authorization URL.

        To check whether a role is a bot role you can use role.getTags().isBot() and you can use Role.RoleTags.getBotIdLong() to check which bot it applies to.

        This requires CacheFlag.ROLE_TAGS to be enabled. See JDABuilder.enableCache(...).

        Parameters:
        userId - The user id of the bot
        Returns:
        The bot role, or null if no role matches
        Throws:
        java.lang.IllegalArgumentException - If the userId is null or not a valid snowflake
      • getRoleByBot

        @Nullable
        default Role getRoleByBot​(@Nonnull
                                  User user)
        Looks up a role which is the integration role for a bot.
        These roles are created when the bot requested a list of permission in the authorization URL.

        To check whether a role is a bot role you can use role.getTags().isBot() and you can use Role.RoleTags.getBotIdLong() to check which bot it applies to.

        This requires CacheFlag.ROLE_TAGS to be enabled. See JDABuilder.enableCache(...).

        Parameters:
        user - The bot user
        Returns:
        The bot role, or null if no role matches
        Throws:
        java.lang.IllegalArgumentException - If null is provided
      • getBotRole

        @Nullable
        default Role getBotRole()
        Looks up the role which is the integration role for the currently connected bot (self-user).
        These roles are created when the bot requested a list of permission in the authorization URL.

        To check whether a role is a bot role you can use role.getTags().isBot() and you can use Role.RoleTags.getBotIdLong() to check which bot it applies to.

        This requires CacheFlag.ROLE_TAGS to be enabled. See JDABuilder.enableCache(...).

        Returns:
        The bot role, or null if no role matches
      • getBoostRole

        @Nullable
        default Role getBoostRole()
        Looks up the role which is the booster role of this guild.
        These roles are created when the first user boosts this guild.

        To check whether a role is a booster role you can use role.getTags().isBoost().

        This requires CacheFlag.ROLE_TAGS to be enabled. See JDABuilder.enableCache(...).

        Returns:
        The boost role, or null if no role matches
      • getEmoteById

        @Nullable
        default Emote getEmoteById​(@Nonnull
                                   java.lang.String id)
        Gets an Emote from this guild that has the same id as the one provided.
        If there is no Emote with an id that matches the provided one, then this returns null.

        Unicode emojis are not included as Emote!

        This requires the CacheFlag.EMOTE to be enabled!

        Parameters:
        id - the emote id
        Returns:
        An Emote matching the specified Id.
        Throws:
        java.lang.NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
        See Also:
        retrieveEmoteById(String)
      • getEmoteById

        @Nullable
        default Emote getEmoteById​(long id)
        Gets an Emote from this guild that has the same id as the one provided.
        If there is no Emote with an id that matches the provided one, then this returns null.

        Unicode emojis are not included as Emote!

        This requires the CacheFlag.EMOTE to be enabled!

        Parameters:
        id - the emote id
        Returns:
        An Emote matching the specified Id.
        See Also:
        retrieveEmoteById(long)
      • getEmotes

        @Nonnull
        default java.util.List<Emote> getEmotes()
        Gets all custom Emotes belonging to this Guild.
        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.

        This requires the CacheFlag.EMOTE to be enabled!

        Returns:
        An immutable List of Emotes.
        See Also:
        retrieveEmotes()
      • getEmotesByName

        @Nonnull
        default java.util.List<Emote> getEmotesByName​(@Nonnull
                                                      java.lang.String name,
                                                      boolean ignoreCase)
        Gets a list of all Emotes in this Guild that have the same name as the one provided.
        If there are no Emotes with the provided name, then this returns an empty list.

        Unicode emojis are not included as Emote!

        This requires the CacheFlag.EMOTE to be enabled!

        Parameters:
        name - The name used to filter the returned Emotes. 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.
      • retrieveEmoteById

        @Nonnull
        @CheckReturnValue
        RestAction<ListedEmote> retrieveEmoteById​(@Nonnull
                                                  java.lang.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 has Permission.MANAGE_EMOTES.

        Possible ErrorResponses caused by the returned RestAction include 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:
        java.lang.IllegalArgumentException - If the provided id is not a valid snowflake
        Since:
        3.8.0
      • retrievePrunableMemberCount

        @Nonnull
        @CheckReturnValue
        RestAction<java.lang.Integer> retrievePrunableMemberCount​(int days)
        The method calculates the amount of Members that would be pruned if prune(int, Role...) was executed. Prunability is determined by a Member being offline for at least days days.

        Possible ErrorResponses caused by the returned RestAction include the following:

        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 have KICK_MEMBER Permission.
        java.lang.IllegalArgumentException - If the provided days are less than 1 or more than 30
      • getPublicRole

        @Nonnull
        Role getPublicRole()
        The @everyone Role of this Guild.
        This role is special because its position is 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 by Member.getRoles().
        The ID of this Role is the Guild's ID thus it is equivalent to using getRoleById(getIdLong()).
        Returns:
        The @everyone Role
      • getDefaultChannel

        @Nullable
        TextChannel getDefaultChannel()
        The default TextChannel for a Guild.
        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 specific TextChannel.

        Note: This channel is the first channel in the guild (ordered by position) that the getPublicRole() has the Permission.MESSAGE_READ in.

        Returns:
        The TextChannel representing the default channel for this guild
      • getManager

        @Nonnull
        GuildManager getManager()
        Returns the GuildManager for this Guild, used to modify all properties and settings of the Guild.
        You modify multiple fields in one request by chaining setters before calling RestAction.queue().

        This is a lazy idempotent getter. The manager is retained after the first call. This getter is not thread-safe and would require guards by the user.

        Returns:
        The Manager of this Guild
        Throws:
        InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_SERVER
      • retrieveAuditLogs

        @Nonnull
        @CheckReturnValue
        AuditLogPaginationAction retrieveAuditLogs()
        A PaginationAction implementation that allows to iterate over all AuditLogEntries of this Guild.
        This iterates from the most recent action to the first logged one. (Limit 90 days into history by discord api)

        Examples

        
         public void logBan(GuildBanEvent event) {
             Guild guild = event.getGuild();
             List<TextChannel> modLog = guild.getTextChannelsByName("mod-log", true);
             guild.retrieveAuditLogs()
                  .type(ActionType.BAN) // filter by type
                  .limit(1)
                  .queue(list -> {
                     if (list.isEmpty()) return;
                     AuditLogEntry entry = list.get(0);
                     String message = String.format("%#s banned %#s with reason %s",
                                                    entry.getUser(), event.getUser(), entry.getReason());
                     modLog.forEach(channel ->
                       channel.sendMessage(message).queue()
                     );
                  });
         }
         
        Returns:
        AuditLogPaginationAction
        Throws:
        InsufficientPermissionException - If the currently logged in account does not have the permission VIEW_AUDIT_LOGS
      • leave

        @Nonnull
        @CheckReturnValue
        RestAction<java.lang.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 different Member before leaving using transferOwnership(Member).
        Returns:
        RestAction - Type: Void
        Throws:
        java.lang.IllegalStateException - Thrown if the currently logged in account is the Owner of this Guild.
      • delete

        @Nonnull
        @CheckReturnValue
        RestAction<java.lang.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, use delete(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.
        java.lang.IllegalStateException - If the currently logged in account has MFA enabled. (SelfUser.isMfaEnabled()).
      • delete

        @Nonnull
        @CheckReturnValue
        RestAction<java.lang.Void> delete​(@Nullable
                                          java.lang.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 account SelfUser.isMfaEnabled(). If MFA is not enabled, use delete().
        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.
        java.lang.IllegalArgumentException - If the provided mfaCode is null or empty when SelfUser.isMfaEnabled() is true.
      • getAudioManager

        @Nonnull
        AudioManager getAudioManager()
        The AudioManager that 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.
        Throws:
        java.lang.IllegalStateException - If GatewayIntent.GUILD_VOICE_STATES is disabled
        See Also:
        JDA.getAudioManagerCache()
      • requestToSpeak

        @Nonnull
        Task<java.lang.Void> requestToSpeak()
        Once the currently logged in account is connected to a StageChannel with an active StageInstance, this will trigger a Request-to-Speak (aka raise your hand).

        This will set an internal flag to automatically request to speak once the bot joins a stage channel.
        You can use cancelRequestToSpeak() to move back to the audience or cancel your pending request.

        If the self member has Permission.VOICE_MUTE_OTHERS this will immediately promote them to speaker.

        Example:

        
         stageChannel.createStageInstance("Talent Show").queue()
         guild.requestToSpeak(); // Set request to speak flag
         guild.getAudioManager().openAudioConnection(stageChannel); // join the channel
         
        Returns:
        Task representing the request to speak. Calling Task.get() can result in deadlocks and should be avoided at all times.
        See Also:
        cancelRequestToSpeak()
      • cancelRequestToSpeak

        @Nonnull
        Task<java.lang.Void> cancelRequestToSpeak()
        Cancels the Request-to-Speak.
        This can also be used to move back to the audience if you are currently a speaker.

        If there is no request to speak or the member is not currently connected to an active StageInstance, this does nothing.

        Returns:
        Task representing the request to speak cancellation. Calling Task.get() can result in deadlocks and should be avoided at all times.
        See Also:
        requestToSpeak()
      • getJDA

        @Nonnull
        JDA getJDA()
        Returns the JDA instance of this Guild
        Returns:
        the corresponding JDA instance
      • getVoiceStates

        @Nonnull
        java.util.List<GuildVoiceState> getVoiceStates()
        A list containing the GuildVoiceState of every Member in this Guild.
        This will never return an empty list because if it were empty, that would imply that there are no Members in this Guild, which is impossible.
        Returns:
        Never-empty immutable list containing all the GuildVoiceStates on 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:
        ExplicitContentLevel for this Guild
      • isAvailable

        @ForRemoval(deadline="4.4.0")
        @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 with JDA.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
        @Deprecated
        @ForRemoval(deadline="5.0.0")
        @DeprecatedSince("4.2.0")
        @ReplaceWith("loadMembers(Consumer<Member>) or loadMembers()")
        java.util.concurrent.CompletableFuture<java.lang.Void> retrieveMembers()
        Requests member chunks for this guild.
        This returns a completed future if the member demand is already matched. When GatewayIntent.GUILD_MEMBERS is disabled this will do nothing since getMemberCount() cannot be tracked.

        Calling CompletableFuture.cancel(boolean) will not cancel the chunking process.

        You MUST NOT use blocking operations such as CompletableFuture.join() or Future.get()! The response handling happens on the event thread by default.

        Returns:
        CompletableFuture representing the chunking task
        See Also:
        pruneMemberCache()
      • loadMembers

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> loadMembers()
        Retrieves and collects members of this guild into a list.
        This will use the configured MemberCachePolicy to decide which members to retain in cache.

        You can use findMembers(Predicate) to filter specific members.

        This requires the privileged GatewayIntent.GUILD_MEMBERS to be enabled!

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Returns:
        Task - Type: List of Member
        Throws:
        java.lang.IllegalStateException - If the GatewayIntent.GUILD_MEMBERS is not enabled
      • findMembers

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> findMembers​(@Nonnull
                                                         java.util.function.Predicate<? super Member> filter)
        Retrieves and collects members of this guild into a list.
        This will use the configured MemberCachePolicy to decide which members to retain in cache.

        This requires the privileged GatewayIntent.GUILD_MEMBERS to be enabled!

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        filter - Filter to decide which members to include
        Returns:
        Task - Type: List of Member
        Throws:
        java.lang.IllegalArgumentException - If the provided filter is null
        java.lang.IllegalStateException - If the GatewayIntent.GUILD_MEMBERS is not enabled
      • findMembersWithRoles

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> findMembersWithRoles​(@Nonnull
                                                                  java.util.Collection<Role> roles)
        Retrieves and collects members of this guild into a list.
        This will use the configured MemberCachePolicy to decide which members to retain in cache.

        This requires the privileged GatewayIntent.GUILD_MEMBERS to be enabled!

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        roles - Collection of all roles the members must have
        Returns:
        Task - Type: List of Member
        Throws:
        java.lang.IllegalArgumentException - If null is provided
        java.lang.IllegalStateException - If the GatewayIntent.GUILD_MEMBERS is not enabled
        Since:
        4.2.1
      • findMembersWithRoles

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> findMembersWithRoles​(@Nonnull
                                                                  Role... roles)
        Retrieves and collects members of this guild into a list.
        This will use the configured MemberCachePolicy to decide which members to retain in cache.

        This requires the privileged GatewayIntent.GUILD_MEMBERS to be enabled!

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        roles - All roles the members must have
        Returns:
        Task - Type: List of Member
        Throws:
        java.lang.IllegalArgumentException - If null is provided
        java.lang.IllegalStateException - If the GatewayIntent.GUILD_MEMBERS is not enabled
        Since:
        4.2.1
      • loadMembers

        @Nonnull
        Task<java.lang.Void> loadMembers​(@Nonnull
                                         java.util.function.Consumer<Member> callback)
        Retrieves all members of this guild.
        This will use the configured MemberCachePolicy to decide which members to retain in cache.

        This requires the privileged GatewayIntent.GUILD_MEMBERS to be enabled!

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        callback - Consumer callback for each member
        Returns:
        Task cancellable handle for this request
        Throws:
        java.lang.IllegalArgumentException - If the callback is null
        java.lang.IllegalStateException - If the GatewayIntent.GUILD_MEMBERS is not enabled
      • retrieveMember

        @Nonnull
        default RestAction<Member> retrieveMember​(@Nonnull
                                                  User user,
                                                  boolean update)
        Load the member for the specified user.
        If the member is already loaded it will be retrieved from getMemberById(long) and immediately provided if the member information is consistent. The cache consistency directly relies on the enabled GatewayIntents as GatewayIntent.GUILD_MEMBERS is required to keep the cache updated with the latest information. You can pass update = false to always return immediately if the member is cached regardless of cache consistency.

        Possible ErrorResponseExceptions include:

        Parameters:
        user - The user to load the member from
        update - Whether JDA should perform a request even if the member is already cached to update properties such as the name
        Returns:
        RestAction - Type: Member
        Throws:
        java.lang.IllegalArgumentException - If provided with null
        See Also:
        pruneMemberCache(), unloadMember(long)
      • retrieveMemberById

        @Nonnull
        default RestAction<Member> retrieveMemberById​(@Nonnull
                                                      java.lang.String id,
                                                      boolean update)
        Load the member for the specified user.
        If the member is already loaded it will be retrieved from getMemberById(long) and immediately provided if the member information is consistent. The cache consistency directly relies on the enabled GatewayIntents as GatewayIntent.GUILD_MEMBERS is required to keep the cache updated with the latest information. You can pass update = false to always return immediately if the member is cached regardless of cache consistency.

        Possible ErrorResponseExceptions include:

        Parameters:
        id - The user id to load the member from
        update - Whether JDA should perform a request even if the member is already cached to update properties such as the name
        Returns:
        RestAction - Type: Member
        Throws:
        java.lang.IllegalArgumentException - If the provided id is empty or null
        java.lang.NumberFormatException - If the provided id is not a snowflake
        See Also:
        pruneMemberCache(), unloadMember(long)
      • retrieveMembers

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> retrieveMembers​(@Nonnull
                                                             java.util.Collection<User> users)
        Retrieves a list of members.
        If the user does not resolve to a member of this guild, then it will not appear in the resulting list. It is possible that none of the users resolve to a member, in which case an empty list will be the result.

        If the GUILD_PRESENCES intent is enabled, this will load the OnlineStatus and Activities of the members. You can use retrieveMembers(boolean, Collection) to disable presences.

        The requests automatically timeout after 10 seconds. When the timeout occurs a TimeoutException will be used to complete exceptionally.

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        users - The users of the members (max 100)
        Returns:
        Task handle for the request
        Throws:
        java.lang.IllegalArgumentException -
        • If the input contains null
        • If the input is more than 100 IDs
      • retrieveMembersByIds

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> retrieveMembersByIds​(@Nonnull
                                                                  java.util.Collection<java.lang.Long> ids)
        Retrieves a list of members by their user id.
        If the id does not resolve to a member of this guild, then it will not appear in the resulting list. It is possible that none of the IDs resolve to a member, in which case an empty list will be the result.

        If the GUILD_PRESENCES intent is enabled, this will load the OnlineStatus and Activities of the members. You can use retrieveMembersByIds(boolean, Collection) to disable presences.

        The requests automatically timeout after 10 seconds. When the timeout occurs a TimeoutException will be used to complete exceptionally.

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        ids - The ids of the members (max 100)
        Returns:
        Task handle for the request
        Throws:
        java.lang.IllegalArgumentException -
        • If the input contains null
        • If the input is more than 100 IDs
      • retrieveMembersByIds

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> retrieveMembersByIds​(@Nonnull
                                                                  java.lang.String... ids)
        Retrieves a list of members by their user id.
        If the id does not resolve to a member of this guild, then it will not appear in the resulting list. It is possible that none of the IDs resolve to a member, in which case an empty list will be the result.

        If the GUILD_PRESENCES intent is enabled, this will load the OnlineStatus and Activities of the members. You can use retrieveMembersByIds(boolean, String...) to disable presences.

        The requests automatically timeout after 10 seconds. When the timeout occurs a TimeoutException will be used to complete exceptionally.

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        ids - The ids of the members (max 100)
        Returns:
        Task handle for the request
        Throws:
        java.lang.IllegalArgumentException -
        • If the input contains null
        • If the input is more than 100 IDs
      • retrieveMembersByIds

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> retrieveMembersByIds​(@Nonnull
                                                                  long... ids)
        Retrieves a list of members by their user id.
        If the id does not resolve to a member of this guild, then it will not appear in the resulting list. It is possible that none of the IDs resolve to a member, in which case an empty list will be the result.

        If the GUILD_PRESENCES intent is enabled, this will load the OnlineStatus and Activities of the members. You can use retrieveMembersByIds(boolean, long...) to disable presences.

        The requests automatically timeout after 10 seconds. When the timeout occurs a TimeoutException will be used to complete exceptionally.

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        ids - The ids of the members (max 100)
        Returns:
        Task handle for the request
        Throws:
        java.lang.IllegalArgumentException -
        • If the input contains null
        • If the input is more than 100 IDs
      • retrieveMembers

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> retrieveMembers​(boolean includePresence,
                                                             @Nonnull
                                                             java.util.Collection<User> users)
        Retrieves a list of members.
        If the user does not resolve to a member of this guild, then it will not appear in the resulting list. It is possible that none of the users resolve to a member, in which case an empty list will be the result.

        You can only load presences with the GUILD_PRESENCES intent enabled.

        The requests automatically timeout after 10 seconds. When the timeout occurs a TimeoutException will be used to complete exceptionally.

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        includePresence - Whether to load presences of the members (online status/activity)
        users - The users of the members (max 100)
        Returns:
        Task handle for the request
        Throws:
        java.lang.IllegalArgumentException -
        • If includePresence is true and the GUILD_PRESENCES intent is disabled
        • If the input contains null
        • If the input is more than 100 users
      • retrieveMembersByIds

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> retrieveMembersByIds​(boolean includePresence,
                                                                  @Nonnull
                                                                  java.util.Collection<java.lang.Long> ids)
        Retrieves a list of members by their user id.
        If the id does not resolve to a member of this guild, then it will not appear in the resulting list. It is possible that none of the IDs resolve to a member, in which case an empty list will be the result.

        You can only load presences with the GUILD_PRESENCES intent enabled.

        The requests automatically timeout after 10 seconds. When the timeout occurs a TimeoutException will be used to complete exceptionally.

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        includePresence - Whether to load presences of the members (online status/activity)
        ids - The ids of the members (max 100)
        Returns:
        Task handle for the request
        Throws:
        java.lang.IllegalArgumentException -
        • If includePresence is true and the GUILD_PRESENCES intent is disabled
        • If the input contains null
        • If the input is more than 100 IDs
      • retrieveMembersByIds

        @Nonnull
        @CheckReturnValue
        default Task<java.util.List<Member>> retrieveMembersByIds​(boolean includePresence,
                                                                  @Nonnull
                                                                  java.lang.String... ids)
        Retrieves a list of members by their user id.
        If the id does not resolve to a member of this guild, then it will not appear in the resulting list. It is possible that none of the IDs resolve to a member, in which case an empty list will be the result.

        You can only load presences with the GUILD_PRESENCES intent enabled.

        The requests automatically timeout after 10 seconds. When the timeout occurs a TimeoutException will be used to complete exceptionally.

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        includePresence - Whether to load presences of the members (online status/activity)
        ids - The ids of the members (max 100)
        Returns:
        Task handle for the request
        Throws:
        java.lang.IllegalArgumentException -
        • If includePresence is true and the GUILD_PRESENCES intent is disabled
        • If the input contains null
        • If the input is more than 100 IDs
      • retrieveMembersByIds

        @Nonnull
        @CheckReturnValue
        Task<java.util.List<Member>> retrieveMembersByIds​(boolean includePresence,
                                                          @Nonnull
                                                          long... ids)
        Retrieves a list of members by their user id.
        If the id does not resolve to a member of this guild, then it will not appear in the resulting list. It is possible that none of the IDs resolve to a member, in which case an empty list will be the result.

        You can only load presences with the GUILD_PRESENCES intent enabled.

        The requests automatically timeout after 10 seconds. When the timeout occurs a TimeoutException will be used to complete exceptionally.

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        includePresence - Whether to load presences of the members (online status/activity)
        ids - The ids of the members (max 100)
        Returns:
        Task handle for the request
        Throws:
        java.lang.IllegalArgumentException -
        • If includePresence is true and the GUILD_PRESENCES intent is disabled
        • If the input contains null
        • If the input is more than 100 IDs
      • retrieveMembersByPrefix

        @Nonnull
        @CheckReturnValue
        Task<java.util.List<Member>> retrieveMembersByPrefix​(@Nonnull
                                                             java.lang.String prefix,
                                                             int limit)
        Queries a list of members using a radix tree based on the provided name prefix.
        This will check both the username and the nickname of the members. Additional filtering may be required. If no members with the specified prefix exist, the list will be empty.

        The requests automatically timeout after 10 seconds. When the timeout occurs a TimeoutException will be used to complete exceptionally.

        You MUST NOT use blocking operations such as Task.get()! The response handling happens on the event thread by default.

        Parameters:
        prefix - The case-insensitive name prefix
        limit - The max amount of members to retrieve (1-100)
        Returns:
        Task handle for the request
        Throws:
        java.lang.IllegalArgumentException -
        • If the provided prefix is null or empty.
        • If the provided limit is not in the range of [1, 100]
        See Also:
        getMembersByName(String, boolean), getMembersByNickname(String, boolean), getMembersByEffectiveName(String, boolean)
      • moveVoiceMember

        @Nonnull
        @CheckReturnValue
        RestAction<java.lang.Void> moveVoiceMember​(@Nonnull
                                                   Member member,
                                                   @Nullable
                                                   VoiceChannel voiceChannel)
        Used to move a Member from one VoiceChannel to another VoiceChannel.
        As a note, you cannot move a Member that isn't already in a VoiceChannel. Also they must be in a VoiceChannel in the same Guild as the one that you are moving them to.

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        member - The Member that you are moving.
        voiceChannel - The destination VoiceChannel to which the member is being moved to. Or null to perform a voice kick.
        Returns:
        RestAction
        Throws:
        java.lang.IllegalStateException - If the Member isn't currently in a VoiceChannel in this Guild, or CacheFlag.VOICE_STATE is disabled.
        java.lang.IllegalArgumentException -
        • If the provided member is null
        • If the provided Member isn't part of this Guild
        • If the provided VoiceChannel isn't part of this Guild
        InsufficientPermissionException -
      • kickVoiceMember

        @Nonnull
        @CheckReturnValue
        default RestAction<java.lang.Void> kickVoiceMember​(@Nonnull
                                                           Member member)
        Used to kick a Member from a VoiceChannel.
        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 ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The target Member cannot be moved due to a permission discrepancy
        • UNKNOWN_MEMBER
          The specified Member was removed from the Guild before finishing the task
        • UNKNOWN_CHANNEL
          The specified channel was deleted before finishing the task
        Parameters:
        member - The Member that you are moving.
        Returns:
        RestAction
        Throws:
        java.lang.IllegalStateException - If the Member isn't currently in a VoiceChannel in this Guild, or CacheFlag.VOICE_STATE is disabled.
        java.lang.IllegalArgumentException -
        • If any of the provided arguments is null
        • If the provided Member isn't part of this Guild
        • If the provided VoiceChannel isn't part of this Guild
        InsufficientPermissionException - If this account doesn't have Permission.VOICE_MOVE_OTHERS in the VoiceChannel that the Member is currently in.
      • prune

        @Nonnull
        @CheckReturnValue
        default AuditableRestAction<java.lang.Integer> prune​(int days,
                                                             @Nonnull
                                                             Role... roles)
        This method will prune (kick) all members who were offline for at least days days.
        The RestAction returned from this method will return the amount of Members that were pruned.
        You can use retrievePrunableMemberCount(int) to determine how many Members would be pruned if you were to call this method.

        This might timeout when pruning many members. You can use prune(days, false) to ignore the prune count and avoid a timeout.

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        days - Minimum number of days since a member has been offline to get affected.
        roles - Optional roles to include in prune filter
        Returns:
        AuditableRestAction - Type: Integer
        The amount of Members that were pruned from the Guild.
        Throws:
        InsufficientPermissionException - If the account doesn't have KICK_MEMBER Permission.
        java.lang.IllegalArgumentException -
        • If the provided days are not in the range from 1 to 30 (inclusive)
        • If null is provided
        • If any of the provided roles is not from this guild
      • prune

        @Nonnull
        @CheckReturnValue
        AuditableRestAction<java.lang.Integer> prune​(int days,
                                                     boolean wait,
                                                     @Nonnull
                                                     Role... roles)
        This method will prune (kick) all members who were offline for at least days days.
        The RestAction returned from this method will return the amount of Members that were pruned.
        You can use retrievePrunableMemberCount(int) to determine how many Members would be pruned if you were to call this method.

        This might timeout when pruning many members with wait=true.

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        days - Minimum number of days since a member has been offline to get affected.
        wait - Whether to calculate the number of pruned members and wait for the response (timeout for too many pruned)
        roles - Optional roles to include in prune filter
        Returns:
        AuditableRestAction - Type: Integer
        Provides the amount of Members that were pruned from the Guild, if wait is true.
        Throws:
        InsufficientPermissionException - If the account doesn't have KICK_MEMBER Permission.
        java.lang.IllegalArgumentException -
        • If the provided days are not in the range from 1 to 30 (inclusive)
        • If null is provided
        • If any of the provided roles is not from this guild
      • ban

        @Nonnull
        @CheckReturnValue
        AuditableRestAction<java.lang.Void> ban​(@Nonnull
                                                User user,
                                                int delDays,
                                                @Nullable
                                                java.lang.String reason)
        Bans the User and deletes messages sent by the user based on the amount of delDays.
        If you wish to ban a user without deleting any messages, provide delDays with a value of 0.

        You can unban a user with Guild.unban(User).

        Note: getMembers() will still contain the User's Member object (if the User was in the Guild) until Discord sends the GuildMemberRemoveEvent.

        Possible ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The target Member cannot be banned due to a permission discrepancy
        • UNKNOWN_MEMBER
          The specified Member was removed from the Guild before finishing the task
        Parameters:
        user - The User to ban.
        delDays - The history of messages, in days, that will be deleted.
        reason - The reason for this action or null if there is no specified reason
        Returns:
        AuditableRestAction
        Throws:
        InsufficientPermissionException - If the logged in account does not have the Permission.BAN_MEMBERS permission.
        HierarchyException - If the logged in account cannot ban the other user due to permission hierarchy position.
        See Member.canInteract(Member)
        java.lang.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 reason is longer than 512 characters.
        • If the provided user is null
      • ban

        @Nonnull
        @CheckReturnValue
        AuditableRestAction<java.lang.Void> ban​(@Nonnull
                                                java.lang.String userId,
                                                int delDays,
                                                @Nullable
                                                java.lang.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 the User's Member object (if the User was in the Guild) until Discord sends the GuildMemberRemoveEvent.

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        userId - The id of the User to ban.
        delDays - The history of messages, in days, that will be deleted.
        reason - The reason for this action or null if there is no specified reason
        Returns:
        AuditableRestAction
        Throws:
        InsufficientPermissionException - If the logged in account does not have the Permission.BAN_MEMBERS permission.
        HierarchyException - If the logged in account cannot ban the other user due to permission hierarchy position.
        See Member.canInteract(Member)
        java.lang.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 reason is longer than 512 characters.
        • If the provided userId is null
      • ban

        @Nonnull
        @CheckReturnValue
        default AuditableRestAction<java.lang.Void> ban​(@Nonnull
                                                        Member member,
                                                        int delDays,
                                                        @Nullable
                                                        java.lang.String reason)
        Bans the Member and deletes messages sent by the user based on the amount of delDays.
        If you wish to ban a member without deleting any messages, provide delDays with a value of 0.

        You can unban a user with Guild.unban(User).

        Note: getMembers() will still contain the Member until Discord sends the GuildMemberRemoveEvent.

        Possible ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The target Member cannot be banned due to a permission discrepancy
        • UNKNOWN_MEMBER
          The specified Member was removed from the Guild before finishing the task
        Parameters:
        member - The Member to ban.
        delDays - The history of messages, in days, that will be deleted.
        reason - The reason for this action or null if there is no specified reason
        Returns:
        AuditableRestAction
        Throws:
        InsufficientPermissionException - If the logged in account does not have the Permission.BAN_MEMBERS permission.
        HierarchyException - If the logged in account cannot ban the other user due to permission hierarchy position.
        See Member.canInteract(Member)
        java.lang.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 reason is longer than 512 characters.
        • If the provided member is null
      • ban

        @Nonnull
        @CheckReturnValue
        default AuditableRestAction<java.lang.Void> ban​(@Nonnull
                                                        java.lang.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 the User's Member object (if the User was in the Guild) until Discord sends the GuildMemberRemoveEvent.

        Possible ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The target Member cannot be banned due to a permission discrepancy
        • UNKNOWN_MEMBER
          The specified Member was removed from the Guild before finishing the task
        Parameters:
        userId - The id of the User to ban.
        delDays - The history of messages, in days, that will be deleted.
        Returns:
        AuditableRestAction
        Throws:
        InsufficientPermissionException - If the logged in account does not have the Permission.BAN_MEMBERS permission.
        HierarchyException - If the logged in account cannot ban the other user due to permission hierarchy position.
        See Member.canInteract(Member)
        java.lang.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
      • addRoleToMember

        @Nonnull
        @CheckReturnValue
        AuditableRestAction<java.lang.Void> addRoleToMember​(@Nonnull
                                                            Member member,
                                                            @Nonnull
                                                            Role role)
        Atomically assigns the provided Role to the specified Member.
        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 ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The Members Roles could not be modified due to a permission discrepancy
        • UNKNOWN_MEMBER
          The target Member was removed from the Guild before finishing the task
        • UNKNOWN_ROLE
          If the specified Role does not exist
        Parameters:
        member - The target member who will receive the new role
        role - The role which should be assigned atomically
        Returns:
        AuditableRestAction
        Throws:
        java.lang.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 have Permission.MANAGE_ROLES
        HierarchyException - If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
      • addRoleToMember

        @Nonnull
        @CheckReturnValue
        default AuditableRestAction<java.lang.Void> addRoleToMember​(long userId,
                                                                    @Nonnull
                                                                    Role role)
        Atomically assigns the provided Role to 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 ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The Members Roles could not be modified due to a permission discrepancy
        • UNKNOWN_MEMBER
          The target Member was removed from the Guild before finishing the task
        • UNKNOWN_ROLE
          If the specified Role does not exist
        Parameters:
        userId - The id of the target member who will receive the new role
        role - The role which should be assigned atomically
        Returns:
        AuditableRestAction
        Throws:
        java.lang.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 have Permission.MANAGE_ROLES
        HierarchyException - If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
      • addRoleToMember

        @Nonnull
        @CheckReturnValue
        default AuditableRestAction<java.lang.Void> addRoleToMember​(@Nonnull
                                                                    java.lang.String userId,
                                                                    @Nonnull
                                                                    Role role)
        Atomically assigns the provided Role to 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 ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The Members Roles could not be modified due to a permission discrepancy
        • UNKNOWN_MEMBER
          The target Member was removed from the Guild before finishing the task
        • UNKNOWN_ROLE
          If the specified Role does not exist
        Parameters:
        userId - The id of the target member who will receive the new role
        role - The role which should be assigned atomically
        Returns:
        AuditableRestAction
        Throws:
        java.lang.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 have Permission.MANAGE_ROLES
        HierarchyException - If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
      • removeRoleFromMember

        @Nonnull
        @CheckReturnValue
        AuditableRestAction<java.lang.Void> removeRoleFromMember​(@Nonnull
                                                                 Member member,
                                                                 @Nonnull
                                                                 Role role)
        Atomically removes the provided Role from the specified Member.
        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 ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The Members Roles could not be modified due to a permission discrepancy
        • UNKNOWN_MEMBER
          The target Member was removed from the Guild before finishing the task
        • UNKNOWN_ROLE
          If the specified Role does not exist
        Parameters:
        member - The target member who will lose the specified role
        role - The role which should be removed atomically
        Returns:
        AuditableRestAction
        Throws:
        java.lang.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 have Permission.MANAGE_ROLES
        HierarchyException - If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
      • removeRoleFromMember

        @Nonnull
        @CheckReturnValue
        default AuditableRestAction<java.lang.Void> removeRoleFromMember​(long userId,
                                                                         @Nonnull
                                                                         Role role)
        Atomically removes the provided Role from 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 ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The Members Roles could not be modified due to a permission discrepancy
        • UNKNOWN_MEMBER
          The target Member was removed from the Guild before finishing the task
        • UNKNOWN_ROLE
          If the specified Role does not exist
        Parameters:
        userId - The id of the target member who will lose the specified role
        role - The role which should be removed atomically
        Returns:
        AuditableRestAction
        Throws:
        java.lang.IllegalArgumentException -
        • If the specified role is not from the current Guild
        • The role is null
        InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_ROLES
        HierarchyException - If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
      • removeRoleFromMember

        @Nonnull
        @CheckReturnValue
        default AuditableRestAction<java.lang.Void> removeRoleFromMember​(@Nonnull
                                                                         java.lang.String userId,
                                                                         @Nonnull
                                                                         Role role)
        Atomically removes the provided Role from 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 ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The Members Roles could not be modified due to a permission discrepancy
        • UNKNOWN_MEMBER
          The target Member was removed from the Guild before finishing the task
        • UNKNOWN_ROLE
          If the specified Role does not exist
        Parameters:
        userId - The id of the target member who will lose the specified role
        role - The role which should be removed atomically
        Returns:
        AuditableRestAction
        Throws:
        java.lang.IllegalArgumentException -
        • If the specified role is not from the current Guild
        • The role is null
        InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_ROLES
        HierarchyException - If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
      • modifyMemberRoles

        @Nonnull
        @CheckReturnValue
        AuditableRestAction<java.lang.Void> modifyMemberRoles​(@Nonnull
                                                              Member member,
                                                              @Nullable
                                                              java.util.Collection<Role> rolesToAdd,
                                                              @Nullable
                                                              java.util.Collection<Role> rolesToRemove)
        Modifies the Roles of the specified Member by 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 in rolesToAdd and rolesToRemove it will be removed.

        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();
         }
         

        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 a GenericGuildMemberEvent targeting the same Member.

        This is logically equivalent to:

        
         Set<Role> roles = new HashSet<>(member.getRoles());
         roles.addAll(rolesToAdd);
         roles.removeAll(rolesToRemove);
         RestAction<Void> action = guild.modifyMemberRoles(member, roles);
         

        You can use addRoleToMember(Member, Role) and removeRoleFromMember(Member, Role) to make updates independent of the cache.

        Possible ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The Members Roles could not be modified due to a permission discrepancy
        • UNKNOWN_MEMBER
          The target Member was removed from the Guild before finishing the task
        Parameters:
        member - The Member that should be modified
        rolesToAdd - A Collection of Roles to add to the current Roles the specified Member already has, or null
        rolesToRemove - A Collection of Roles to remove from the current Roles the specified Member already has, or null
        Returns:
        AuditableRestAction
        Throws:
        InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_ROLES
        HierarchyException - If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
        java.lang.IllegalArgumentException -
        • If the target member is null
        • If any of the specified Roles is managed or is the Public Role of the Guild
      • modifyMemberRoles

        @Nonnull
        @CheckReturnValue
        default AuditableRestAction<java.lang.Void> modifyMemberRoles​(@Nonnull
                                                                      Member member,
                                                                      @Nonnull
                                                                      Role... roles)
        Modifies the complete Role set of the specified Member
        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 a GenericGuildMemberEvent targeting the same Member.

        The new roles must not contain the Public Role of the Guild

        Possible ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The Members Roles could not be modified due to a permission discrepancy
        • UNKNOWN_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 - A Member of which to override the Roles of
        roles - New collection of Roles for the specified Member
        Returns:
        AuditableRestAction
        Throws:
        InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_ROLES
        HierarchyException - If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
        java.lang.IllegalArgumentException -
        • If any of the provided arguments is null
        • If any of the provided arguments is not from this Guild
        • If any of the specified Roles is managed
        • If any of the specified Roles is the Public Role of this Guild
        See Also:
        modifyMemberRoles(Member, Collection)
      • modifyMemberRoles

        @Nonnull
        @CheckReturnValue
        AuditableRestAction<java.lang.Void> modifyMemberRoles​(@Nonnull
                                                              Member member,
                                                              @Nonnull
                                                              java.util.Collection<Role> roles)
        Modifies the complete Role set of the specified Member
        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 a GenericGuildMemberEvent targeting the same Member.

        Possible ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The Members Roles could not be modified due to a permission discrepancy
        • UNKNOWN_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 - A Member of which to override the Roles of
        roles - New collection of Roles for the specified Member
        Returns:
        AuditableRestAction
        Throws:
        InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_ROLES
        HierarchyException - If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in account
        java.lang.IllegalArgumentException -
        • If any of the provided arguments is null
        • If any of the provided arguments is not from this Guild
        • If any of the specified Roles is managed
        • If any of the specified Roles is the Public Role of this Guild
        See Also:
        modifyMemberRoles(Member, Collection)
      • transferOwnership

        @Nonnull
        @CheckReturnValue
        AuditableRestAction<java.lang.Void> transferOwnership​(@Nonnull
                                                              Member newOwner)
        Transfers the Guild ownership to the specified Member
        Only available if the currently logged in account is the owner of this Guild

        Possible ErrorResponses caused by the returned RestAction include the following:

        • MISSING_PERMISSIONS
          The currently logged in account lost ownership before completing the task
        • UNKNOWN_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 Guild
        java.lang.IllegalArgumentException -
        • If the specified Member is null or not from the same Guild
        • If the specified Member already is the Guild owner
        • If the specified Member is a bot account (AccountType.BOT)
      • createTextChannel

        @Nonnull
        @CheckReturnValue
        default ChannelAction<TextChannel> createTextChannel​(@Nonnull
                                                             java.lang.String name)
        Creates a new TextChannel in this Guild. For this to be successful, the logged in account has to have the MANAGE_CHANNEL Permission

        Possible ErrorResponses caused by the returned RestAction include the following:

        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 the Permission.MANAGE_CHANNEL permission
        java.lang.IllegalArgumentException - If the provided name is null or empty or greater than 100 characters in length
      • createTextChannel

        @Nonnull
        @CheckReturnValue
        ChannelAction<TextChannel> createTextChannel​(@Nonnull
                                                     java.lang.String name,
                                                     @Nullable
                                                     Category parent)
        Creates a new TextChannel in this Guild. For this to be successful, the logged in account has to have the MANAGE_CHANNEL Permission

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        name - The name of the TextChannel to create
        parent - The optional parent category for this channel, or null
        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 the Permission.MANAGE_CHANNEL permission
        java.lang.IllegalArgumentException - If the provided name is null or empty or greater than 100 characters in length; or the provided parent is not in the same guild.
      • createVoiceChannel

        @Nonnull
        @CheckReturnValue
        default ChannelAction<VoiceChannel> createVoiceChannel​(@Nonnull
                                                               java.lang.String name)
        Creates a new VoiceChannel in this Guild. For this to be successful, the logged in account has to have the MANAGE_CHANNEL Permission.

        Possible ErrorResponses caused by the returned RestAction include the following:

        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 the Permission.MANAGE_CHANNEL permission
        java.lang.IllegalArgumentException - If the provided name is null or empty or greater than 100 characters in length
      • createVoiceChannel

        @Nonnull
        @CheckReturnValue
        ChannelAction<VoiceChannel> createVoiceChannel​(@Nonnull
                                                       java.lang.String name,
                                                       @Nullable
                                                       Category parent)
        Creates a new VoiceChannel in this Guild. For this to be successful, the logged in account has to have the MANAGE_CHANNEL Permission.

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        name - The name of the VoiceChannel to create
        parent - The optional parent category for this channel, or null
        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 the Permission.MANAGE_CHANNEL permission
        java.lang.IllegalArgumentException - If the provided name is null or empty or greater than 100 characters in length; or the provided parent is not in the same guild.
      • createStageChannel

        @Nonnull
        @CheckReturnValue
        default ChannelAction<StageChannel> createStageChannel​(@Nonnull
                                                               java.lang.String name)
        Creates a new StageChannel in this Guild. For this to be successful, the logged in account has to have the MANAGE_CHANNEL Permission.

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        name - The name of the StageChannel to create
        Returns:
        A specific ChannelAction
        This action allows to set fields for the new StageChannel before creating it
        Throws:
        InsufficientPermissionException - If the logged in account does not have the Permission.MANAGE_CHANNEL permission
        java.lang.IllegalArgumentException - If the provided name is null or empty or greater than 100 characters in length
      • createStageChannel

        @Nonnull
        @CheckReturnValue
        ChannelAction<StageChannel> createStageChannel​(@Nonnull
                                                       java.lang.String name,
                                                       @Nullable
                                                       Category parent)
        Creates a new StageChannel in this Guild. For this to be successful, the logged in account has to have the MANAGE_CHANNEL Permission.

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        name - The name of the StageChannel to create
        parent - The optional parent category for this channel, or null
        Returns:
        A specific ChannelAction
        This action allows to set fields for the new StageChannel before creating it
        Throws:
        InsufficientPermissionException - If the logged in account does not have the Permission.MANAGE_CHANNEL permission
        java.lang.IllegalArgumentException - If the provided name is null or empty or greater than 100 characters in length; or the provided parent is not in the same guild.
      • createCategory

        @Nonnull
        @CheckReturnValue
        ChannelAction<Category> createCategory​(@Nonnull
                                               java.lang.String name)
        Creates a new Category in this Guild. For this to be successful, the logged in account has to have the MANAGE_CHANNEL Permission.

        Possible ErrorResponses caused by the returned RestAction include the following:

        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 the Permission.MANAGE_CHANNEL permission
        java.lang.IllegalArgumentException - If the provided name is null or empty or greater than 100 characters in length
      • createCopyOfChannel

        @Nonnull
        @CheckReturnValue
        default <T extends GuildChannelChannelAction<T> createCopyOfChannel​(@Nonnull
                                                                              T channel)
        Creates a copy of the specified GuildChannel in this Guild.
        The provided channel need not be in the same Guild for this to work!

        This copies the following elements:

        1. Name
        2. Parent Category (if present)
        3. Voice Elements (Bitrate, Userlimit)
        4. Text Elements (Topic, NSFW)
        5. All permission overrides for Members/Roles

        Possible ErrorResponses caused by the returned RestAction include the following:

        Type Parameters:
        T - The channel type
        Parameters:
        channel - The GuildChannel to use for the copy template
        Returns:
        A specific ChannelAction
        This action allows to set fields for the new GuildChannel before creating it!
        Throws:
        java.lang.IllegalArgumentException - If the provided channel is null
        InsufficientPermissionException - If the currently logged in account does not have the MANAGE_CHANNEL Permission
        Since:
        3.1
        See Also:
        createTextChannel(String), createVoiceChannel(String), ChannelAction
      • createCopyOfRole

        @Nonnull
        @CheckReturnValue
        default RoleAction createCopyOfRole​(@Nonnull
                                            Role role)
        Creates a new Role in this Guild with the same settings as the given Role.
        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 the MANAGE_ROLES Permission and all Permissions the given Role has.

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        role - The Role that should be copied
        Returns:
        RoleAction
        RoleAction with already copied values from the specified Role
        Throws:
        InsufficientPermissionException - If the logged in account does not have the Permission.MANAGE_ROLES Permission and every Permission the provided Role has
        java.lang.IllegalArgumentException - If the specified role is null
      • createEmote

        @Nonnull
        @CheckReturnValue
        AuditableRestAction<Emote> createEmote​(@Nonnull
                                               java.lang.String name,
                                               @Nonnull
                                               Icon icon,
                                               @Nonnull
                                               Role... roles)
        Creates a new Emote in this Guild.
        If one or more Roles are specified the new Emote will only be available to Members with any of the specified Roles (see Member.canInteract(Emote))
        For this to be successful, the logged in account has to have the MANAGE_EMOTES Permission.

        Unicode emojis are not included as Emote!

        Note that a guild is limited to 50 normal and 50 animated emotes by default. Some guilds are able to add additional emotes beyond this limitation due to the MORE_EMOJI feature (see Guild.getFeatures()).
        Due to simplicity we do not check for these limits.

        Possible ErrorResponses caused by the returned RestAction include the following:

        Parameters:
        name - The name for the new Emote
        icon - The Icon for the new Emote
        roles - The Roles the 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 the MANAGE_EMOTES Permission
      • modifyRolePositions

        @Nonnull
        @CheckReturnValue
        default RoleOrderAction modifyRolePositions()
        Modifies the positional order of Guild.getRoles() using a specific RestAction extension to allow moving Roles up/down or to a specific position.

        This uses ascending ordering which means the lowest role is first!
        This means the highest role appears at index n - 1 and the lower role at index 0.
        Providing true to modifyRolePositions(boolean) will result in the ordering being in ascending order, with the lower role at index n - 1 and the highest at index 0.
        As a note: Member.getRoles() and Guild.getRoles() are both in descending order.

        Possible ErrorResponses include:

        • UNKNOWN_ROLE
          One of the roles was deleted before the completion of the task
        • MISSING_ACCESS
          The currently logged in account was removed from the Guild
        Returns:
        RoleOrderAction
      • modifyRolePositions

        @Nonnull
        @CheckReturnValue
        RoleOrderAction modifyRolePositions​(boolean useAscendingOrder)
        Modifies the positional order of Guild.getRoles() using a specific RestAction extension to allow moving Roles up/down or to a specific position.

        Possible ErrorResponses include:

        • UNKNOWN_ROLE
          One of the roles was deleted before the completion of the task
        • MISSING_ACCESS
          The currently logged in account was removed from the Guild
        Parameters:
        useAscendingOrder - Defines the ordering of the OrderAction. If false, the OrderAction will be in the ordering defined by Discord for roles, which is Descending. This means that the highest role appears at index 0 and the lowest role at index n - 1. Providing true will result in the ordering being in ascending order, with the lower role at index 0 and the highest at index n - 1.
        As a note: Member.getRoles() and Guild.getRoles() are both in descending order.
        Returns:
        RoleOrderAction