Interface Role

    • Method Detail

      • getServer

        Server getServer​()
        Gets the server of the role.
        Returns:
        The server of the role.
      • getPosition

        int getPosition​()
        Gets the position of the role.
        Returns:
        The position of the role.
      • getColor

        Optional<Color> getColor​()
        Gets the color of the role.
        Returns:
        The color of the role.
      • isMentionable

        boolean isMentionable​()
        Check if this role is mentionable.
        Returns:
        Whether this role is mentionable or not.
      • isDisplayedSeparately

        boolean isDisplayedSeparately​()
        Check if this role is pinned in the user listing (sometimes called "hoist").
        Returns:
        Whether this role is pinned in the user listing or not.
      • getUsers

        Collection<User> getUsers​()
        Gets a collection with all users who have this role.
        Returns:
        A collection with all users who have this role.
      • getPermissions

        Permissions getPermissions​()
        Gets the permissions of the role.
        Returns:
        The permissions of the role.
      • isManaged

        boolean isManaged​()
        Checks if this role is managed by an integration.
        Returns:
        Whether this role is managed by an integration or not.
      • isEveryoneRole

        default boolean isEveryoneRole​()
        Checks if the role is the @everyone role.
        Returns:
        Whether the role is the @everyone role or not.
      • createUpdater

        default RoleUpdater createUpdater​()
        Gets the updater for this role.
        Returns:
        The updater for this role.
      • updateName

        default CompletableFuture<Void> updateName​(String name)
        Updates the name of the role.

        If you want to update several settings at once, it's recommended to use the RoleUpdater from createUpdater() which provides a better performance!

        Parameters:
        name - The new name of the role.
        Returns:
        A future to check if the update was successful.
      • updatePermissions

        default CompletableFuture<Void> updatePermissions​(Permissions permissions)
        Updates the permissions of the role.

        If you want to update several settings at once, it's recommended to use the RoleUpdater from createUpdater() which provides a better performance!

        Parameters:
        permissions - The new permissions of the role.
        Returns:
        A future to check if the update was successful.
      • updateColor

        default CompletableFuture<Void> updateColor​(Color color)
        Updates the color of the role.

        If you want to update several settings at once, it's recommended to use the RoleUpdater from createUpdater() which provides a better performance!

        Parameters:
        color - The new color of the role.
        Returns:
        A future to check if the update was successful.
      • updateDisplaySeparatelyFlag

        default CompletableFuture<Void> updateDisplaySeparatelyFlag​(boolean displaySeparately)
        Updates the display separately flag of the role.

        If you want to update several settings at once, it's recommended to use the RoleUpdater from createUpdater() which provides a better performance!

        Parameters:
        displaySeparately - The new display separately flag of the role.
        Returns:
        A future to check if the update was successful.
      • updateMentionableFlag

        default CompletableFuture<Void> updateMentionableFlag​(boolean mentionable)
        Updates the mentionable flag of the role.

        If you want to update several settings at once, it's recommended to use the RoleUpdater from createUpdater() which provides a better performance!

        Parameters:
        mentionable - The new mentionable flag of the role.
        Returns:
        A future to check if the update was successful.
      • delete

        CompletableFuture<Void> delete​()
        Deletes the role.
        Returns:
        A future to check if the deletion was successful.
      • getAllowedPermissions

        default Collection<PermissionType> getAllowedPermissions​()
        Gets the allowed permissions of the role.
        Returns:
        The allowed permissions of the role.
      • getUnsetPermissions

        default Collection<PermissionType> getUnsetPermissions​()
        Gets the unset permissions of the role.
        Returns:
        The unset permissions of the role.
      • getMentionTag

        default String getMentionTag​()
        Description copied from interface: Mentionable
        Gets the tag used to mention the entity.
        Specified by:
        getMentionTag in interface Mentionable
        Returns:
        The tag used to mention the entity.
      • getCurrentCachedInstance

        default Optional<Role> getCurrentCachedInstance​()
        Description copied from interface: UpdatableFromCache
        Gets an updated instance of this entity from the cache. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache, that gets updates from Discord, in case this one was invalidated.

        This method returns the currently cached entity, or an empty Optional if the entity is not cached any longer, for example because it was deleted or the message was thrown out of the cache.

        Specified by:
        getCurrentCachedInstance in interface UpdatableFromCache<Role>
        Returns:
        The current cached instance.