Interface Server
-
- All Superinterfaces:
DiscordEntity
,Formattable
,Nameable
,ServerAttachableListenerManager
,Updatable<Server>
,UpdatableFromCache<Server>
public interface Server extends DiscordEntity, Nameable, UpdatableFromCache<Server>, ServerAttachableListenerManager
The class represents a Discord server, sometimes also called guild.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default CompletableFuture<Void>
addRoleToUser(User user, Role role)
Adds the given role to the given server member.CompletableFuture<Void>
addRoleToUser(User user, Role role, String reason)
Adds the given role to the given server member.default boolean
areYouDeafened()
Gets your deafened state.default boolean
areYouMuted()
Gets your muted state.default boolean
areYouSelfDeafened()
Gets your self-deafened state.default boolean
areYouSelfMuted()
Gets your self-muted state.default CompletableFuture<Void>
banUser(User user)
Bans the given user from the server.default CompletableFuture<Void>
banUser(User user, int deleteMessageDays)
Bans the given user from the server.CompletableFuture<Void>
banUser(User user, int deleteMessageDays, String reason)
Bans the given user from the server.default boolean
canBanUser(User user, User userToBan)
Checks if the given user can ban the other user.default boolean
canBanUsers(User user)
Checks if the given user can ban users from the server.default boolean
canChangeOwnNickname(User user)
Checks if the given user can change its own nickname in the server.default boolean
canCreateChannels(User user)
Checks if the given user can create new channels.default boolean
canDeafenMembers(User user)
Checks if the given user can deafen members on the server.default boolean
canKickUser(User user, User userToKick)
Checks if the given user can kick the other user.default boolean
canKickUsers(User user)
Checks if the given user can kick users from the server.default boolean
canManage(User user)
Checks if the given user can manage the server.default boolean
canManageEmojis(User user)
Checks if the given user can manage emojis on the server.default boolean
canManageNicknames(User user)
Checks if the given user can manage nicknames on the server.default boolean
canManageRole(User user, Role target)
Checks if the user can manage the target role.default boolean
canManageRoles(User user)
Checks if the given user can manage roles on the server.default boolean
canManageRolesOf(User user, User target)
Checks if the user can manage the roles of the target user.default boolean
canMoveMembers(User user)
Checks if the given user can move members on the server.default boolean
canMuteMembers(User user)
Checks if the given user can mute members on the server.default boolean
canViewAuditLog(User user)
Checks if the given user can view the audit log of the server.default boolean
canYouBanUser(User userToBan)
Checks if the user of the connected account can ban the user.default boolean
canYouBanUsers()
Checks if the user of the connected account can ban users from the server.default boolean
canYouChangeOwnNickname()
Checks if the user of the connected account can change its own nickname in the server.default boolean
canYouCreateChannels()
Checks if the user of the connected account can create new channels.default boolean
canYouDeafenMembers()
Checks if the user of the connected account can deafen members on the server.default boolean
canYouKickUser(User userToKick)
Checks if the user of the connected account can kick the user.default boolean
canYouKickUsers()
Checks if the user of the connected account can kick users from the server.default boolean
canYouManage()
Checks if the user of the connected account can manage the server.default boolean
canYouManageEmojis()
Checks if the user of the connected account can manage emojis on the server.default boolean
canYouManageNicknames()
Checks if the user of the connected account can manage nicknames on the server.default boolean
canYouManageRoles()
Checks if the user of the connected account can manage roles on the server.default boolean
canYouMoveMembers()
Checks if the user of the connected account can move members on the server.default boolean
canYouMuteMembers()
Checks if the user of the connected account can mute members on the server.default boolean
canYouViewAuditLog()
Checks if the user of the connected account can view the audit log of the server.default ChannelCategoryBuilder
createChannelCategoryBuilder()
Creates a new channel category builder.default CustomEmojiBuilder
createCustomEmojiBuilder()
Creates a custom emoji builder to create custom emojis.default RoleBuilder
createRoleBuilder()
Creates a new role builder.default ServerTextChannelBuilder
createTextChannelBuilder()
Creates a new server text channel builder.default ServerUpdater
createUpdater()
Creates an updater for this server.default ServerVoiceChannelBuilder
createVoiceChannelBuilder()
Creates a new server voice channel builder.default CompletableFuture<Void>
deafenUser(User user)
Deafens the given user on the server.default CompletableFuture<Void>
deafenUser(User user, String reason)
Deafens the given user on the server.default CompletableFuture<Void>
deafenYourself()
Deafens yourself on the server.CompletableFuture<Void>
delete()
Deletes the server.Optional<ServerVoiceChannel>
getAfkChannel()
Gets the afk channel of the server.int
getAfkTimeoutInSeconds()
Gets the afk timeout in seconds of the server.default Collection<PermissionType>
getAllowedPermissions(User user)
Get the allowed permissions of a given user.Optional<Long>
getApplicationId()
Gets the application id of the server's owner.CompletableFuture<AuditLog>
getAuditLog(int limit)
Gets the audit log of this server.CompletableFuture<AuditLog>
getAuditLog(int limit, AuditLogActionType type)
Gets the audit log of this server.CompletableFuture<AuditLog>
getAuditLogBefore(int limit, AuditLogEntry before)
Gets the audit log of this server.CompletableFuture<AuditLog>
getAuditLogBefore(int limit, AuditLogEntry before, AuditLogActionType type)
Gets the audit log of this server.CompletableFuture<Collection<Ban>>
getBans()
Gets a collection with all server bans.Optional<ServerChannel>
getChannelById(long id)
Gets a channel by its id.default Optional<ServerChannel>
getChannelById(String id)
Gets a channel by its id.List<ChannelCategory>
getChannelCategories()
Gets a sorted list (by position) with all channel categories of the server.default List<ChannelCategory>
getChannelCategoriesByName(String name)
Gets a sorted list (by position) with all channel categories with the given name.default List<ChannelCategory>
getChannelCategoriesByNameIgnoreCase(String name)
Gets a sorted list (by position) with all channel categories with the given name.default Optional<ChannelCategory>
getChannelCategoryById(long id)
Gets a channel category by its id.default Optional<ChannelCategory>
getChannelCategoryById(String id)
Gets a channel category by its id.List<ServerChannel>
getChannels()
Gets a sorted list (by position) with all channels of the server.default List<ServerChannel>
getChannelsByName(String name)
Gets a sorted list (by position) with all channels with the given name.default List<ServerChannel>
getChannelsByNameIgnoreCase(String name)
Gets a sorted list (by position) with all channels with the given name.default Optional<ServerVoiceChannel>
getConnectedVoiceChannel(long userId)
Gets the voice channel the user with the given id is connected to on this server if any.default Optional<ServerVoiceChannel>
getConnectedVoiceChannel(User user)
Gets the voice channel the given user is connected to on this server if any.default Optional<Server>
getCurrentCachedInstance()
Gets an updated instance of this entity from the cache.default Optional<KnownCustomEmoji>
getCustomEmojiById(long id)
Gets a custom emoji in this server by its id.default Optional<KnownCustomEmoji>
getCustomEmojiById(String id)
Gets a custom emoji in this server by its id.Collection<KnownCustomEmoji>
getCustomEmojis()
Gets a collection with all custom emojis of this server.default Collection<KnownCustomEmoji>
getCustomEmojisByName(String name)
Gets a collection of all custom emojis with the given name in the server.default Collection<KnownCustomEmoji>
getCustomEmojisByNameIgnoreCase(String name)
Gets a collection of all custom emojis with the given name in the server.DefaultMessageNotificationLevel
getDefaultMessageNotificationLevel()
Gets the default message notification level of the server.default String
getDisplayName(User user)
Gets the display name of the user on this server.default Role
getEveryoneRole()
Gets the @everyone role.ExplicitContentFilterLevel
getExplicitContentFilterLevel()
Gets the explicit content filter level of the server.default Optional<Role>
getHighestRole(User user)
Gets the highest role of the given user in this server.Optional<Icon>
getIcon()
Gets the icon of the server.CompletableFuture<Collection<RichInvite>>
getInvites()
Gets the invites of the server.Optional<Instant>
getJoinedAtTimestamp(User user)
Gets the timestamp of when a user joined the server.default Optional<User>
getMemberByDiscriminatedName(String discriminatedName)
Gets a member by its discriminated name like e.default Optional<User>
getMemberByDiscriminatedNameIgnoreCase(String discriminatedName)
Gets a member by its discriminated name like e.Optional<User>
getMemberById(long id)
Gets a member by its id.default Optional<User>
getMemberById(String id)
Gets a member by its id.default Optional<User>
getMemberByNameAndDiscriminator(String name, String discriminator)
Gets a member by its name and discriminator.default Optional<User>
getMemberByNameAndDiscriminatorIgnoreCase(String name, String discriminator)
Gets a member by its name and discriminator.int
getMemberCount()
Gets the amount of members in this server.Collection<User>
getMembers()
Gets a collection with all members of the server.default Collection<User>
getMembersByDisplayName(String displayName)
Gets a collection with all members with the given display name on this server.default Collection<User>
getMembersByDisplayNameIgnoreCase(String displayName)
Gets a collection with all members with the given display name on this server.default Collection<User>
getMembersByName(String name)
Gets a collection with all members with the given name.default Collection<User>
getMembersByNameIgnoreCase(String name)
Gets a collection with all members with the given name.default Collection<User>
getMembersByNickname(String nickname)
Gets a collection with all members with the given nickname on this server.default Collection<User>
getMembersByNicknameIgnoreCase(String nickname)
Gets a collection with all members with the given nickname on this server.MultiFactorAuthenticationLevel
getMultiFactorAuthenticationLevel()
Gets the multi factor authentication level of the server.Optional<String>
getNickname(User user)
Gets the nickname of a user.User
getOwner()
Gets the owner of the server.default Permissions
getPermissions(User user)
Gets the permissions of a user.CompletableFuture<Integer>
getPruneCount(int days)
Gets the amount of members without a role which were inactive at least the given amount of days.Region
getRegion()
Gets the region of the server.Optional<Role>
getRoleById(long id)
Gets a role by its id.default Optional<Role>
getRoleById(String id)
Gets a role by its id.default Optional<Color>
getRoleColor(User user)
Gets the displayed color of a user based on his roles on this server.List<Role>
getRoles()
Gets a sorted list (by position) with all roles of the server.default List<Role>
getRoles(User user)
Gets a sorted list (by position) with all roles of the user in the server.default List<Role>
getRolesByName(String name)
Gets a sorted list (by position) with all roles with the given name.default List<Role>
getRolesByNameIgnoreCase(String name)
Gets a sorted list (by position) with all roles with the given name.Optional<Icon>
getSplash()
Gets the splash of the server.Optional<ServerTextChannel>
getSystemChannel()
Gets the system channel of the server.default Optional<ServerTextChannel>
getTextChannelById(long id)
Gets a text channel by its id.default Optional<ServerTextChannel>
getTextChannelById(String id)
Gets a text channel by its id.List<ServerTextChannel>
getTextChannels()
Gets a sorted list (by position) with all text channels of the server.default List<ServerTextChannel>
getTextChannelsByName(String name)
Gets a sorted list (by position) with all text channels with the given name.default List<ServerTextChannel>
getTextChannelsByNameIgnoreCase(String name)
Gets a sorted list (by position) with all text channels with the given name.default Collection<PermissionType>
getUnsetPermissions(User user)
Get the unset permissions of a given user.VerificationLevel
getVerificationLevel()
Gets the verification level of the server.default List<ServerChannel>
getVisibleChannels(User user)
Gets a sorted (by position) list with all channels of this server the given user can see.default Optional<ServerVoiceChannel>
getVoiceChannelById(long id)
Gets a voice channel by its id.default Optional<ServerVoiceChannel>
getVoiceChannelById(String id)
Gets a voice channel by its id.List<ServerVoiceChannel>
getVoiceChannels()
Gets a sorted list (by position) with all voice channels of the server.default List<ServerVoiceChannel>
getVoiceChannelsByName(String name)
Gets a sorted list (by position) with all voice channels with the given name.default List<ServerVoiceChannel>
getVoiceChannelsByNameIgnoreCase(String name)
Gets a sorted list (by position) with all voice channels with the given name.CompletableFuture<List<Webhook>>
getWebhooks()
Gets a list of all webhooks in this server.default boolean
hasAnyPermission(User user, PermissionType... type)
Checks if the user has any of a given set of permissions.default boolean
hasPermission(User user, PermissionType permission)
Checks if a user has a given permission.default boolean
hasPermissions(User user, PermissionType... type)
Checks if the user has a given set of permissions.default boolean
isAdmin(User user)
Checks if the given user is an administrator of the server.boolean
isDeafened(long userId)
Gets the deafened state of the user with the given id.default boolean
isDeafened(User user)
Gets the deafened state of the given user.boolean
isLarge()
Checks if the server is considered large.boolean
isMember(User user)
Checks if the given user is a member of this server.boolean
isMuted(long userId)
Gets the muted state of the user with the given id.default boolean
isMuted(User user)
Gets the muted state of the given user.default boolean
isOwner(User user)
Checks if the given user is the owner of the server.boolean
isSelfDeafened(long userId)
Gets the self-deafened state of the user with the given id.default boolean
isSelfDeafened(User user)
Gets the self-deafened state of the given user.boolean
isSelfMuted(long userId)
Gets the self-muted state of the user with the given id.default boolean
isSelfMuted(User user)
Gets the self-muted state of the given user.default CompletableFuture<Void>
kickUser(User user)
Kicks the given user from the server.CompletableFuture<Void>
kickUser(User user, String reason)
Kicks the given user from the server.default CompletableFuture<Void>
kickUserFromVoiceChannel(User user)
Kicks the given user from any voice channel.CompletableFuture<Void>
leave()
Leaves the server.default CompletableFuture<Void>
moveUser(User user, ServerVoiceChannel channel)
Moves the given user to the given channel on the server.default CompletableFuture<Void>
moveYourself(ServerVoiceChannel channel)
Moves yourself to the given channel on the server.default CompletableFuture<Void>
muteUser(User user)
Mutes the given user on the server.default CompletableFuture<Void>
muteUser(User user, String reason)
Mutes the given user on the server.default CompletableFuture<Void>
muteYourself()
Mutes yourself on the server.default CompletableFuture<Integer>
pruneMembers(int days)
Kicks all members without a role which were inactive at least the given amount of days.CompletableFuture<Integer>
pruneMembers(int days, String reason)
Kicks all members without a role which were inactive at least the given amount of days.default CompletableFuture<Void>
removeAfkChannel()
Removes the afk channel of the server.default CompletableFuture<Void>
removeIcon()
Removes the icon of the server.default CompletableFuture<Void>
removeRoleFromUser(User user, Role role)
Removes the given role from the given server member.CompletableFuture<Void>
removeRoleFromUser(User user, Role role, String reason)
Removes the given role from the given server member.default CompletableFuture<Void>
removeSplash()
Removes the splash of the server.default CompletableFuture<Void>
removeSystemChannel()
Removes the system channel of the server.default CompletableFuture<Void>
reorderRoles(List<Role> roles)
Reorders the roles of the server.CompletableFuture<Void>
reorderRoles(List<Role> roles, String reason)
Reorders the roles of the server.default CompletableFuture<Void>
resetNickname(User user)
Removes the nickname of the given user.default CompletableFuture<Void>
resetNickname(User user, String reason)
Removes the nickname of the given user.void
selfDeafen()
Deafens yourself locally for the server.void
selfMute()
Mutes yourself locally for the server.void
selfUndeafen()
Undeafens yourself locally for the server.void
selfUnmute()
Unmutes yourself locally for the server.default CompletableFuture<Void>
setSystemChannel(ServerTextChannel systemChannel)
Updates the system channel of the server.default CompletableFuture<Void>
unbanUser(long userId)
Unbans the given user from the server.CompletableFuture<Void>
unbanUser(long userId, String reason)
Unbans the given user from the server.default CompletableFuture<Void>
unbanUser(String userId)
Unbans the given user from the server.default CompletableFuture<Void>
unbanUser(String userId, String reason)
Unbans the given user from the server.default CompletableFuture<Void>
unbanUser(User user)
Unbans the given user from the server.default CompletableFuture<Void>
unbanUser(User user, String reason)
Unbans the given user from the server.default CompletableFuture<Void>
undeafenUser(User user)
Undeafens the given user on the server.default CompletableFuture<Void>
undeafenUser(User user, String reason)
Undeafens the given user on the server.default CompletableFuture<Void>
undeafenYourself()
Undeafens yourself on the server.default CompletableFuture<Void>
unmuteUser(User user)
Unmutes the given user on the server.default CompletableFuture<Void>
unmuteUser(User user, String reason)
Unmutes the given user on the server.default CompletableFuture<Void>
unmuteYourself()
Unmutes yourself on the server.default CompletableFuture<Void>
updateAfkChannel(ServerVoiceChannel afkChannel)
Updates the afk channel of the server.default CompletableFuture<Void>
updateAfkTimeoutInSeconds(int afkTimeout)
Updates the afk timeout of the server.default CompletableFuture<Void>
updateDefaultMessageNotificationLevel(DefaultMessageNotificationLevel defaultMessageNotificationLevel)
Updates the default message notification level of the server.default CompletableFuture<Void>
updateExplicitContentFilterLevel(ExplicitContentFilterLevel explicitContentFilterLevel)
Updates the explicit content filter level of the server.default CompletableFuture<Void>
updateIcon(byte[] icon)
Updates the icon of the server.default CompletableFuture<Void>
updateIcon(byte[] icon, String fileType)
Updates the icon of the server.default CompletableFuture<Void>
updateIcon(BufferedImage icon)
Updates the icon of the server.default CompletableFuture<Void>
updateIcon(BufferedImage icon, String fileType)
Updates the icon of the server.default CompletableFuture<Void>
updateIcon(File icon)
Updates the icon of the server.default CompletableFuture<Void>
updateIcon(InputStream icon)
Updates the icon of the server.default CompletableFuture<Void>
updateIcon(InputStream icon, String fileType)
Updates the icon of the server.default CompletableFuture<Void>
updateIcon(URL icon)
Updates the icon of the server.default CompletableFuture<Void>
updateIcon(Icon icon)
Updates the icon of the server.default CompletableFuture<Void>
updateName(String name)
Updates the name of the server.default CompletableFuture<Void>
updateNickname(User user, String nickname)
Changes the nickname of the given user.default CompletableFuture<Void>
updateNickname(User user, String nickname, String reason)
Changes the nickname of the given user.default CompletableFuture<Void>
updateOwner(User owner)
Updates the owner of the server.default CompletableFuture<Void>
updateRegion(Region region)
Updates the region of the server.default CompletableFuture<Void>
updateRoles(User user, Collection<Role> roles)
Updates the roles of a server member.default CompletableFuture<Void>
updateRoles(User user, Collection<Role> roles, String reason)
Updates the roles of a server member.default CompletableFuture<Void>
updateSplash(byte[] splash)
Updates the splash of the server.default CompletableFuture<Void>
updateSplash(byte[] splash, String fileType)
Updates the splash of the server.default CompletableFuture<Void>
updateSplash(BufferedImage splash)
Updates the splash of the server.default CompletableFuture<Void>
updateSplash(BufferedImage splash, String fileType)
Updates the splash of the server.default CompletableFuture<Void>
updateSplash(File splash)
Updates the splash of the server.default CompletableFuture<Void>
updateSplash(InputStream splash)
Updates the splash of the server.default CompletableFuture<Void>
updateSplash(InputStream splash, String fileType)
Updates the splash of the server.default CompletableFuture<Void>
updateSplash(URL splash)
Updates the splash of the server.default CompletableFuture<Void>
updateSplash(Icon splash)
Updates the splash of the server.default CompletableFuture<Void>
updateVerificationLevel(VerificationLevel verificationLevel)
Updates the verification level of the server.-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getApi, getCreationTimestamp, getCreationTimestamp, getId, getIdAsString
-
Methods inherited from interface org.javacord.api.listener.server.ServerAttachableListenerManager
addCachedMessagePinListener, addCachedMessageUnpinListener, addChannelPinsUpdateListener, addKnownCustomEmojiChangeNameListener, addKnownCustomEmojiChangeWhitelistedRolesListener, addKnownCustomEmojiCreateListener, addKnownCustomEmojiDeleteListener, addMessageCreateListener, addMessageDeleteListener, addMessageEditListener, addReactionAddListener, addReactionRemoveAllListener, addReactionRemoveListener, addRoleChangeColorListener, addRoleChangeHoistListener, addRoleChangeMentionableListener, addRoleChangeNameListener, addRoleChangePermissionsListener, addRoleChangePositionListener, addRoleCreateListener, addRoleDeleteListener, addServerAttachableListener, addServerBecomesUnavailableListener, addServerChangeAfkChannelListener, addServerChangeAfkTimeoutListener, addServerChangeDefaultMessageNotificationLevelListener, addServerChangeExplicitContentFilterLevelListener, addServerChangeIconListener, addServerChangeMultiFactorAuthenticationLevelListener, addServerChangeNameListener, addServerChangeOwnerListener, addServerChangeRegionListener, addServerChangeSplashListener, addServerChangeSystemChannelListener, addServerChangeVerificationLevelListener, addServerChannelChangeNameListener, addServerChannelChangeNsfwFlagListener, addServerChannelChangeOverwrittenPermissionsListener, addServerChannelChangePositionListener, addServerChannelCreateListener, addServerChannelDeleteListener, addServerLeaveListener, addServerMemberBanListener, addServerMemberJoinListener, addServerMemberLeaveListener, addServerMemberUnbanListener, addServerTextChannelChangeSlowmodeListener, addServerTextChannelChangeTopicListener, addServerVoiceChannelChangeBitrateListener, addServerVoiceChannelChangeUserLimitListener, addServerVoiceChannelMemberJoinListener, addServerVoiceChannelMemberLeaveListener, addUserChangeActivityListener, addUserChangeAvatarListener, addUserChangeDeafenedListener, addUserChangeDiscriminatorListener, addUserChangeMutedListener, addUserChangeNameListener, addUserChangeNicknameListener, addUserChangeSelfDeafenedListener, addUserChangeSelfMutedListener, addUserChangeStatusListener, addUserRoleAddListener, addUserRoleRemoveListener, addUserStartTypingListener, addWebhooksUpdateListener, getCachedMessagePinListeners, getCachedMessageUnpinListeners, getChannelPinsUpdateListeners, getKnownCustomEmojiChangeNameListeners, getKnownCustomEmojiChangeWhitelistedRolesListeners, getKnownCustomEmojiCreateListeners, getKnownCustomEmojiDeleteListeners, getMessageCreateListeners, getMessageDeleteListeners, getMessageEditListeners, getReactionAddListeners, getReactionRemoveAllListeners, getReactionRemoveListeners, getRoleChangeColorListeners, getRoleChangeHoistListeners, getRoleChangeMentionableListeners, getRoleChangeNameListeners, getRoleChangePermissionsListeners, getRoleChangePositionListeners, getRoleCreateListeners, getRoleDeleteListeners, getServerAttachableListeners, getServerBecomesUnavailableListeners, getServerChangeAfkChannelListeners, getServerChangeAfkTimeoutListeners, getServerChangeDefaultMessageNotificationLevelListeners, getServerChangeExplicitContentFilterLevelListeners, getServerChangeIconListeners, getServerChangeMultiFactorAuthenticationLevelListeners, getServerChangeNameListeners, getServerChangeOwnerListeners, getServerChangeRegionListeners, getServerChangeSplashListeners, getServerChangeSystemChannelListeners, getServerChangeVerificationLevelListeners, getServerChannelChangeNameListeners, getServerChannelChangeNsfwFlagListeners, getServerChannelChangeOverwrittenPermissionsListeners, getServerChannelChangePositionListeners, getServerChannelCreateListeners, getServerChannelDeleteListeners, getServerLeaveListeners, getServerMemberBanListeners, getServerMemberJoinListeners, getServerMemberLeaveListeners, getServerMemberUnbanListeners, getServerTextChannelChangeSlowmodeListeners, getServerTextChannelChangeTopicListeners, getServerVoiceChannelChangeBitrateListeners, getServerVoiceChannelChangeUserLimitListeners, getServerVoiceChannelMemberJoinListeners, getServerVoiceChannelMemberLeaveListeners, getUserChangeActivityListeners, getUserChangeAvatarListeners, getUserChangeDeafenedListeners, getUserChangeDiscriminatorListeners, getUserChangeMutedListeners, getUserChangeNameListeners, getUserChangeNicknameListeners, getUserChangeSelfDeafenedListeners, getUserChangeSelfMutedListeners, getUserChangeStatusListeners, getUserRoleAddListeners, getUserRoleRemoveListeners, getUserStartTypingListeners, getWebhooksUpdateListeners, removeListener, removeServerAttachableListener
-
Methods inherited from interface org.javacord.api.entity.UpdatableFromCache
getLatestInstance
-
-
-
-
Method Detail
-
getRegion
Region getRegion()
Gets the region of the server.- Returns:
- The region of the server.
-
getNickname
Optional<String> getNickname(User user)
Gets the nickname of a user.- Parameters:
user
- The user to check.- Returns:
- The nickname of the user.
-
areYouSelfMuted
default boolean areYouSelfMuted()
Gets your self-muted state.- Returns:
- Whether you are self-muted.
-
isSelfMuted
boolean isSelfMuted(long userId)
Gets the self-muted state of the user with the given id.- Parameters:
userId
- The id of the user to check.- Returns:
- Whether the user with the given id is self-muted.
-
isSelfMuted
default boolean isSelfMuted(User user)
Gets the self-muted state of the given user.- Parameters:
user
- The user to check.- Returns:
- Whether the given user is self-muted.
-
areYouSelfDeafened
default boolean areYouSelfDeafened()
Gets your self-deafened state.- Returns:
- Whether you are self-deafened.
-
isSelfDeafened
boolean isSelfDeafened(long userId)
Gets the self-deafened state of the user with the given id.- Parameters:
userId
- The id of the user to check.- Returns:
- Whether the user with the given id is self-deafened.
-
isSelfDeafened
default boolean isSelfDeafened(User user)
Gets the self-deafened state of the given user.- Parameters:
user
- The user to check.- Returns:
- Whether the given user is self-deafened.
-
areYouMuted
default boolean areYouMuted()
Gets your muted state.- Returns:
- Whether you are muted.
-
isMuted
boolean isMuted(long userId)
Gets the muted state of the user with the given id.- Parameters:
userId
- The id of the user to check.- Returns:
- Whether the user with the given id is muted.
-
isMuted
default boolean isMuted(User user)
Gets the muted state of the given user.- Parameters:
user
- The user to check.- Returns:
- Whether the given user is muted.
-
areYouDeafened
default boolean areYouDeafened()
Gets your deafened state.- Returns:
- Whether you are deafened.
-
isDeafened
boolean isDeafened(long userId)
Gets the deafened state of the user with the given id.- Parameters:
userId
- The id of the user to check.- Returns:
- Whether the user with the given id is deafened.
-
isDeafened
default boolean isDeafened(User user)
Gets the deafened state of the given user.- Parameters:
user
- The user to check.- Returns:
- Whether the given user is deafened.
-
getDisplayName
default String getDisplayName(User user)
Gets the display name of the user on this server. If the user has a nickname, it will return the nickname, otherwise it will return the "normal" name.- Parameters:
user
- The user.- Returns:
- The display name of the user on this server.
-
getJoinedAtTimestamp
Optional<Instant> getJoinedAtTimestamp(User user)
Gets the timestamp of when a user joined the server.- Parameters:
user
- The user to check.- Returns:
- The timestamp of when the user joined the server.
-
isLarge
boolean isLarge()
Checks if the server is considered large.- Returns:
- Whether the server is large or not.
-
getMemberCount
int getMemberCount()
Gets the amount of members in this server.- Returns:
- The amount of members in this server.
-
getOwner
User getOwner()
Gets the owner of the server.- Returns:
- The owner of the server.
-
getApplicationId
Optional<Long> getApplicationId()
Gets the application id of the server's owner. The application id is only present for bot-created servers.- Returns:
- The application id of the server's owner.
-
getVerificationLevel
VerificationLevel getVerificationLevel()
Gets the verification level of the server.- Returns:
- The verification level of the server.
-
getExplicitContentFilterLevel
ExplicitContentFilterLevel getExplicitContentFilterLevel()
Gets the explicit content filter level of the server.- Returns:
- The explicit content filter level of the server.
-
getDefaultMessageNotificationLevel
DefaultMessageNotificationLevel getDefaultMessageNotificationLevel()
Gets the default message notification level of the server.- Returns:
- The default message notification level of the server.
-
getMultiFactorAuthenticationLevel
MultiFactorAuthenticationLevel getMultiFactorAuthenticationLevel()
Gets the multi factor authentication level of the server.- Returns:
- The multi factor authentication level of the server.
-
getSplash
Optional<Icon> getSplash()
Gets the splash of the server.- Returns:
- The splash of the server.
-
getSystemChannel
Optional<ServerTextChannel> getSystemChannel()
Gets the system channel of the server.- Returns:
- The system channel of the server.
-
getAfkChannel
Optional<ServerVoiceChannel> getAfkChannel()
Gets the afk channel of the server.- Returns:
- The afk channel of the server.
-
getAfkTimeoutInSeconds
int getAfkTimeoutInSeconds()
Gets the afk timeout in seconds of the server.- Returns:
- The afk timeout in seconds of the server.
-
getPruneCount
CompletableFuture<Integer> getPruneCount(int days)
Gets the amount of members without a role which were inactive at least the given amount of days.- Parameters:
days
- The amount of days the member has to be inactive.- Returns:
- The amount of member who would get kicked.
-
pruneMembers
default CompletableFuture<Integer> pruneMembers(int days)
Kicks all members without a role which were inactive at least the given amount of days.- Parameters:
days
- The amount of days the member has to be inactive.- Returns:
- The amount of member who got kicked.
-
pruneMembers
CompletableFuture<Integer> pruneMembers(int days, String reason)
Kicks all members without a role which were inactive at least the given amount of days.- Parameters:
days
- The amount of days the member has to be inactive.reason
- The audit log reason for the prune.- Returns:
- The amount of member who got kicked.
-
getInvites
CompletableFuture<Collection<RichInvite>> getInvites()
Gets the invites of the server.- Returns:
- The invites of the server.
-
getMembers
Collection<User> getMembers()
Gets a collection with all members of the server.- Returns:
- A collection with all members of the server.
-
getMemberById
Optional<User> getMemberById(long id)
Gets a member by its id.- Parameters:
id
- The id of the member.- Returns:
- The member with the given id.
-
getMemberById
default Optional<User> getMemberById(String id)
Gets a member by its id.- Parameters:
id
- The id of the member.- Returns:
- The member with the given id.
-
getMemberByDiscriminatedName
default Optional<User> getMemberByDiscriminatedName(String discriminatedName)
Gets a member by its discriminated name like e. g.Bastian#8222
. This method is case sensitive!- Parameters:
discriminatedName
- The discriminated name of the member.- Returns:
- The member with the given discriminated name.
-
getMemberByDiscriminatedNameIgnoreCase
default Optional<User> getMemberByDiscriminatedNameIgnoreCase(String discriminatedName)
Gets a member by its discriminated name like e. g.Bastian#8222
. This method is case insensitive!- Parameters:
discriminatedName
- The discriminated name of the member.- Returns:
- The member with the given discriminated name.
-
getMemberByNameAndDiscriminator
default Optional<User> getMemberByNameAndDiscriminator(String name, String discriminator)
Gets a member by its name and discriminator. This method is case sensitive!- Parameters:
name
- The name of the member.discriminator
- The discriminator of the member.- Returns:
- The member with the given name and discriminator.
-
getMemberByNameAndDiscriminatorIgnoreCase
default Optional<User> getMemberByNameAndDiscriminatorIgnoreCase(String name, String discriminator)
Gets a member by its name and discriminator. This method is case insensitive!- Parameters:
name
- The name of the member.discriminator
- The discriminator of the member.- Returns:
- The member with the given name and discriminator.
-
getMembersByName
default Collection<User> getMembersByName(String name)
Gets a collection with all members with the given name. This method is case sensitive!- Parameters:
name
- The name of the members.- Returns:
- A collection with all members with the given name.
-
getMembersByNameIgnoreCase
default Collection<User> getMembersByNameIgnoreCase(String name)
Gets a collection with all members with the given name. This method is case insensitive!- Parameters:
name
- The name of the members.- Returns:
- A collection with all members with the given name.
-
getMembersByNickname
default Collection<User> getMembersByNickname(String nickname)
Gets a collection with all members with the given nickname on this server. This method is case sensitive!- Parameters:
nickname
- The nickname of the members.- Returns:
- A collection with all members with the given nickname on this server.
-
getMembersByNicknameIgnoreCase
default Collection<User> getMembersByNicknameIgnoreCase(String nickname)
Gets a collection with all members with the given nickname on this server. This method is case insensitive!- Parameters:
nickname
- The nickname of the members.- Returns:
- A collection with all members with the given nickname on this server.
-
getMembersByDisplayName
default Collection<User> getMembersByDisplayName(String displayName)
Gets a collection with all members with the given display name on this server. This method is case sensitive!- Parameters:
displayName
- The display name of the members.- Returns:
- A collection with all members with the given display name on this server.
-
getMembersByDisplayNameIgnoreCase
default Collection<User> getMembersByDisplayNameIgnoreCase(String displayName)
Gets a collection with all members with the given display name on this server. This method is case insensitive!- Parameters:
displayName
- The display name of the members.- Returns:
- A collection with all members with the given display name on this server.
-
isMember
boolean isMember(User user)
Checks if the given user is a member of this server.- Parameters:
user
- The user to check.- Returns:
- If the user is a member of this server.
-
getRoles
List<Role> getRoles()
Gets a sorted list (by position) with all roles of the server.- Returns:
- A sorted list (by position) with all roles of the server.
-
getRoles
default List<Role> getRoles(User user)
Gets a sorted list (by position) with all roles of the user in the server.- Parameters:
user
- The user.- Returns:
- A sorted list (by position) with all roles of the user in the server.
-
getRoleById
Optional<Role> getRoleById(long id)
Gets a role by its id.- Parameters:
id
- The id of the role.- Returns:
- The role with the given id.
-
getRoleById
default Optional<Role> getRoleById(String id)
Gets a role by its id.- Parameters:
id
- The id of the role.- Returns:
- The role with the given id.
-
getEveryoneRole
default Role getEveryoneRole()
Gets the @everyone role.- Returns:
- The @everyone role.
-
getRolesByName
default List<Role> getRolesByName(String name)
Gets a sorted list (by position) with all roles with the given name. This method is case sensitive!- Parameters:
name
- The name of the roles.- Returns:
- A sorted list (by position) with all roles with the given name.
-
getRolesByNameIgnoreCase
default List<Role> getRolesByNameIgnoreCase(String name)
Gets a sorted list (by position) with all roles with the given name. This method is case insensitive!- Parameters:
name
- The name of the roles.- Returns:
- A sorted list (by position) with all roles with the given name.
-
getRoleColor
default Optional<Color> getRoleColor(User user)
Gets the displayed color of a user based on his roles on this server.- Parameters:
user
- The user.- Returns:
- The color.
-
getPermissions
default Permissions getPermissions(User user)
Gets the permissions of a user.- Parameters:
user
- The user.- Returns:
- The permissions of the user.
-
getAllowedPermissions
default Collection<PermissionType> getAllowedPermissions(User user)
Get the allowed permissions of a given user. Remember, that some permissions affect others! E.g. a user who hasPermissionType.SEND_MESSAGES
but notPermissionType.READ_MESSAGES
cannot send messages, even though he has thePermissionType.SEND_MESSAGES
permission.- Parameters:
user
- The user.- Returns:
- The allowed permissions of the given user.
-
getUnsetPermissions
default Collection<PermissionType> getUnsetPermissions(User user)
Get the unset permissions of a given user.- Parameters:
user
- The user.- Returns:
- The unset permissions of the given user.
-
hasPermissions
default boolean hasPermissions(User user, PermissionType... type)
Checks if the user has a given set of permissions.- Parameters:
user
- The user to check.type
- The permission type(s) to check.- Returns:
- Whether the user has all given permissions or not.
- See Also:
getAllowedPermissions(User)
-
hasAnyPermission
default boolean hasAnyPermission(User user, PermissionType... type)
Checks if the user has any of a given set of permissions.- Parameters:
user
- The user to check.type
- The permission type(s) to check.- Returns:
- Whether the user has any of the given permissions or not.
- See Also:
getAllowedPermissions(User)
-
createCustomEmojiBuilder
default CustomEmojiBuilder createCustomEmojiBuilder()
Creates a custom emoji builder to create custom emojis.- Returns:
- A custom emoji builder to create custom emojis.
-
createUpdater
default ServerUpdater createUpdater()
Creates an updater for this server.- Returns:
- An updater for this server.
-
updateName
default CompletableFuture<Void> updateName(String name)
Updates the name of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
name
- The new name of the server.- Returns:
- A future to check if the update was successful.
-
updateRegion
default CompletableFuture<Void> updateRegion(Region region)
Updates the region of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
region
- The new region of the server.- Returns:
- A future to check if the update was successful.
-
updateExplicitContentFilterLevel
default CompletableFuture<Void> updateExplicitContentFilterLevel(ExplicitContentFilterLevel explicitContentFilterLevel)
Updates the explicit content filter level of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
explicitContentFilterLevel
- The new explicit content filter level of the server.- Returns:
- A future to check if the update was successful.
-
updateVerificationLevel
default CompletableFuture<Void> updateVerificationLevel(VerificationLevel verificationLevel)
Updates the verification level of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
verificationLevel
- The new verification level of the server.- Returns:
- A future to check if the update was successful.
-
updateDefaultMessageNotificationLevel
default CompletableFuture<Void> updateDefaultMessageNotificationLevel(DefaultMessageNotificationLevel defaultMessageNotificationLevel)
Updates the default message notification level of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
defaultMessageNotificationLevel
- The new default message notification level of the server.- Returns:
- A future to check if the update was successful.
-
updateAfkChannel
default CompletableFuture<Void> updateAfkChannel(ServerVoiceChannel afkChannel)
Updates the afk channel of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
afkChannel
- The new afk channel of the server.- Returns:
- A future to check if the update was successful.
-
removeAfkChannel
default CompletableFuture<Void> removeAfkChannel()
Removes the afk channel of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Returns:
- A future to check if the update was successful.
-
updateAfkTimeoutInSeconds
default CompletableFuture<Void> updateAfkTimeoutInSeconds(int afkTimeout)
Updates the afk timeout of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
afkTimeout
- The new afk timeout of the server in seconds.- Returns:
- A future to check if the update was successful.
-
updateIcon
default CompletableFuture<Void> updateIcon(BufferedImage icon)
Updates the icon of the server. This method assumes the file type is "png"!If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
icon
- The new icon of the server.- Returns:
- A future to check if the update was successful.
-
updateIcon
default CompletableFuture<Void> updateIcon(BufferedImage icon, String fileType)
Updates the icon of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
icon
- The new icon of the server.fileType
- The type of the icon, e.g. "png" or "jpg".- Returns:
- A future to check if the update was successful.
-
updateIcon
default CompletableFuture<Void> updateIcon(File icon)
Updates the icon of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
icon
- The new icon of the server.- Returns:
- A future to check if the update was successful.
-
updateIcon
default CompletableFuture<Void> updateIcon(Icon icon)
Updates the icon of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
icon
- The new icon of the server.- Returns:
- A future to check if the update was successful.
-
updateIcon
default CompletableFuture<Void> updateIcon(URL icon)
Updates the icon of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
icon
- The new icon of the server.- Returns:
- A future to check if the update was successful.
-
updateIcon
default CompletableFuture<Void> updateIcon(byte[] icon)
Updates the icon of the server. This method assumes the file type is "png"!If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
icon
- The new icon of the server.- Returns:
- A future to check if the update was successful.
-
updateIcon
default CompletableFuture<Void> updateIcon(byte[] icon, String fileType)
Updates the icon of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
icon
- The new icon of the server.fileType
- The type of the icon, e.g. "png" or "jpg".- Returns:
- A future to check if the update was successful.
-
updateIcon
default CompletableFuture<Void> updateIcon(InputStream icon)
Updates the icon of the server. This method assumes the file type is "png"!If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
icon
- The new icon of the server.- Returns:
- A future to check if the update was successful.
-
updateIcon
default CompletableFuture<Void> updateIcon(InputStream icon, String fileType)
Updates the icon of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
icon
- The new icon of the server.fileType
- The type of the icon, e.g. "png" or "jpg".- Returns:
- A future to check if the update was successful.
-
removeIcon
default CompletableFuture<Void> removeIcon()
Removes the icon of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Returns:
- A future to check if the removal was successful.
-
updateOwner
default CompletableFuture<Void> updateOwner(User owner)
Updates the owner of the server. You must be the owner of this server in order to transfer it!If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
owner
- The new owner of the server.- Returns:
- A future to check if the update was successful.
-
updateSplash
default CompletableFuture<Void> updateSplash(BufferedImage splash)
Updates the splash of the server. This method assumes the file type is "png"!If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
splash
- The new splash of the server.- Returns:
- A future to check if the update was successful.
-
updateSplash
default CompletableFuture<Void> updateSplash(BufferedImage splash, String fileType)
Updates the splash of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
splash
- The new splash of the server.fileType
- The type of the splash, e.g. "png" or "jpg".- Returns:
- A future to check if the update was successful.
-
updateSplash
default CompletableFuture<Void> updateSplash(File splash)
Updates the splash of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
splash
- The new splash of the server.- Returns:
- A future to check if the update was successful.
-
updateSplash
default CompletableFuture<Void> updateSplash(Icon splash)
Updates the splash of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
splash
- The new splash of the server.- Returns:
- A future to check if the update was successful.
-
updateSplash
default CompletableFuture<Void> updateSplash(URL splash)
Updates the splash of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
splash
- The new splash of the server.- Returns:
- A future to check if the update was successful.
-
updateSplash
default CompletableFuture<Void> updateSplash(byte[] splash)
Updates the splash of the server. This method assumes the file type is "png"!If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
splash
- The new splash of the server.- Returns:
- A future to check if the update was successful.
-
updateSplash
default CompletableFuture<Void> updateSplash(byte[] splash, String fileType)
Updates the splash of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
splash
- The new splash of the server.fileType
- The type of the splash, e.g. "png" or "jpg".- Returns:
- A future to check if the update was successful.
-
updateSplash
default CompletableFuture<Void> updateSplash(InputStream splash)
Updates the splash of the server. This method assumes the file type is "png"!If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
splash
- The new splash of the server.- Returns:
- A future to check if the update was successful.
-
updateSplash
default CompletableFuture<Void> updateSplash(InputStream splash, String fileType)
Updates the splash of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
splash
- The new splash of the server.fileType
- The type of the splash, e.g. "png" or "jpg".- Returns:
- A future to check if the update was successful.
-
removeSplash
default CompletableFuture<Void> removeSplash()
Removes the splash of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Returns:
- A future to check if the removal was successful.
-
setSystemChannel
default CompletableFuture<Void> setSystemChannel(ServerTextChannel systemChannel)
Updates the system channel of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
systemChannel
- The new system channel of the server.- Returns:
- A future to check if the update was successful.
-
removeSystemChannel
default CompletableFuture<Void> removeSystemChannel()
Removes the system channel of the server.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Returns:
- A future to check if the update was successful.
-
updateNickname
default CompletableFuture<Void> updateNickname(User user, String nickname)
Changes the nickname of the given user.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The user.nickname
- The new nickname of the user.- Returns:
- A future to check if the update was successful.
-
updateNickname
default CompletableFuture<Void> updateNickname(User user, String nickname, String reason)
Changes the nickname of the given user.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The user.nickname
- The new nickname of the user.reason
- The audit log reason for this update.- Returns:
- A future to check if the update was successful.
-
resetNickname
default CompletableFuture<Void> resetNickname(User user)
Removes the nickname of the given user.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The user.- Returns:
- A future to check if the update was successful.
-
resetNickname
default CompletableFuture<Void> resetNickname(User user, String reason)
Removes the nickname of the given user.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The user.reason
- The audit log reason for this update.- Returns:
- A future to check if the update was successful.
-
delete
CompletableFuture<Void> delete()
Deletes the server.- Returns:
- A future to check if the deletion was successful.
-
leave
CompletableFuture<Void> leave()
Leaves the server.- Returns:
- A future to check if the bot successfully left the server.
-
addRoleToUser
default CompletableFuture<Void> addRoleToUser(User user, Role role)
Adds the given role to the given server member.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The server member the role should be added to.role
- The role which should be added to the server member.- Returns:
- A future to check if the update was successful.
-
addRoleToUser
CompletableFuture<Void> addRoleToUser(User user, Role role, String reason)
Adds the given role to the given server member.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The server member the role should be added to.role
- The role which should be added to the server member.reason
- The audit log reason for this update.- Returns:
- A future to check if the update was successful.
-
removeRoleFromUser
default CompletableFuture<Void> removeRoleFromUser(User user, Role role)
Removes the given role from the given server member.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The server member the role should be removed from.role
- The role which should be removed from the server member.- Returns:
- A future to check if the update was successful.
-
removeRoleFromUser
CompletableFuture<Void> removeRoleFromUser(User user, Role role, String reason)
Removes the given role from the given server member.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The server member the role should be removed from.role
- The role which should be removed from the server member.reason
- The audit log reason for this update.- Returns:
- A future to check if the update was successful.
-
updateRoles
default CompletableFuture<Void> updateRoles(User user, Collection<Role> roles)
Updates the roles of a server member. This will replace the roles of the server member with a provided collection.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The user to update the roles of.roles
- The collection of roles to replace the user's roles.- Returns:
- A future to check if the update was successful.
-
updateRoles
default CompletableFuture<Void> updateRoles(User user, Collection<Role> roles, String reason)
Updates the roles of a server member. This will replace the roles of the server member with a provided collection.If you want to update several settings at once, it's recommended to use the
ServerUpdater
fromcreateUpdater()
which provides a better performance!- Parameters:
user
- The user to update the roles of.roles
- The collection of roles to replace the user's roles.reason
- The audit log reason for this update.- Returns:
- A future to check if the update was successful.
-
reorderRoles
default CompletableFuture<Void> reorderRoles(List<Role> roles)
Reorders the roles of the server.- Parameters:
roles
- An ordered list with the new role positions.- Returns:
- A future to check if the update was successful.
-
reorderRoles
CompletableFuture<Void> reorderRoles(List<Role> roles, String reason)
Reorders the roles of the server.- Parameters:
roles
- An ordered list with the new role positions.reason
- The audit log reason for this update.- Returns:
- A future to check if the update was successful.
-
moveYourself
default CompletableFuture<Void> moveYourself(ServerVoiceChannel channel)
Moves yourself to the given channel on the server.- Parameters:
channel
- The channel to move the user to.- Returns:
- A future to check if the move was successful.
-
moveUser
default CompletableFuture<Void> moveUser(User user, ServerVoiceChannel channel)
Moves the given user to the given channel on the server.- Parameters:
user
- The user to move.channel
- The channel to move the user to.- Returns:
- A future to check if the move was successful.
-
kickUserFromVoiceChannel
default CompletableFuture<Void> kickUserFromVoiceChannel(User user)
Kicks the given user from any voice channel.- Parameters:
user
- The user to kick.- Returns:
- A future to check if the kick was successful.
-
selfMute
void selfMute()
Mutes yourself locally for the server.This cannot be undone by other users. If you want to mute yourself server-sidely, so that others can unmute you, use
muteYourself()
,muteUser(User)
ormuteUser(User, String)
.- See Also:
muteYourself()
,muteUser(User)
,muteUser(User, String)
-
selfUnmute
void selfUnmute()
Unmutes yourself locally for the server.This cannot be undone by other users. If you want to unmute yourself server-sidely, so that others can mute you, use
unmuteYourself()
,unmuteUser(User)
orunmuteUser(User, String)
.- See Also:
unmuteYourself()
,unmuteUser(User)
,unmuteUser(User, String)
-
muteYourself
default CompletableFuture<Void> muteYourself()
Mutes yourself on the server.- Returns:
- A future to check if the mute was successful.
-
unmuteYourself
default CompletableFuture<Void> unmuteYourself()
Unmutes yourself on the server.- Returns:
- A future to check if the unmute was successful.
-
muteUser
default CompletableFuture<Void> muteUser(User user)
Mutes the given user on the server.- Parameters:
user
- The user to mute.- Returns:
- A future to check if the mute was successful.
-
muteUser
default CompletableFuture<Void> muteUser(User user, String reason)
Mutes the given user on the server.- Parameters:
user
- The user to mute.reason
- The audit log reason for this action.- Returns:
- A future to check if the mute was successful.
-
unmuteUser
default CompletableFuture<Void> unmuteUser(User user)
Unmutes the given user on the server.- Parameters:
user
- The user to unmute.- Returns:
- A future to check if the unmute was successful.
-
unmuteUser
default CompletableFuture<Void> unmuteUser(User user, String reason)
Unmutes the given user on the server.- Parameters:
user
- The user to unmute.reason
- The audit log reason for this action.- Returns:
- A future to check if the unmute was successful.
-
selfDeafen
void selfDeafen()
Deafens yourself locally for the server.This cannot be undone by other users. If you want to deafen yourself server-sidely, so that others can undeafen you, use
deafenYourself()
,deafenUser(User)
ordeafenUser(User, String)
.- See Also:
deafenYourself()
,deafenUser(User)
,deafenUser(User, String)
-
selfUndeafen
void selfUndeafen()
Undeafens yourself locally for the server.This cannot be undone by other users. If you want to undeafen yourself server-sidely, so that others can deafen you, use
undeafenYourself()
,undeafenUser(User)
orundeafenUser(User, String)
.
-
deafenYourself
default CompletableFuture<Void> deafenYourself()
Deafens yourself on the server.- Returns:
- A future to check if the deafen was successful.
-
undeafenYourself
default CompletableFuture<Void> undeafenYourself()
Undeafens yourself on the server.- Returns:
- A future to check if the undeafen was successful.
-
deafenUser
default CompletableFuture<Void> deafenUser(User user)
Deafens the given user on the server.- Parameters:
user
- The user to deafen.- Returns:
- A future to check if the deafen was successful.
-
deafenUser
default CompletableFuture<Void> deafenUser(User user, String reason)
Deafens the given user on the server.- Parameters:
user
- The user to deafen.reason
- The audit log reason for this action.- Returns:
- A future to check if the deafen was successful.
-
undeafenUser
default CompletableFuture<Void> undeafenUser(User user)
Undeafens the given user on the server.- Parameters:
user
- The user to undeafen.- Returns:
- A future to check if the undeafen was successful.
-
undeafenUser
default CompletableFuture<Void> undeafenUser(User user, String reason)
Undeafens the given user on the server.- Parameters:
user
- The user to undeafen.reason
- The audit log reason for this action.- Returns:
- A future to check if the undeafen was successful.
-
kickUser
default CompletableFuture<Void> kickUser(User user)
Kicks the given user from the server.- Parameters:
user
- The user to kick.- Returns:
- A future to check if the kick was successful.
-
kickUser
CompletableFuture<Void> kickUser(User user, String reason)
Kicks the given user from the server.- Parameters:
user
- The user to kick.reason
- The audit log reason for this action.- Returns:
- A future to check if the kick was successful.
-
banUser
default CompletableFuture<Void> banUser(User user)
Bans the given user from the server.- Parameters:
user
- The user to ban.- Returns:
- A future to check if the ban was successful.
-
banUser
default CompletableFuture<Void> banUser(User user, int deleteMessageDays)
Bans the given user from the server.- Parameters:
user
- The user to ban.deleteMessageDays
- The number of days to delete messages for (0-7).- Returns:
- A future to check if the ban was successful.
-
banUser
CompletableFuture<Void> banUser(User user, int deleteMessageDays, String reason)
Bans the given user from the server.- Parameters:
user
- The user to ban.deleteMessageDays
- The number of days to delete messages for (0-7).reason
- The reason for the ban.- Returns:
- A future to check if the ban was successful.
-
unbanUser
default CompletableFuture<Void> unbanUser(User user)
Unbans the given user from the server.- Parameters:
user
- The user to ban.- Returns:
- A future to check if the unban was successful.
-
unbanUser
default CompletableFuture<Void> unbanUser(long userId)
Unbans the given user from the server.- Parameters:
userId
- The id of the user to unban.- Returns:
- A future to check if the unban was successful.
-
unbanUser
default CompletableFuture<Void> unbanUser(String userId)
Unbans the given user from the server.- Parameters:
userId
- The id of the user to unban.- Returns:
- A future to check if the unban was successful.
-
unbanUser
default CompletableFuture<Void> unbanUser(User user, String reason)
Unbans the given user from the server.- Parameters:
user
- The user to ban.reason
- The audit log reason for this action.- Returns:
- A future to check if the unban was successful.
-
unbanUser
CompletableFuture<Void> unbanUser(long userId, String reason)
Unbans the given user from the server.- Parameters:
userId
- The id of the user to unban.reason
- The audit log reason for this action.- Returns:
- A future to check if the unban was successful.
-
unbanUser
default CompletableFuture<Void> unbanUser(String userId, String reason)
Unbans the given user from the server.- Parameters:
userId
- The id of the user to unban.reason
- The audit log reason for this action.- Returns:
- A future to check if the unban was successful.
-
getBans
CompletableFuture<Collection<Ban>> getBans()
Gets a collection with all server bans.- Returns:
- A collection with all server bans.
-
getWebhooks
CompletableFuture<List<Webhook>> getWebhooks()
Gets a list of all webhooks in this server.- Returns:
- A list of all webhooks in this server.
-
getAuditLog
CompletableFuture<AuditLog> getAuditLog(int limit)
Gets the audit log of this server.- Parameters:
limit
- The maximum amount of audit log entries.- Returns:
- The audit log.
-
getAuditLog
CompletableFuture<AuditLog> getAuditLog(int limit, AuditLogActionType type)
Gets the audit log of this server.- Parameters:
limit
- The maximum amount of audit log entries.type
- The action type of the audit log.- Returns:
- The audit log.
-
getAuditLogBefore
CompletableFuture<AuditLog> getAuditLogBefore(int limit, AuditLogEntry before)
Gets the audit log of this server.- Parameters:
limit
- The maximum amount of audit log entries.before
- Filter the log before this entry.- Returns:
- The audit log.
-
getAuditLogBefore
CompletableFuture<AuditLog> getAuditLogBefore(int limit, AuditLogEntry before, AuditLogActionType type)
Gets the audit log of this server.- Parameters:
limit
- The maximum amount of audit log entries.before
- Filter the log before this entry.type
- The action type of the audit log.- Returns:
- The audit log.
-
hasPermission
default boolean hasPermission(User user, PermissionType permission)
Checks if a user has a given permission. Remember, that some permissions affect others! E.g. a user who hasPermissionType.SEND_MESSAGES
but notPermissionType.READ_MESSAGES
cannot send messages, even though he has thePermissionType.SEND_MESSAGES
permission. This method also do not take into account overwritten permissions in some channels!- Parameters:
user
- The user.permission
- The permission to check.- Returns:
- Whether the user has the permission or not.
-
getCustomEmojis
Collection<KnownCustomEmoji> getCustomEmojis()
Gets a collection with all custom emojis of this server.- Returns:
- A collection with all custom emojis of this server.
-
getCustomEmojiById
default Optional<KnownCustomEmoji> getCustomEmojiById(long id)
Gets a custom emoji in this server by its id.- Parameters:
id
- The id of the emoji.- Returns:
- The emoji with the given id.
-
getCustomEmojiById
default Optional<KnownCustomEmoji> getCustomEmojiById(String id)
Gets a custom emoji in this server by its id.- Parameters:
id
- The id of the emoji.- Returns:
- The emoji with the given id.
-
getCustomEmojisByName
default Collection<KnownCustomEmoji> getCustomEmojisByName(String name)
Gets a collection of all custom emojis with the given name in the server. This method is case sensitive!- Parameters:
name
- The name of the custom emojis.- Returns:
- A collection of all custom emojis with the given name in this server.
-
getCustomEmojisByNameIgnoreCase
default Collection<KnownCustomEmoji> getCustomEmojisByNameIgnoreCase(String name)
Gets a collection of all custom emojis with the given name in the server. This method is case insensitive!- Parameters:
name
- The name of the custom emojis.- Returns:
- A collection of all custom emojis with the given name in this server.
-
createChannelCategoryBuilder
default ChannelCategoryBuilder createChannelCategoryBuilder()
Creates a new channel category builder.- Returns:
- A builder to create a new channel category.
-
createTextChannelBuilder
default ServerTextChannelBuilder createTextChannelBuilder()
Creates a new server text channel builder.- Returns:
- A builder to create a new server text channel.
-
createVoiceChannelBuilder
default ServerVoiceChannelBuilder createVoiceChannelBuilder()
Creates a new server voice channel builder.- Returns:
- A builder to create a new server voice channel.
-
createRoleBuilder
default RoleBuilder createRoleBuilder()
Creates a new role builder.- Returns:
- A builder to create a new role.
-
getChannels
List<ServerChannel> getChannels()
Gets a sorted list (by position) with all channels of the server.- Returns:
- A sorted list (by position) with all channels of the server.
-
getChannelCategories
List<ChannelCategory> getChannelCategories()
Gets a sorted list (by position) with all channel categories of the server.- Returns:
- A sorted list (by position) with all channel categories of the server.
-
getTextChannels
List<ServerTextChannel> getTextChannels()
Gets a sorted list (by position) with all text channels of the server.- Returns:
- A sorted list (by position) with all text channels of the server.
-
getVoiceChannels
List<ServerVoiceChannel> getVoiceChannels()
Gets a sorted list (by position) with all voice channels of the server.- Returns:
- A sorted list (by position) with all voice channels of the server.
-
getChannelById
Optional<ServerChannel> getChannelById(long id)
Gets a channel by its id.- Parameters:
id
- The id of the channel.- Returns:
- The channel with the given id.
-
getChannelById
default Optional<ServerChannel> getChannelById(String id)
Gets a channel by its id.- Parameters:
id
- The id of the channel.- Returns:
- The channel with the given id.
-
getChannelsByName
default List<ServerChannel> getChannelsByName(String name)
Gets a sorted list (by position) with all channels with the given name. This method is case sensitive!- Parameters:
name
- The name of the channels.- Returns:
- A sorted list (by position) with all channels with the given name.
-
getChannelsByNameIgnoreCase
default List<ServerChannel> getChannelsByNameIgnoreCase(String name)
Gets a sorted list (by position) with all channels with the given name. This method is case insensitive!- Parameters:
name
- The name of the channels.- Returns:
- A sorted list (by position) with all channels with the given name.
-
getChannelCategoryById
default Optional<ChannelCategory> getChannelCategoryById(long id)
Gets a channel category by its id.- Parameters:
id
- The id of the channel category.- Returns:
- The channel category with the given id.
-
getChannelCategoryById
default Optional<ChannelCategory> getChannelCategoryById(String id)
Gets a channel category by its id.- Parameters:
id
- The id of the channel category.- Returns:
- The channel category with the given id.
-
getChannelCategoriesByName
default List<ChannelCategory> getChannelCategoriesByName(String name)
Gets a sorted list (by position) with all channel categories with the given name. This method is case sensitive!- Parameters:
name
- The name of the channel categories.- Returns:
- A sorted list (by position) with all channel categories with the given name.
-
getChannelCategoriesByNameIgnoreCase
default List<ChannelCategory> getChannelCategoriesByNameIgnoreCase(String name)
Gets a sorted list (by position) with all channel categories with the given name. This method is case insensitive!- Parameters:
name
- The name of the channel categories.- Returns:
- A sorted list (by position) with all channel categories with the given name.
-
getTextChannelById
default Optional<ServerTextChannel> getTextChannelById(long id)
Gets a text channel by its id.- Parameters:
id
- The id of the text channel.- Returns:
- The text channel with the given id.
-
getTextChannelById
default Optional<ServerTextChannel> getTextChannelById(String id)
Gets a text channel by its id.- Parameters:
id
- The id of the text channel.- Returns:
- The text channel with the given id.
-
getTextChannelsByName
default List<ServerTextChannel> getTextChannelsByName(String name)
Gets a sorted list (by position) with all text channels with the given name. This method is case sensitive!- Parameters:
name
- The name of the text channels.- Returns:
- A sorted list (by position) with all text channels with the given name.
-
getTextChannelsByNameIgnoreCase
default List<ServerTextChannel> getTextChannelsByNameIgnoreCase(String name)
Gets a sorted list (by position) with all text channels with the given name. This method is case insensitive!- Parameters:
name
- The name of the text channels.- Returns:
- A sorted list (by position) with all text channels with the given name.
-
getVoiceChannelById
default Optional<ServerVoiceChannel> getVoiceChannelById(long id)
Gets a voice channel by its id.- Parameters:
id
- The id of the voice channel.- Returns:
- The voice channel with the given id.
-
getVoiceChannelById
default Optional<ServerVoiceChannel> getVoiceChannelById(String id)
Gets a voice channel by its id.- Parameters:
id
- The id of the voice channel.- Returns:
- The voice channel with the given id.
-
getVoiceChannelsByName
default List<ServerVoiceChannel> getVoiceChannelsByName(String name)
Gets a sorted list (by position) with all voice channels with the given name. This method is case sensitive!- Parameters:
name
- The name of the voice channels.- Returns:
- A sorted list (by position) with all voice channels with the given name.
-
getVoiceChannelsByNameIgnoreCase
default List<ServerVoiceChannel> getVoiceChannelsByNameIgnoreCase(String name)
Gets a sorted list (by position) with all voice channels with the given name. This method is case insensitive!- Parameters:
name
- The name of the voice channels.- Returns:
- A sorted list (by position) with all voice channels with the given name.
-
getConnectedVoiceChannel
default Optional<ServerVoiceChannel> getConnectedVoiceChannel(long userId)
Gets the voice channel the user with the given id is connected to on this server if any.- Parameters:
userId
- The id of the user to check.- Returns:
- The voice channel the user is connected to.
-
getConnectedVoiceChannel
default Optional<ServerVoiceChannel> getConnectedVoiceChannel(User user)
Gets the voice channel the given user is connected to on this server if any.- Parameters:
user
- The user to check.- Returns:
- The voice channel the user is connected to.
-
getVisibleChannels
default List<ServerChannel> getVisibleChannels(User user)
Gets a sorted (by position) list with all channels of this server the given user can see. Returns an empty list, if the user is not a member of this server.- Parameters:
user
- The user to check.- Returns:
- The visible channels of this server.
-
getHighestRole
default Optional<Role> getHighestRole(User user)
Gets the highest role of the given user in this server. The optional is empty, if the user is not a member of this server.- Parameters:
user
- The user.- Returns:
- The highest role of the given user.
-
isOwner
default boolean isOwner(User user)
Checks if the given user is the owner of the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user is the owner of the server or not.
-
isAdmin
default boolean isAdmin(User user)
Checks if the given user is an administrator of the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user is an administrator of the server or not.
-
canCreateChannels
default boolean canCreateChannels(User user)
Checks if the given user can create new channels.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can create channels or not.
-
canYouCreateChannels
default boolean canYouCreateChannels()
Checks if the user of the connected account can create new channels.- Returns:
- Whether the user of the connected account can create channels or not.
-
canViewAuditLog
default boolean canViewAuditLog(User user)
Checks if the given user can view the audit log of the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can view the audit log or not.
-
canYouViewAuditLog
default boolean canYouViewAuditLog()
Checks if the user of the connected account can view the audit log of the server.- Returns:
- Whether the user of the connected account can view the audit log or not.
-
canChangeOwnNickname
default boolean canChangeOwnNickname(User user)
Checks if the given user can change its own nickname in the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can change its own nickname or not.
-
canYouChangeOwnNickname
default boolean canYouChangeOwnNickname()
Checks if the user of the connected account can change its own nickname in the server.- Returns:
- Whether the user of the connected account can change its own nickname or not.
-
canManageNicknames
default boolean canManageNicknames(User user)
Checks if the given user can manage nicknames on the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can manage nicknames or not.
-
canYouManageNicknames
default boolean canYouManageNicknames()
Checks if the user of the connected account can manage nicknames on the server.- Returns:
- Whether the user of the connected account can manage nicknames or not.
-
canMuteMembers
default boolean canMuteMembers(User user)
Checks if the given user can mute members on the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can mute members or not.
-
canYouMuteMembers
default boolean canYouMuteMembers()
Checks if the user of the connected account can mute members on the server.- Returns:
- Whether the user of the connected account can mute members or not.
-
canDeafenMembers
default boolean canDeafenMembers(User user)
Checks if the given user can deafen members on the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can deafen members or not.
-
canYouDeafenMembers
default boolean canYouDeafenMembers()
Checks if the user of the connected account can deafen members on the server.- Returns:
- Whether the user of the connected account can deafen members or not.
-
canMoveMembers
default boolean canMoveMembers(User user)
Checks if the given user can move members on the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can move members or not.
-
canYouMoveMembers
default boolean canYouMoveMembers()
Checks if the user of the connected account can move members on the server.- Returns:
- Whether the user of the connected account can move members or not.
-
canManageEmojis
default boolean canManageEmojis(User user)
Checks if the given user can manage emojis on the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can manage emojis or not.
-
canYouManageEmojis
default boolean canYouManageEmojis()
Checks if the user of the connected account can manage emojis on the server.- Returns:
- Whether the user of the connected account can manage emojis or not.
-
canManageRoles
default boolean canManageRoles(User user)
Checks if the given user can manage roles on the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can manage roles or not.
-
canYouManageRoles
default boolean canYouManageRoles()
Checks if the user of the connected account can manage roles on the server.- Returns:
- Whether the user of the connected account can manage roles or not.
-
canManageRolesOf
default boolean canManageRolesOf(User user, User target)
Checks if the user can manage the roles of the target user.- Parameters:
user
- The user that tries to manage roles.target
- The user whose roles are to be managed.- Returns:
- Whether the user can manage the target's roles.
-
canManageRole
default boolean canManageRole(User user, Role target)
Checks if the user can manage the target role.- Parameters:
user
- The user that tries to manage the role.target
- The role that is to be managed.- Returns:
- Whether the user can manage the role.
-
canManage
default boolean canManage(User user)
Checks if the given user can manage the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can manage the server or not.
-
canYouManage
default boolean canYouManage()
Checks if the user of the connected account can manage the server.- Returns:
- Whether the user of the connected account can manage the server or not.
-
canKickUsers
default boolean canKickUsers(User user)
Checks if the given user can kick users from the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can kick users or not.
-
canYouKickUsers
default boolean canYouKickUsers()
Checks if the user of the connected account can kick users from the server.- Returns:
- Whether the user of the connected account can kick users or not.
-
canKickUser
default boolean canKickUser(User user, User userToKick)
Checks if the given user can kick the other user. This method also considers the position of the user roles and the owner. If the to-be-kicked user is not part of this server, stilltrue
is returned as Discord allows this.- Parameters:
user
- The user which "want" to kick the other user.userToKick
- The user which should be kicked.- Returns:
- Whether the given user can kick the other user or not.
-
canYouKickUser
default boolean canYouKickUser(User userToKick)
Checks if the user of the connected account can kick the user. This method also considers the position of the user roles and the owner.- Parameters:
userToKick
- The user which should be kicked.- Returns:
- Whether the user of the connected account can kick the user or not.
-
canBanUsers
default boolean canBanUsers(User user)
Checks if the given user can ban users from the server.- Parameters:
user
- The user to check.- Returns:
- Whether the given user can ban users or not.
-
canYouBanUsers
default boolean canYouBanUsers()
Checks if the user of the connected account can ban users from the server.- Returns:
- Whether the user of the connected account can ban users or not.
-
canBanUser
default boolean canBanUser(User user, User userToBan)
Checks if the given user can ban the other user. This method also considers the position of the user roles and the owner.- Parameters:
user
- The user which "want" to ban the other user.userToBan
- The user which should be banned.- Returns:
- Whether the given user can ban the other user or not.
-
canYouBanUser
default boolean canYouBanUser(User userToBan)
Checks if the user of the connected account can ban the user. This method also considers the position of the user roles and the owner.- Parameters:
userToBan
- The user which should be banned.- Returns:
- Whether the user of the connected account can ban the user or not.
-
getCurrentCachedInstance
default Optional<Server> 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 interfaceUpdatableFromCache<Server>
- Returns:
- The current cached instance.
-
-