Record Class YGuild
-
Constructor Summary
ConstructorsConstructorDescriptionYGuild(net.dv8tion.jda.api.entities.Guild guild) Creates an instance of aYGuildrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.dv8tion.jda.api.requests.restaction.MemberActionnet.dv8tion.jda.api.requests.restaction.MemberActionnet.dv8tion.jda.api.requests.restaction.MemberActionnet.dv8tion.jda.api.requests.restaction.MemberActionnet.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>addRoleToMember(long userId, net.dv8tion.jda.api.entities.Role role) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>addRoleToMember(YMember member, net.dv8tion.jda.api.entities.Role role) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>addRoleToMember(String userId, net.dv8tion.jda.api.entities.Role role) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>addRoleToMember(net.dv8tion.jda.api.entities.Member member, net.dv8tion.jda.api.entities.Role role) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>Bans the user specified by the userId and deletes messages sent by the user based on the amount of delDays.@NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>ban(@NotNull net.dv8tion.jda.api.entities.Member member, int delDays) Bans theMemberand deletes messages sent by the user based on the amount of delDays.@NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>ban(@NotNull net.dv8tion.jda.api.entities.User user, int delDays) Bans theMemberand deletes messages sent by the user based on the amount of delDays.net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>ban(net.dv8tion.jda.api.entities.Member member) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>ban(net.dv8tion.jda.api.entities.User user) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.utils.concurrent.Task<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>changeUserNickname(YMember member, String nickname) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>changeUserNickname(net.dv8tion.jda.api.entities.Member member, String nickname) booleancheckReasonLength(String reason, YSlashCommandInteractionEvent event) net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.Category>createCategory(String name) <T extends net.dv8tion.jda.api.entities.ICopyableChannel>
@NotNull net.dv8tion.jda.api.requests.restaction.ChannelAction<T>createCopyOfChannel(T channel) Creates a copy of the specifiedGuildChannelin thisGuild.@NotNull net.dv8tion.jda.api.requests.restaction.RoleActioncreateCopyOfRole(@NotNull net.dv8tion.jda.api.entities.Role role) Creates a newRolein thisGuildwith the same settings as the givenRole.net.dv8tion.jda.api.requests.restaction.AuditableRestAction<net.dv8tion.jda.api.entities.Emote>createEmote(String name, net.dv8tion.jda.api.entities.Icon icon, net.dv8tion.jda.api.entities.Role... roles) @NotNull net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.NewsChannel>createNewsChannel(@NotNull String name) Creates a newNewsChannelin this Guild.net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.NewsChannel>createNewsChannel(String name, net.dv8tion.jda.api.entities.Category parent) net.dv8tion.jda.api.requests.restaction.RoleAction@NotNull net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.StageChannel>createStageChannel(@NotNull String name) Creates a newStageChannelin this Guild.net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.StageChannel>createStageChannel(String name, net.dv8tion.jda.api.entities.Category parent) net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.templates.Template>createTemplate(String name, String description) net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.TextChannel>createTextChannel(String name) net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.TextChannel>createTextChannel(String name, net.dv8tion.jda.api.entities.Category parent) @NotNull net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.VoiceChannel>createVoiceChannel(@NotNull String name) Creates a newVoiceChannelin this Guild.net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.VoiceChannel>createVoiceChannel(String name, net.dv8tion.jda.api.entities.Category parent) net.dv8tion.jda.api.requests.RestAction<Void>delete()net.dv8tion.jda.api.requests.RestAction<Void>net.dv8tion.jda.api.requests.RestAction<Void>deleteCommandById(long commandId) net.dv8tion.jda.api.requests.RestAction<Void>deleteCommandById(String commandId) net.dv8tion.jda.api.requests.restaction.CommandEditActioneditCommandById(long commandId) net.dv8tion.jda.api.requests.restaction.CommandEditActioneditCommandById(String commandId) final booleanIndicates whether some other object is "equal to" this one.@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>findMembers(@NotNull Predicate<? super net.dv8tion.jda.api.entities.Member> filter) Retrieves and collects members of this guild into a list.@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>findMembersWithRoles(@NotNull Collection<net.dv8tion.jda.api.entities.Role> roles) Retrieves and collects members of this guild into a list.@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>findMembersWithRoles(@NotNull net.dv8tion.jda.api.entities.Role... roles) Retrieves and collects members of this guild into a list.net.dv8tion.jda.api.entities.VoiceChannelnet.dv8tion.jda.api.entities.Guild.Timeoutnet.dv8tion.jda.api.managers.AudioManager@Nullable StringThe guild banner url.intList<net.dv8tion.jda.api.entities.Member>@Nullable net.dv8tion.jda.api.entities.RoleLooks up the role which is the booster role of this guild.net.dv8tion.jda.api.entities.Guild.BoostTiergetBot()@Nullable net.dv8tion.jda.api.entities.RoleLooks up the role which is the integration role for the currently connected bot (self-user).@NotNull List<net.dv8tion.jda.api.entities.Category>Gets allCategoriesin thisGuild.@NotNull List<net.dv8tion.jda.api.entities.Category>getCategoriesByName(@NotNull String name, boolean ignoreCase) Gets a list of allCategoriesin this Guild that have the same name as the one provided.@Nullable net.dv8tion.jda.api.entities.CategorygetCategoryById(long id) Gets theCategoryfrom this guild that matches the provided id.@Nullable net.dv8tion.jda.api.entities.CategorygetCategoryById(@NotNull String id) Gets theCategoryfrom this guild that matches the provided id.net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.Category><T extends net.dv8tion.jda.api.entities.Channel>
TgetChannelById(@NotNull Class<T> type, long id) Get a channel of the specified type by id.<T extends net.dv8tion.jda.api.entities.Channel>
TgetChannelById(@NotNull Class<T> type, @NotNull String id) Get a channel of the specified type by id.@NotNull List<net.dv8tion.jda.api.entities.GuildChannel>Populated list ofchannelsfor this guild.List<net.dv8tion.jda.api.entities.GuildChannel>getChannels(boolean includeHidden) net.dv8tion.jda.api.entities.TextChannelnet.dv8tion.jda.api.entities.BaseGuildMessageChannelnet.dv8tion.jda.api.entities.Guild.NotificationLevel@Nullable net.dv8tion.jda.api.entities.EmotegetEmoteById(long id) Gets anEmotefrom this guild that has the same id as the one provided.@Nullable net.dv8tion.jda.api.entities.EmotegetEmoteById(@NotNull String id) Gets anEmotefrom this guild that has the same id as the one provided.net.dv8tion.jda.api.utils.cache.SnowflakeCacheView<net.dv8tion.jda.api.entities.Emote>@NotNull List<net.dv8tion.jda.api.entities.Emote>Gets all customEmotesbelonging to thisGuild.@NotNull List<net.dv8tion.jda.api.entities.Emote>getEmotesByName(@NotNull String name, boolean ignoreCase) Gets a list of allEmotesin this Guild that have the same name as the one provided.net.dv8tion.jda.api.entities.Guild.ExplicitContentLevelnet.dv8tion.jda.api.entities.GuildChannelgetGuildChannelById(long id) net.dv8tion.jda.api.entities.GuildChannelnet.dv8tion.jda.api.entities.GuildChannelgetGuildChannelById(net.dv8tion.jda.api.entities.ChannelType type, long id) net.dv8tion.jda.api.entities.GuildChannelgetGuildChannelById(net.dv8tion.jda.api.entities.ChannelType type, String id) GetGuildChannelfor the provided ID.net.dv8tion.jda.api.JDAgetJDA()net.dv8tion.jda.api.managers.GuildManagerintintlongintintgetMember(net.dv8tion.jda.api.entities.User user) @NotNull YMembergetMemberById(long id) @NotNull YMembergetMemberById(@NotNull String id) @NotNull YMembergetMemberByTag(@NotNull String tag) @NotNull YMembergetMemberByTag(@NotNull String tag, @NotNull String discriminator) net.dv8tion.jda.api.utils.cache.MemberCacheViewintgetMembersByEffectiveName(@NotNull String name, boolean ignoreCase) getMembersByName(@NotNull String name, boolean ignoreCase) getMembersByNickname(String nickname, boolean ignoreCase) @NotNull List<net.dv8tion.jda.api.entities.Member>getMembersWithRoles(@NotNull Collection<net.dv8tion.jda.api.entities.Role> roles) Gets a list ofMembersthat have all providedRoles.getMembersWithRoles(net.dv8tion.jda.api.entities.Role... roles) getName()@Nullable net.dv8tion.jda.api.entities.NewsChannelgetNewsChannelById(long id) Gets aNewsChannelfrom this guild that has the same id as the one provided.@Nullable net.dv8tion.jda.api.entities.NewsChannelgetNewsChannelById(@NotNull String id) Gets aNewsChannelfrom this guild that has the same id as the one provided.net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.NewsChannel>@NotNull List<net.dv8tion.jda.api.entities.NewsChannel>Gets allNewsChannelsin thisGuild.@NotNull List<net.dv8tion.jda.api.entities.NewsChannel>getNewsChannelsByName(@NotNull String name, boolean ignoreCase) Gets a list of allNewsChannelsin this Guild that have the same name as the one provided.net.dv8tion.jda.api.entities.Guild.NSFWLevelgetOwner()longnet.dv8tion.jda.api.entities.Rolenet.dv8tion.jda.api.entities.Guild.MFALevel@Nullable net.dv8tion.jda.api.entities.RolegetRoleByBot(long userId) Looks up a role which is the integration role for a bot.@Nullable net.dv8tion.jda.api.entities.RolegetRoleByBot(@NotNull String userId) Looks up a role which is the integration role for a bot.@Nullable net.dv8tion.jda.api.entities.RolegetRoleByBot(@NotNull net.dv8tion.jda.api.entities.User user) Looks up a role which is the integration role for a bot.@Nullable net.dv8tion.jda.api.entities.RolegetRoleById(long id) Gets aRolefrom this guild that has the same id as the one provided.@Nullable net.dv8tion.jda.api.entities.RolegetRoleById(@NotNull String id) Gets aRolefrom this guild that has the same id as the one provided.net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.Role>@NotNull List<net.dv8tion.jda.api.entities.Role>getRoles()Gets allRolesin thisGuild.@NotNull List<net.dv8tion.jda.api.entities.Role>getRolesByName(@NotNull String name, boolean ignoreCase) Gets a list of allRolesin this Guild that have the same name as the one provided.net.dv8tion.jda.api.entities.TextChannelnet.dv8tion.jda.api.entities.Member@Nullable net.dv8tion.jda.api.entities.StageChannelgetStageChannelById(long id) Gets aStageChannelfrom this guild that has the same id as the one provided.@Nullable net.dv8tion.jda.api.entities.StageChannelgetStageChannelById(@NotNull String id) Gets aStageChannelfrom this guild that has the same id as the one provided.net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.StageChannel>@NotNull List<net.dv8tion.jda.api.entities.StageChannel>Gets allStageChannelin thisGuild.@NotNull List<net.dv8tion.jda.api.entities.StageChannel>getStageChannelsByName(@NotNull String name, boolean ignoreCase) Gets a list of allStageChannelin this Guild that have the same name as the one provided.net.dv8tion.jda.api.entities.TextChannelnet.dv8tion.jda.api.entities.TextChannelgetTextChannelById(long id) net.dv8tion.jda.api.entities.TextChannelgetTextChannelById(@NotNull String id) net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.TextChannel>@NotNull List<net.dv8tion.jda.api.entities.TextChannel>Gets allTextChannelsin thisGuild.List<net.dv8tion.jda.api.entities.TextChannel>getTextChannelsByName(String name, boolean ignoreCase) @Nullable net.dv8tion.jda.api.entities.ThreadChannelgetThreadChannelById(long id) Gets aThreadChannelfrom this guild that has the same id as the one provided.@Nullable net.dv8tion.jda.api.entities.ThreadChannelgetThreadChannelById(@NotNull String id) Gets aThreadChannelfrom this guild that has the same id as the one provided.net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.ThreadChannel>@NotNull List<net.dv8tion.jda.api.entities.ThreadChannel>Gets allThreadChannelin thisGuild.@NotNull List<net.dv8tion.jda.api.entities.ThreadChannel>getThreadChannelsByName(@NotNull String name, boolean ignoreCase) Gets a list of allThreadChannelin this Guild that have the same name as the one provided.@NotNull OffsetDateTimeThe time this entity was created.net.dv8tion.jda.api.entities.Guild.VerificationLevel@Nullable net.dv8tion.jda.api.entities.VoiceChannelgetVoiceChannelById(long id) Gets aVoiceChannelfrom this guild that has the same id as the one provided.@Nullable net.dv8tion.jda.api.entities.VoiceChannelgetVoiceChannelById(@NotNull String id) Gets aVoiceChannelfrom this guild that has the same id as the one provided.net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.VoiceChannel>@NotNull List<net.dv8tion.jda.api.entities.VoiceChannel>Gets allVoiceChannelsin thisGuild.@NotNull List<net.dv8tion.jda.api.entities.VoiceChannel>getVoiceChannelsByName(@NotNull String name, boolean ignoreCase) Gets a list of allVoiceChannelsin this Guild that have the same name as the one provided.List<net.dv8tion.jda.api.entities.GuildVoiceState>net.dv8tion.jda.api.entities.Guildguild()Returns the value of theguildrecord component.final inthashCode()Returns a hash code value for this object.booleanbooleanisLoaded()booleanbooleanisMember(net.dv8tion.jda.api.entities.User user) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>Kicks theMemberspecified by the userId from theGuild.net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>kick(net.dv8tion.jda.api.entities.Member user) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>@NotNull net.dv8tion.jda.api.requests.RestAction<Void>kickVoiceMember(@NotNull net.dv8tion.jda.api.entities.Member member) Used to kick aMemberfrom aAudioChannel.net.dv8tion.jda.api.requests.RestAction<Void>leave()@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>Retrieves and collects members of this guild into a list.net.dv8tion.jda.api.utils.concurrent.Task<Void>loadMembers(Consumer<net.dv8tion.jda.api.entities.Member> callback) net.dv8tion.jda.api.requests.restaction.order.ChannelOrderAction@NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>modifyMemberRoles(@NotNull net.dv8tion.jda.api.entities.Member member, @NotNull net.dv8tion.jda.api.entities.Role... roles) Modifies the completeRoleset of the specifiedMember
The provided roles will replace all current Roles of the specified Member.net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>modifyMemberRoles(net.dv8tion.jda.api.entities.Member member, Collection<net.dv8tion.jda.api.entities.Role> roles) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>modifyMemberRoles(net.dv8tion.jda.api.entities.Member member, Collection<net.dv8tion.jda.api.entities.Role> rolesToAdd, Collection<net.dv8tion.jda.api.entities.Role> rolesToRemove) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>modifyNickname(net.dv8tion.jda.api.entities.Member member, String nickname) @NotNull net.dv8tion.jda.api.requests.restaction.order.RoleOrderActionModifies the positional order ofGuild.getRoles()using a specificRestActionextension to allow moving Rolesup/downortoa specific position.net.dv8tion.jda.api.requests.restaction.order.RoleOrderActionmodifyRolePositions(boolean useAscendingOrder) net.dv8tion.jda.api.requests.restaction.order.ChannelOrderActionnet.dv8tion.jda.api.requests.restaction.order.CategoryOrderActionmodifyTextChannelPositions(net.dv8tion.jda.api.entities.Category category) net.dv8tion.jda.api.requests.restaction.order.ChannelOrderActionnet.dv8tion.jda.api.requests.restaction.order.CategoryOrderActionmodifyVoiceChannelPositions(net.dv8tion.jda.api.entities.Category category) net.dv8tion.jda.api.requests.RestAction<Void>moveVoiceMember(net.dv8tion.jda.api.entities.Member member, net.dv8tion.jda.api.entities.AudioChannel audioChannel) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Integer>prune(int days, boolean wait, net.dv8tion.jda.api.entities.Role... roles) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Integer>prune(int days, @NotNull net.dv8tion.jda.api.entities.Role... roles) This method will prune (kick) all members who were offline for at least days days.net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Integer>voidnet.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>removeRoleFromMember(long userId, net.dv8tion.jda.api.entities.Role role) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>removeRoleFromMember(YMember member, net.dv8tion.jda.api.entities.Role role) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>removeRoleFromMember(String userId, net.dv8tion.jda.api.entities.Role role) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>removeRoleFromMember(net.dv8tion.jda.api.entities.Member member, net.dv8tion.jda.api.entities.Role role) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>removeTimeout(@NotNull net.dv8tion.jda.api.entities.Member member) Removes a time-out from the specified Member in thisGuild.@NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>removeTimeout(YMember member) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>removeTimeoutById(long userId) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>removeTimeoutById(String userId) net.dv8tion.jda.api.utils.concurrent.Task<Void>net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.ThreadChannel>>net.dv8tion.jda.api.requests.restaction.pagination.AuditLogPaginationAction@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.Ban>retrieveBan(@NotNull YUser bannedUser) Retrieves aBanof the providedUser
If you wish to ban or unban a user, use eitheror {@link #unBan(YUser) unban(User)}. <p> Possible {@link ErrorResponse ErrorResponses} caused by the returned {@link RestAction RestAction} include the following: <ul> <li>{@link ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} <br> The ban list cannot be fetched due to a permission discrepancy</li> <li>{@link ErrorResponse#UNKNOWN_BAN UNKNOWN_BAN} <br> Either the ban was removed before finishing the task or it did not exist in the first place</li> </ul>@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.Ban>retrieveBan(@NotNull net.dv8tion.jda.api.entities.User bannedUser) Retrieves aBanof the providedUser
If you wish to ban or unban a user, use eitherban(User, int)orunban(User).@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.Ban>retrieveBanById(long userId) Retrieves aBanof the provided ID
If you wish to ban or unban a user, use eitherban(id, int)orunban(id).net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.Ban>retrieveBanById(String userId) net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.Guild.Ban>>net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.interactions.commands.Command>retrieveCommandById(long commandId) net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.interactions.commands.Command>retrieveCommandById(String commandId) net.dv8tion.jda.api.requests.RestAction<Map<String,List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>>> net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>>retrieveCommandPrivilegesById(long commandId) net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>>retrieveCommandPrivilegesById(String commandId) net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.Command>>@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.ListedEmote>retrieveEmote(@NotNull net.dv8tion.jda.api.entities.Emote emote) @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.ListedEmote>retrieveEmoteById(long id) net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.ListedEmote>net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.ListedEmote>>net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.Invite>>@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member>retrieveMember(@NotNull YUser user) @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member>retrieveMember(@NotNull net.dv8tion.jda.api.entities.User user) Load the member for the specified user.@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member>retrieveMember(@NotNull net.dv8tion.jda.api.entities.User user, boolean update) Load the member for the specified user.@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member>retrieveMemberById(long id) Load the member for the specified user.net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member>retrieveMemberById(long id, boolean update) @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member>retrieveMemberById(@NotNull String id) Load the member for the specified user.@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member>retrieveMemberById(@NotNull String id, boolean update) Load the member for the specified user.@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>retrieveMembers(boolean includePresence, @NotNull Collection<net.dv8tion.jda.api.entities.User> users) Retrieves a list of members.@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>retrieveMembers(@NotNull Collection<net.dv8tion.jda.api.entities.User> users) Retrieves a list of members.net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>retrieveMembersByIds(boolean includePresence, long... ids) @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>retrieveMembersByIds(boolean includePresence, @NotNull String... ids) Retrieves a list of members by their user id.@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>retrieveMembersByIds(boolean includePresence, @NotNull Collection<Long> ids) Retrieves a list of members by their user id.@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>retrieveMembersByIds(long... ids) Retrieves a list of members by their user id.@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>retrieveMembersByIds(@NotNull String... ids) Retrieves a list of members by their user id.@NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>retrieveMembersByIds(@NotNull Collection<Long> ids) Retrieves a list of members by their user id.net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>>retrieveMembersByPrefix(String prefix, int limit) net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.MetaData>@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member>Shortcut forguild.retrieveMemberById(guild.getOwnerIdLong()).@NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member>retrieveOwner(boolean update) Shortcut forguild.retrieveMemberById(guild.getOwnerIdLong()).net.dv8tion.jda.api.requests.RestAction<Integer>retrievePrunableMemberCount(int days) @NotNull net.dv8tion.jda.api.requests.RestAction<EnumSet<net.dv8tion.jda.api.Region>>Retrieves the available regions for this Guild
Shortcut forretrieveRegions(true)
This will include deprecated voice regions by default.net.dv8tion.jda.api.requests.RestAction<EnumSet<net.dv8tion.jda.api.Region>>retrieveRegions(boolean includeDeprecated) net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.templates.Template>>net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.VanityInvite>net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.Webhook>>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutFor(YMember member, long amount, TimeUnit unit) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutFor(YMember member, Duration duration) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutFor(YMember member, TemporalAccessor temporal) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutFor(net.dv8tion.jda.api.entities.Member member, long amount, TimeUnit unit) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutFor(net.dv8tion.jda.api.entities.Member member, Duration duration) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutFor(net.dv8tion.jda.api.entities.Member member, TemporalAccessor temporal) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutForById(long userId, long amount, TimeUnit unit) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutForById(long userId, Duration duration) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutForById(String userId, long amount, TimeUnit unit) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutForById(String userId, Duration duration) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutUntil(@NotNull net.dv8tion.jda.api.entities.Member member, @NotNull TemporalAccessor temporal) Puts the specified Member in time out in thisGuilduntil the specified date.@NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutUntilById(long userId, TemporalAccessor temporal) @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>timeoutUntilById(String userId, TemporalAccessor temporal) final StringtoString()Returns a string representation of this record class.net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>transferOwnership(YMember newOwner) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>transferOwnership(net.dv8tion.jda.api.entities.Member newOwner) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>unBan(net.dv8tion.jda.api.entities.User user) net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void>booleanunloadMember(long userId) net.dv8tion.jda.api.requests.RestAction<Map<String,List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>>> updateCommandPrivileges(Map<String, ? extends Collection<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>> privileges) net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>>updateCommandPrivilegesById(long id, Collection<? extends net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege> privileges) net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>>updateCommandPrivilegesById(long id, net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege... privileges) net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>>updateCommandPrivilegesById(String id, Collection<? extends net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege> privileges) net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>>updateCommandPrivilegesById(String id, net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege... privileges) net.dv8tion.jda.api.requests.restaction.CommandListUpdateActionnet.dv8tion.jda.api.requests.restaction.CommandCreateActionupsertCommand(String name, String description) net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.interactions.commands.Command>upsertCommand(net.dv8tion.jda.api.interactions.commands.build.CommandData command)
-
Constructor Details
-
YGuild
public YGuild(net.dv8tion.jda.api.entities.Guild guild) Creates an instance of aYGuildrecord class.- Parameters:
guild- the value for theguildrecord component
-
-
Method Details
-
getPermissionChecker
-
getGuildId
-
getGuildIdLong
-
getGuildName
-
retrieveCommands
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.Command>> retrieveCommands()- See Also:
-
Guild.retrieveCommands()
-
retrieveCommandById
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.interactions.commands.Command> retrieveCommandById(@Nonnull String commandId) - See Also:
-
Guild.retrieveCommandById(String)
-
retrieveCommandById
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.interactions.commands.Command> retrieveCommandById(long commandId) - See Also:
-
Guild.retrieveCommandById(long)
-
upsertCommand
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.interactions.commands.Command> upsertCommand(@Nonnull net.dv8tion.jda.api.interactions.commands.build.CommandData command) -
upsertCommand
-
updateCommands
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.CommandListUpdateAction updateCommands() -
editCommandById
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.CommandEditAction editCommandById(@Nonnull String commandId) -
editCommandById
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.CommandEditAction editCommandById(long commandId) -
deleteCommandById
-
deleteCommandById
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<Void> deleteCommandById(long commandId) -
retrieveCommandPrivilegesById
-
retrieveCommandPrivilegesById
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>> retrieveCommandPrivilegesById(long commandId) -
retrieveCommandPrivileges
-
updateCommandPrivilegesById
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>> updateCommandPrivilegesById(@Nonnull String id, @Nonnull Collection<? extends net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege> privileges) -
updateCommandPrivilegesById
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>> updateCommandPrivilegesById(long id, @Nonnull Collection<? extends net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege> privileges) -
updateCommandPrivilegesById
-
updateCommandPrivilegesById
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>> updateCommandPrivilegesById(long id, @Nonnull net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege... privileges) -
updateCommandPrivileges
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<Map<String,List<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>>> updateCommandPrivileges(@Nonnull Map<String, ? extends Collection<net.dv8tion.jda.api.interactions.commands.privileges.CommandPrivilege>> privileges) -
retrieveRegions
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<EnumSet<net.dv8tion.jda.api.Region>> retrieveRegions()Retrieves the available regions for this Guild
Shortcut forretrieveRegions(true)
This will include deprecated voice regions by default.- Returns:
RestAction- TypeEnumSet
-
retrieveRegions
@Nonnull public net.dv8tion.jda.api.requests.RestAction<EnumSet<net.dv8tion.jda.api.Region>> retrieveRegions(boolean includeDeprecated) -
addMember
-
addMember
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.MemberAction addMember(@Nonnull String accessToken, @Nonnull net.dv8tion.jda.api.entities.User user) -
addMember
-
addMember
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.MemberAction addMember(@Nonnull String accessToken, long userId) -
isLoaded
public boolean isLoaded() -
pruneMemberCache
public void pruneMemberCache() -
unloadMember
public boolean unloadMember(long userId) -
getMemberCount
public int getMemberCount() -
getName
-
getIconId
-
getIconUrl
-
getFeatures
-
getBot
-
getMember
-
getSplashUrl
-
getVanityCode
-
getAfkTimeout
@Nonnull public net.dv8tion.jda.api.entities.Guild.Timeout getAfkTimeout() -
isMember
public boolean isMember(@Nonnull net.dv8tion.jda.api.entities.User user) -
getSelfMember
@Nonnull public net.dv8tion.jda.api.entities.Member getSelfMember() -
getNSFWLevel
@Nonnull public net.dv8tion.jda.api.entities.Guild.NSFWLevel getNSFWLevel() -
getMember
-
getMemberCache
@Nonnull public net.dv8tion.jda.api.utils.cache.MemberCacheView getMemberCache() -
getMemberById
-
getMemberById
-
getMemberByTag
-
getMemberByTag
-
getMembersByEffectiveName
-
getMembersByName
-
getMembersByNickname
-
getMembersWithRoles
-
getMembersWithRoles
@NotNull public @NotNull List<net.dv8tion.jda.api.entities.Member> getMembersWithRoles(@NotNull @NotNull Collection<net.dv8tion.jda.api.entities.Role> roles) Gets a list ofMembersthat have all providedRoles.
If there are noMemberswith all provided roles, then this returns an empty list.This will only check cached members!
SeeMemberCachePolicy- Parameters:
roles- TheRolesthat aMembermust have to be included in the returned list.- Returns:
- Possibly-empty immutable list of Members with all provided Roles.
- Throws:
IllegalArgumentException- If a providedRoleis from a different guild or null.- See Also:
-
getMembers
-
getVanityUrl
-
retrieveVanityInvite
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.VanityInvite> retrieveVanityInvite() -
getDescription
-
getLocale
-
getBannerId
-
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 public net.dv8tion.jda.api.entities.Guild.BoostTier getBoostTier() -
getBoostCount
public int getBoostCount() -
changeUserNickname
-
changeUserNickname
-
unBan
-
unBan
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> unBan(@Nonnull net.dv8tion.jda.api.entities.User user) -
unBan
-
unBan
-
unBan
-
unBan
-
ban
-
ban
-
ban
-
ban
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> ban(@Nonnull net.dv8tion.jda.api.entities.Member member) -
ban
-
ban
-
ban
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> ban(@NotNull @NotNull net.dv8tion.jda.api.entities.Member member, int delDays) Bans theMemberand deletes messages sent by the user based on the amount of delDays.
If you wish to ban a member without deleting any messages, provide delDays with a value of 0.You can unban a user with
Guild.unban(User).Note:
Guild.getMembers()will still contain theMemberuntil Discord sends theGuildMemberRemoveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be banned due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
member- TheMemberto ban.delDays- The history of messages, in days, that will be deleted.- Returns:
AuditableRestAction- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.net.dv8tion.jda.api.exceptions.HierarchyException- If the logged in account cannot ban the other user due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException-- If the provided amount of days (delDays) is less than 0.
- If the provided amount of days (delDays) is bigger than 7.
- If the provided member is
null
-
ban
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> ban(@NotNull @NotNull net.dv8tion.jda.api.entities.User user, int delDays) Bans theMemberand deletes messages sent by the user based on the amount of delDays.
If you wish to ban a member without deleting any messages, provide delDays with a value of 0.You can unban a user with
Guild.unban(User).Note:
Guild.getMembers()will still contain theMemberuntil Discord sends theGuildMemberRemoveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be banned due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
user- TheUserto ban.delDays- The history of messages, in days, that will be deleted.- Returns:
AuditableRestAction- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.net.dv8tion.jda.api.exceptions.HierarchyException- If the logged in account cannot ban the other user due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException-- If the provided amount of days (delDays) is less than 0.
- If the provided amount of days (delDays) is bigger than 7.
- If the provided user is
null
-
ban
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> ban(@NotNull @NotNull 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:
Guild.getMembers()will still contain theUser'sMemberobject (if the User was in the Guild) until Discord sends theGuildMemberRemoveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be banned due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
userId- The id of theUserto ban.delDays- The history of messages, in days, that will be deleted.- Returns:
AuditableRestAction- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.net.dv8tion.jda.api.exceptions.HierarchyException- If the logged in account cannot ban the other user due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException-- If the provided amount of days (delDays) is less than 0.
- If the provided amount of days (delDays) is bigger than 7.
- If the provided userId is
null
-
ban
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> ban(@Nonnull net.dv8tion.jda.api.entities.User user) -
ban
-
ban
-
ban
-
ban
-
ban
-
ban
-
kick
-
kick
-
kick
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> kick(@Nonnull net.dv8tion.jda.api.entities.Member user) -
kick
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> kick(@NotNull @NotNull String userId) Kicks theMemberspecified by the userId from theGuild.Note:
Guild.getMembers()will still contain theUseruntil Discord sends theGuildMemberRemoveEvent.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be kicked due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
userId- The id of theUserto kick from theGuild.- Returns:
AuditableRestAction- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.KICK_MEMBERSpermission.net.dv8tion.jda.api.exceptions.HierarchyException- If the logged in account cannot kick the other member due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException- If the userId provided does not correspond to a Member in this Guild or the provideduserIdis blank/null.
-
kick
-
kick
-
mute
-
mute
-
addRoleToMember
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> addRoleToMember(@Nonnull net.dv8tion.jda.api.entities.Member member, @Nonnull net.dv8tion.jda.api.entities.Role role) -
addRoleToMember
-
addRoleToMember
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> addRoleToMember(long userId, @Nonnull net.dv8tion.jda.api.entities.Role role) -
addRoleToMember
-
removeRoleFromMember
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> removeRoleFromMember(@Nonnull net.dv8tion.jda.api.entities.Member member, @Nonnull net.dv8tion.jda.api.entities.Role role) -
removeRoleFromMember
-
removeRoleFromMember
-
modifyMemberRoles
@Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> modifyMemberRoles(@Nonnull net.dv8tion.jda.api.entities.Member member, @Nullable Collection<net.dv8tion.jda.api.entities.Role> rolesToAdd, @Nullable Collection<net.dv8tion.jda.api.entities.Role> rolesToRemove) -
modifyMemberRoles
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> modifyMemberRoles(@NotNull @NotNull net.dv8tion.jda.api.entities.Member member, @NotNull @NotNull net.dv8tion.jda.api.entities.Role... roles) Modifies the completeRoleset of the specifiedMember
The provided roles will replace all current Roles of the specified Member.Warning
This may not be used together with any other role add/remove/modify methods for the same Member within one event listener cycle! The changes made by this require cache updates which are triggered by lifecycle events which are received later. This may only be called again once the specific Member has been updated by aGenericGuildMemberEventtargeting the same Member.The new roles must not contain the Public Role of the Guild
Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The Members Roles could not be modified due to a permission discrepancyUNKNOWN_MEMBER
The target Member was removed from the Guild before finishing the task
Example
public static void removeRoles(Member member) { Guild guild = member.getGuild(); // pass no role, this means we set the roles of the member to an empty array. guild.modifyMemberRoles(member).queue(); }- Parameters:
member- AMemberof which to override the Roles ofroles- New collection ofRolesfor the specified Member- Returns:
AuditableRestAction- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_ROLESnet.dv8tion.jda.api.exceptions.HierarchyException- If the provided roles are higher in the Guild's hierarchy and thus cannot be modified by the currently logged in accountIllegalArgumentException-- If any of the provided arguments is
null - If any of the provided arguments is not from this Guild
- If any of the specified
Rolesis managed - If any of the specified
Rolesis thePublic Roleof this Guild
- If any of the provided arguments is
- See Also:
-
modifyMemberRoles
@Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> modifyMemberRoles(@Nonnull net.dv8tion.jda.api.entities.Member member, @Nonnull Collection<net.dv8tion.jda.api.entities.Role> roles) -
transferOwnership
@Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> transferOwnership(@Nonnull net.dv8tion.jda.api.entities.Member newOwner) -
transferOwnership
-
removeRoleFromMember
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> removeRoleFromMember(long userId, @Nonnull net.dv8tion.jda.api.entities.Role role) -
prune
-
prune
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Integer> prune(int days, boolean wait, @Nonnull net.dv8tion.jda.api.entities.Role... roles) -
timeoutFor
-
timeoutFor
-
timeoutFor
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> timeoutFor(@Nonnull YMember member, @Nonnull TemporalAccessor temporal) -
timeoutFor
-
timeoutFor
-
timeoutUntil
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> timeoutUntil(@NotNull @NotNull net.dv8tion.jda.api.entities.Member member, @NotNull @NotNull TemporalAccessor temporal) Puts the specified Member in time out in thisGuilduntil the specified date.
While a Member is in time out, all permissions exceptVIEW_CHANNELandMESSAGE_HISTORYare removed from them.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be put into time out due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
member- The member to put in time outtemporal- The time the specified Member will be released from time out or null to remove the time-out- Returns:
AuditableRestAction- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.MODERATE_MEMBERSpermission.net.dv8tion.jda.api.exceptions.HierarchyException- If the logged in account cannot put a timeout on the other Member due to permission hierarchy position.
SeeMember.canInteract(Member)IllegalArgumentException- If any of the following are true- The provided
memberis null - The provided
temporalis in the past - The provided
temporalis more than 28 days in the future
- The provided
-
timeoutFor
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> timeoutFor(@Nonnull net.dv8tion.jda.api.entities.Member member, @Nonnull TemporalAccessor temporal) -
timeoutForById
-
timeoutForById
-
timeoutForById
-
timeoutForById
-
timeoutUntilById
@CheckReturnValue @NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> timeoutUntilById(long userId, @Nonnull TemporalAccessor temporal) -
timeoutUntilById
@CheckReturnValue @NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> timeoutUntilById(@Nonnull String userId, @Nonnull TemporalAccessor temporal) -
removeTimeout
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> removeTimeout(@NotNull @NotNull net.dv8tion.jda.api.entities.Member member) Removes a time-out from the specified Member in thisGuild.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The time out cannot be removed due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the task
- Parameters:
member- The Member to remove a time-out from- Returns:
AuditableRestAction- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.MODERATE_MEMBERSpermission.net.dv8tion.jda.api.exceptions.HierarchyException- If the logged in account cannot remove the timeout from the other Member due to permission hierarchy position.
SeeMember.canInteract(Member)
-
removeTimeout
-
removeTimeoutById
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Void> removeTimeoutById(long userId) -
removeTimeoutById
-
getChannelById
@Nullable public <T extends net.dv8tion.jda.api.entities.Channel> T getChannelById(@NotNull @NotNull Class<T> type, @NotNull @NotNull String id) Get a channel of the specified type by id.This will automatically check for all channel types and cast to the specified class. If a channel with the specified id does not exist, or exists but is not an instance of the provided class, this returns null.
- Parameters:
type-Classof a channel typeid- The snowflake id of the channel- Returns:
- The casted channel, if it exists and is assignable to the provided class, or null
- Throws:
IllegalArgumentException- If null is provided, or the id is not a valid snowflake
-
getChannelById
@Nullable public <T extends net.dv8tion.jda.api.entities.Channel> T getChannelById(@NotNull @NotNull Class<T> type, long id) Get a channel of the specified type by id.This will automatically check for all channel types and cast to the specified class. If a channel with the specified id does not exist, or exists but is not an instance of the provided class, this returns null.
- Parameters:
type-Classof a channel typeid- The snowflake id of the channel- Returns:
- The casted channel, if it exists and is assignable to the provided class, or null
- Throws:
IllegalArgumentException- If null is provided
-
getGuildChannelById
-
getGuildChannelById
@Nullable public net.dv8tion.jda.api.entities.GuildChannel getGuildChannelById(long id) -
getGuildChannelById
@Nullable public net.dv8tion.jda.api.entities.GuildChannel getGuildChannelById(@Nonnull net.dv8tion.jda.api.entities.ChannelType type, @Nonnull String id) GetGuildChannelfor the provided ID.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
If this is called onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().
This is meant for systems that use a dynamicChannelTypeand can profit from a simple function to get the channel instance.To get more specific channel types you can use one of the following:
- Parameters:
type- TheChannelTypeid- The ID of the channel- Returns:
- The GuildChannel or null
-
getGuildChannelById
@Nullable public net.dv8tion.jda.api.entities.GuildChannel getGuildChannelById(@Nonnull net.dv8tion.jda.api.entities.ChannelType type, long id) -
getStageChannelCache
@Nonnull public net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.StageChannel> getStageChannelCache() -
getStageChannelsByName
@NotNull public @NotNull List<net.dv8tion.jda.api.entities.StageChannel> getStageChannelsByName(@NotNull @NotNull String name, boolean ignoreCase) Gets a list of allStageChannelin this Guild that have the same name as the one provided.
If there are noStageChannelswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returnedStageChannels.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 public @Nullable net.dv8tion.jda.api.entities.StageChannel getStageChannelById(@NotNull @NotNull String id) Gets aStageChannelfrom this guild that has the same id as the one provided. This method is similar toIGuildChannelContainer.getStageChannelById(String), but it only checks this specific Guild for a StageChannel.
If there is noStageChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theStageChannel.- Returns:
- Possibly-null
StageChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getStageChannelById
@Nullable public @Nullable net.dv8tion.jda.api.entities.StageChannel getStageChannelById(long id) Gets aStageChannelfrom this guild that has the same id as the one provided. This method is similar toIGuildChannelContainer.getStageChannelById(long), but it only checks this specific Guild for a StageChannel.
If there is noStageChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theStageChannel.- Returns:
- Possibly-null
StageChannelwith matching id.
-
getStageChannels
Gets allStageChannelin thisGuild.
The channels returned will be sorted according to their position.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getStageChannelCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of
StageChannels.
-
getThreadChannelCache
@Nonnull public net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.ThreadChannel> getThreadChannelCache() -
getThreadChannelsByName
@NotNull public @NotNull List<net.dv8tion.jda.api.entities.ThreadChannel> getThreadChannelsByName(@NotNull @NotNull String name, boolean ignoreCase) Gets a list of allThreadChannelin this Guild that have the same name as the one provided.
If there are noThreadChannelswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returnedThreadChannels.ignoreCase- Determines if the comparison ignores case when comparing. True - case-insensitive.- Returns:
- Possibly-empty immutable list of all ThreadChannel names that match the provided name.
-
getThreadChannelById
@Nullable public @Nullable net.dv8tion.jda.api.entities.ThreadChannel getThreadChannelById(@NotNull @NotNull String id) Gets aThreadChannelfrom this guild that has the same id as the one provided. This method is similar toIGuildChannelContainer.getThreadChannelById(String), but it only checks this specific Guild for a ThreadChannel.
If there is noThreadChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theThreadChannel.- Returns:
- Possibly-null
ThreadChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getThreadChannelById
@Nullable public @Nullable net.dv8tion.jda.api.entities.ThreadChannel getThreadChannelById(long id) Gets aThreadChannelfrom this guild that has the same id as the one provided. This method is similar toIGuildChannelContainer.getThreadChannelById(long), but it only checks this specific Guild for a ThreadChannel.
If there is noThreadChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theThreadChannel.- Returns:
- Possibly-null
ThreadChannelwith matching id.
-
getThreadChannels
Gets allThreadChannelin thisGuild.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
getThreadChannelCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of
ThreadChannels.
-
getCategoryById
@Nullable public @Nullable net.dv8tion.jda.api.entities.Category getCategoryById(@NotNull @NotNull String id) Gets theCategoryfrom this guild that matches the provided id. This method is similar toIGuildChannelContainer.getCategoryById(String), but it only checks in this specific Guild.
If there is no matchingCategorythis returnsnull.- Parameters:
id- The snowflake ID of the wanted Category- Returns:
- Possibly-null
Categoryfor the provided ID. - Throws:
IllegalArgumentException- If the provided ID is not a validlong
-
getCategoryById
@Nullable public @Nullable net.dv8tion.jda.api.entities.Category getCategoryById(long id) Gets theCategoryfrom this guild that matches the provided id. This method is similar toIGuildChannelContainer.getCategoryById(String), but it only checks in this specific Guild.
If there is no matchingCategorythis returnsnull.- Parameters:
id- The snowflake ID of the wanted Category- Returns:
- Possibly-null
Categoryfor the provided ID.
-
getCategories
Gets allCategoriesin thisGuild.
The returned categories will be sorted according to their position.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getCategoryCache()and use its more efficient versions of handling these values.- Returns:
- An immutable list of all
Categoriesin this Guild.
-
getCategoriesByName
@NotNull public @NotNull List<net.dv8tion.jda.api.entities.Category> getCategoriesByName(@NotNull @NotNull String name, boolean ignoreCase) Gets a list of allCategoriesin this Guild that have the same name as the one provided.
If there are no matching categories this will return an empty list.- Parameters:
name- The name to checkignoreCase- Whether to ignore case on name checking- Returns:
- Immutable list of all categories matching the provided name
- Throws:
IllegalArgumentException- If the provided name isnull
-
getCategoryCache
@Nonnull public net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.Category> getCategoryCache() -
getTextChannelCache
@Nonnull public net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.TextChannel> getTextChannelCache() -
getNewsChannelById
@Nullable public @Nullable net.dv8tion.jda.api.entities.NewsChannel getNewsChannelById(@NotNull @NotNull String id) Gets aNewsChannelfrom this guild that has the same id as the one provided. This method is similar toIGuildChannelContainer.getNewsChannelById(String), but it only checks this specific Guild for a NewsChannel.
If there is noNewsChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theNewsChannel.- Returns:
- Possibly-null
NewsChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getNewsChannelById
@Nullable public @Nullable net.dv8tion.jda.api.entities.NewsChannel getNewsChannelById(long id) Gets aNewsChannelfrom this guild that has the same id as the one provided. This method is similar toIGuildChannelContainer.getNewsChannelById(long), but it only checks this specific Guild for a NewsChannel.
If there is noNewsChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theNewsChannel.- Returns:
- Possibly-null
NewsChannelwith matching id.
-
getNewsChannels
Gets allNewsChannelsin thisGuild.
The channels returned will be sorted according to their position.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getNewsChannelCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of all
NewsChannelsin this Guild.
-
getNewsChannelsByName
@NotNull public @NotNull List<net.dv8tion.jda.api.entities.NewsChannel> getNewsChannelsByName(@NotNull @NotNull String name, boolean ignoreCase) Gets a list of allNewsChannelsin this Guild that have the same name as the one provided.
If there are noNewsChannelswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returnedNewsChannels.ignoreCase- Determines if the comparison ignores case when comparing. True - case-insensitive.- Returns:
- Possibly-empty immutable list of all NewsChannels names that match the provided name.
-
getNewsChannelCache
@Nonnull public net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.NewsChannel> getNewsChannelCache() -
getVoiceChannelById
@Nullable public @Nullable net.dv8tion.jda.api.entities.VoiceChannel getVoiceChannelById(@NotNull @NotNull String id) Gets aVoiceChannelfrom this guild that has the same id as the one provided. This method is similar toIGuildChannelContainer.getVoiceChannelById(String), but it only checks this specific Guild for a VoiceChannel.
If there is noVoiceChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theVoiceChannel.- Returns:
- Possibly-null
VoiceChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getVoiceChannelById
@Nullable public @Nullable net.dv8tion.jda.api.entities.VoiceChannel getVoiceChannelById(long id) Gets aVoiceChannelfrom this guild that has the same id as the one provided. This method is similar toIGuildChannelContainer.getVoiceChannelById(long), but it only checks this specific Guild for a VoiceChannel.
If there is noVoiceChannelwith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theVoiceChannel.- Returns:
- Possibly-null
VoiceChannelwith matching id.
-
getVoiceChannels
Gets allVoiceChannelsin thisGuild.
The channels returned will be sorted according to their position.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getVoiceChannelCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of
VoiceChannels.
-
getVoiceChannelsByName
@NotNull public @NotNull List<net.dv8tion.jda.api.entities.VoiceChannel> getVoiceChannelsByName(@NotNull @NotNull String name, boolean ignoreCase) Gets a list of allVoiceChannelsin this Guild that have the same name as the one provided.
If there are noVoiceChannelswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returnedVoiceChannels.ignoreCase- Determines if the comparison ignores case when comparing. True - case-insensitive.- Returns:
- Possibly-empty immutable list of all VoiceChannel names that match the provided name.
-
getVoiceChannelCache
@Nonnull public net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.VoiceChannel> getVoiceChannelCache() -
getChannels
Populated list ofchannelsfor this guild. This includes all types of channels, such as category/voice/text.
This includes hidden channels by default.The returned list is ordered in the same fashion as it would be by the official discord client.
- TextChannel and StoreChannel without parent
- VoiceChannel without parent
- StageChannel without parent
- Categories
- TextChannel and StoreChannel with category as parent
- VoiceChannel with category as parent
- StageChannel with category as parent
- Returns:
- Immutable list of channels for this guild
- See Also:
-
getChannels
-
getRoleById
@Nullable public @Nullable net.dv8tion.jda.api.entities.Role getRoleById(@NotNull @NotNull String id) Gets aRolefrom this guild that has the same id as the one provided.
If there is noRolewith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theRole.- Returns:
- Possibly-null
Rolewith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getRoleById
@Nullable public @Nullable net.dv8tion.jda.api.entities.Role getRoleById(long id) Gets aRolefrom this guild that has the same id as the one provided.
If there is noRolewith an id that matches the provided one, then this returnsnull.- Parameters:
id- The id of theRole.- Returns:
- Possibly-null
Rolewith matching id.
-
getRoles
Gets allRolesin thisGuild.
The roles returned will be sorted according to their position. The highest role being at index 0 and the lowest at the last index.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getRoleCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of
Roles.
-
getRolesByName
@NotNull public @NotNull List<net.dv8tion.jda.api.entities.Role> getRolesByName(@NotNull @NotNull String name, boolean ignoreCase) Gets a list of allRolesin this Guild that have the same name as the one provided.
If there are noRoleswith the provided name, then this returns an empty list.- Parameters:
name- The name used to filter the returnedRoles.ignoreCase- Determines if the comparison ignores case when comparing. True - case-insensitive.- Returns:
- Possibly-empty immutable list of all Role names that match the provided name.
-
getRoleByBot
@Nullable public @Nullable net.dv8tion.jda.api.entities.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 useRole.RoleTags.getBotIdLong()to check which bot it applies to.This requires
CacheFlag.ROLE_TAGSto be enabled. SeeJDABuilder.enableCache(...).- Parameters:
userId- The user id of the bot- Returns:
- The bot role, or null if no role matches
-
getRoleByBot
@Nullable public @Nullable net.dv8tion.jda.api.entities.Role getRoleByBot(@NotNull @NotNull 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 useRole.RoleTags.getBotIdLong()to check which bot it applies to.This requires
CacheFlag.ROLE_TAGSto be enabled. SeeJDABuilder.enableCache(...).- Parameters:
userId- The user id of the bot- Returns:
- The bot role, or null if no role matches
- Throws:
IllegalArgumentException- If the userId is null or not a valid snowflake
-
getRoleByBot
@Nullable public @Nullable net.dv8tion.jda.api.entities.Role getRoleByBot(@NotNull @NotNull net.dv8tion.jda.api.entities.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 useRole.RoleTags.getBotIdLong()to check which bot it applies to.This requires
CacheFlag.ROLE_TAGSto be enabled. SeeJDABuilder.enableCache(...).- Parameters:
user- The bot user- Returns:
- The bot role, or null if no role matches
- Throws:
IllegalArgumentException- If null is provided
-
getBotRole
@Nullable public @Nullable net.dv8tion.jda.api.entities.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 useRole.RoleTags.getBotIdLong()to check which bot it applies to.This requires
CacheFlag.ROLE_TAGSto be enabled. SeeJDABuilder.enableCache(...).- Returns:
- The bot role, or null if no role matches
-
getBoostRole
@Nullable public @Nullable net.dv8tion.jda.api.entities.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_TAGSto be enabled. SeeJDABuilder.enableCache(...).- Returns:
- The boost role, or null if no role matches
-
getRoleCache
@Nonnull public net.dv8tion.jda.api.utils.cache.SortedSnowflakeCacheView<net.dv8tion.jda.api.entities.Role> getRoleCache() -
getEmoteById
@Nullable public @Nullable net.dv8tion.jda.api.entities.Emote getEmoteById(@NotNull @NotNull String id) Gets anEmotefrom this guild that has the same id as the one provided.
If there is noEmotewith an id that matches the provided one, then this returnsnull.Unicode emojis are not included as
Emote!This requires the
CacheFlag.EMOTEto be enabled!- Parameters:
id- the emote id- Returns:
- An Emote matching the specified Id.
- Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)- See Also:
-
getEmoteById
@Nullable public @Nullable net.dv8tion.jda.api.entities.Emote getEmoteById(long id) Gets anEmotefrom this guild that has the same id as the one provided.
If there is noEmotewith an id that matches the provided one, then this returnsnull.Unicode emojis are not included as
Emote!This requires the
CacheFlag.EMOTEto be enabled!- Parameters:
id- the emote id- Returns:
- An Emote matching the specified Id.
- See Also:
-
getEmotes
Gets all customEmotesbelonging to thisGuild.
Emotes are not ordered in any specific way in the returned list.Unicode emojis are not included as
Emote!This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getEmoteCache()and use its more efficient versions of handling these values.This requires the
CacheFlag.EMOTEto be enabled!- Returns:
- An immutable List of
Emotes. - See Also:
-
getEmotesByName
@NotNull public @NotNull List<net.dv8tion.jda.api.entities.Emote> getEmotesByName(@NotNull @NotNull String name, boolean ignoreCase) Gets a list of allEmotesin this Guild that have the same name as the one provided.
If there are noEmoteswith the provided name, then this returns an empty list.Unicode emojis are not included as
Emote!This requires the
CacheFlag.EMOTEto be enabled!- Parameters:
name- The name used to filter the returnedEmotes. Without colons.ignoreCase- Determines if the comparison ignores case when comparing. True - case-insensitive.- Returns:
- Possibly-empty immutable list of all Emotes that match the provided name.
-
getEmoteCache
@Nonnull public net.dv8tion.jda.api.utils.cache.SnowflakeCacheView<net.dv8tion.jda.api.entities.Emote> getEmoteCache() -
retrieveEmotes
@Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.ListedEmote>> retrieveEmotes() -
retrieveEmoteById
@Nonnull public net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.ListedEmote> retrieveEmoteById(@Nonnull String id) -
retrieveEmoteById
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.ListedEmote> retrieveEmoteById(long id) -
retrieveEmote
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.ListedEmote> retrieveEmote(@NotNull @NotNull net.dv8tion.jda.api.entities.Emote emote) -
retrieveBanList
@Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.Guild.Ban>> retrieveBanList() -
retrieveBanById
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.Ban> retrieveBanById(long userId) Retrieves aBanof the provided ID
If you wish to ban or unban a user, use eitherban(id, int)orunban(id).Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The ban list cannot be fetched due to a permission discrepancyUNKNOWN_BAN
Either the ban was removed before finishing the task or it did not exist in the first place
- Parameters:
userId- the id of the banned user- Returns:
RestAction- Type:Ban
An unmodifiable ban object for the user banned from this guild- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.
-
retrieveBanById
@Nonnull public net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.Ban> retrieveBanById(@Nonnull String userId) -
retrieveBan
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.Ban> retrieveBan(@NotNull @NotNull net.dv8tion.jda.api.entities.User bannedUser) Retrieves aBanof the providedUser
If you wish to ban or unban a user, use eitherban(User, int)orunban(User).Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The ban list cannot be fetched due to a permission discrepancyUNKNOWN_BAN
Either the ban was removed before finishing the task or it did not exist in the first place
- Parameters:
bannedUser- the banned user- Returns:
RestAction- Type:Ban
An unmodifiable ban object for the user banned from this guild- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.
-
retrieveBan
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.Ban> retrieveBan(@NotNull @NotNull YUser bannedUser) Retrieves aBanof the providedUser
If you wish to ban or unban a user, use eitheror {@link #unBan(YUser) unban(User)}. <p> Possible {@link ErrorResponse ErrorResponses} caused by the returned {@link RestAction RestAction} include the following: <ul> <li>{@link ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} <br> The ban list cannot be fetched due to a permission discrepancy</li> <li>{@link ErrorResponse#UNKNOWN_BAN UNKNOWN_BAN} <br> Either the ban was removed before finishing the task or it did not exist in the first place</li> </ul>- Parameters:
bannedUser- the banned user- Returns:
RestAction- Type:Ban
An unmodifiable ban object for the user banned from this guild- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.BAN_MEMBERSpermission.
-
retrievePrunableMemberCount
@Nonnull public net.dv8tion.jda.api.requests.RestAction<Integer> retrievePrunableMemberCount(int days) -
getPublicRole
@Nonnull public net.dv8tion.jda.api.entities.Role getPublicRole() -
getDefaultChannel
@Nullable public net.dv8tion.jda.api.entities.BaseGuildMessageChannel getDefaultChannel() -
getManager
@Nonnull public net.dv8tion.jda.api.managers.GuildManager getManager() -
isBoostProgressBarEnabled
public boolean isBoostProgressBarEnabled() -
retrieveAuditLogs
@Nonnull public net.dv8tion.jda.api.requests.restaction.pagination.AuditLogPaginationAction retrieveAuditLogs() -
leave
-
delete
-
delete
-
getAudioManager
@Nonnull public net.dv8tion.jda.api.managers.AudioManager getAudioManager() -
requestToSpeak
-
cancelRequestToSpeak
-
getJDA
@Nonnull public net.dv8tion.jda.api.JDA getJDA() -
retrieveInvites
@Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.Invite>> retrieveInvites() -
retrieveTemplates
@Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.templates.Template>> retrieveTemplates() -
createTemplate
-
retrieveWebhooks
@Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.Webhook>> retrieveWebhooks() -
getVoiceStates
-
getVerificationLevel
@Nonnull public net.dv8tion.jda.api.entities.Guild.VerificationLevel getVerificationLevel() -
getDefaultNotificationLevel
@Nonnull public net.dv8tion.jda.api.entities.Guild.NotificationLevel getDefaultNotificationLevel() -
getRequiredMFALevel
@Nonnull public net.dv8tion.jda.api.entities.Guild.MFALevel getRequiredMFALevel() -
getExplicitContentLevel
@Nonnull public net.dv8tion.jda.api.entities.Guild.ExplicitContentLevel getExplicitContentLevel() -
loadMembers
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> loadMembers()Retrieves and collects members of this guild into a list.
This will use the configuredMemberCachePolicyto 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:ListofMember- Throws:
IllegalStateException- If theGatewayIntent.GUILD_MEMBERSis not enabled
-
findMembers
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> findMembers(@NotNull @NotNull Predicate<? super net.dv8tion.jda.api.entities.Member> filter) Retrieves and collects members of this guild into a list.
This will use the configuredMemberCachePolicyto 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:ListofMember- Throws:
IllegalArgumentException- If the provided filter is nullIllegalStateException- If theGatewayIntent.GUILD_MEMBERSis not enabled
-
findMembersWithRoles
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> findMembersWithRoles(@NotNull @NotNull Collection<net.dv8tion.jda.api.entities.Role> roles) Retrieves and collects members of this guild into a list.
This will use the configuredMemberCachePolicyto 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:ListofMember- Throws:
IllegalArgumentException- If null is providedIllegalStateException- If theGatewayIntent.GUILD_MEMBERSis not enabled- Since:
- 4.2.1
-
findMembersWithRoles
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> findMembersWithRoles(@NotNull @NotNull net.dv8tion.jda.api.entities.Role... roles) Retrieves and collects members of this guild into a list.
This will use the configuredMemberCachePolicyto 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:ListofMember- Throws:
IllegalArgumentException- If null is providedIllegalStateException- If theGatewayIntent.GUILD_MEMBERSis not enabled- Since:
- 4.2.1
-
loadMembers
-
retrieveMember
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member> retrieveMember(@NotNull @NotNull net.dv8tion.jda.api.entities.User user) Load the member for the specified user.
If the member is already loaded it will be retrieved fromgetMemberById(long)and immediately provided if the member information is consistent. The cache consistency directly relies on the enabledGatewayIntentsasGatewayIntent.GUILD_MEMBERSis required to keep the cache updated with the latest information. You can passupdate = falseto always return immediately if the member is cached regardless of cache consistency.When the intent
GUILD_MEMBERSis disabled this will always make a request even if the member is cached. You can useretrieveMember(User, boolean)to disable this behavior.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Parameters:
user- The user to load the member from- Returns:
RestAction- Type:Member- Throws:
IllegalArgumentException- If provided with null- See Also:
-
retrieveMember
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member> retrieveMember(@NotNull @NotNull YUser user) -
retrieveMemberById
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member> retrieveMemberById(@NotNull @NotNull String id) Load the member for the specified user.
If the member is already loaded it will be retrieved fromgetMemberById(long)and immediately provided if the member information is consistent. The cache consistency directly relies on the enabledGatewayIntentsasGatewayIntent.GUILD_MEMBERSis required to keep the cache updated with the latest information. You can passupdate = falseto always return immediately if the member is cached regardless of cache consistency.When the intent
GUILD_MEMBERSis disabled this will always make a request even if the member is cached. You can useretrieveMemberById(String, boolean)to disable this behavior.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Parameters:
id- The user id to load the member from- Returns:
RestAction- Type:Member- Throws:
IllegalArgumentException- If the provided id is empty or nullNumberFormatException- If the provided id is not a snowflake- See Also:
-
retrieveMemberById
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member> retrieveMemberById(long id) Load the member for the specified user.
If the member is already loaded it will be retrieved fromgetMemberById(long)and immediately provided if the member information is consistent. The cache consistency directly relies on the enabledGatewayIntentsasGatewayIntent.GUILD_MEMBERSis required to keep the cache updated with the latest information. You can passupdate = falseto always return immediately if the member is cached regardless of cache consistency.When
GatewayIntent.GUILD_MEMBERSis disabled this will always make a request even if the member is cached. You can useretrieveMemberById(long, boolean)to disable this behavior.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Parameters:
id- The user id to load the member from- Returns:
RestAction- Type:Member- See Also:
-
retrieveOwner
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member> retrieveOwner()Shortcut forguild.retrieveMemberById(guild.getOwnerIdLong()).
This will retrieve the current owner of the guild. It is possible that the owner of a guild is no longer a registered discord user in which case this will fail.When
GatewayIntent.GUILD_MEMBERSis disabled this will always make a request even if the member is cached. You can useretrieveOwner(boolean)to disable this behavior.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Returns:
RestAction- Type:Member- See Also:
-
retrieveMember
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member> retrieveMember(@NotNull @NotNull net.dv8tion.jda.api.entities.User user, boolean update) Load the member for the specified user.
If the member is already loaded it will be retrieved fromgetMemberById(long)and immediately provided if the member information is consistent. The cache consistency directly relies on the enabledGatewayIntentsasGatewayIntent.GUILD_MEMBERSis required to keep the cache updated with the latest information. You can passupdate = falseto always return immediately if the member is cached regardless of cache consistency.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Parameters:
user- The user to load the member fromupdate- 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:
IllegalArgumentException- If provided with null- See Also:
-
retrieveMemberById
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member> retrieveMemberById(@NotNull @NotNull String id, boolean update) Load the member for the specified user.
If the member is already loaded it will be retrieved fromgetMemberById(long)and immediately provided if the member information is consistent. The cache consistency directly relies on the enabledGatewayIntentsasGatewayIntent.GUILD_MEMBERSis required to keep the cache updated with the latest information. You can passupdate = falseto always return immediately if the member is cached regardless of cache consistency.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Parameters:
id- The user id to load the member fromupdate- 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:
IllegalArgumentException- If the provided id is empty or nullNumberFormatException- If the provided id is not a snowflake- See Also:
-
retrieveMemberById
@Nonnull public net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member> retrieveMemberById(long id, boolean update) -
retrieveOwner
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Member> retrieveOwner(boolean update) Shortcut forguild.retrieveMemberById(guild.getOwnerIdLong()).
This will retrieve the current owner of the guild. It is possible that the owner of a guild is no longer a registered discord user in which case this will fail.Possible
ErrorResponseExceptionsinclude:ErrorResponse.UNKNOWN_MEMBER
The specified user is not a member of this guildErrorResponse.UNKNOWN_USER
The specified user does not exist
- Parameters:
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- See Also:
-
retrieveMembers
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> retrieveMembers(@NotNull @NotNull Collection<net.dv8tion.jda.api.entities.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_PRESENCESintent is enabled, this will load theOnlineStatusandActivitiesof the members. You can useretrieveMembers(boolean, Collection)to disable presences.The requests automatically timeout after
10seconds. When the timeout occurs aTimeoutExceptionwill 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:
Taskhandle for the request- Throws:
IllegalArgumentException-- If the input contains null
- If the input is more than 100 IDs
-
retrieveMembersByIds
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> retrieveMembersByIds(@NotNull @NotNull Collection<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_PRESENCESintent is enabled, this will load theOnlineStatusandActivitiesof the members. You can useretrieveMembersByIds(boolean, Collection)to disable presences.The requests automatically timeout after
10seconds. When the timeout occurs aTimeoutExceptionwill 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:
Taskhandle for the request- Throws:
IllegalArgumentException-- If the input contains null
- If the input is more than 100 IDs
-
retrieveMembersByIds
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> retrieveMembersByIds(@NotNull @NotNull 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_PRESENCESintent is enabled, this will load theOnlineStatusandActivitiesof the members. You can useretrieveMembersByIds(boolean, String...)to disable presences.The requests automatically timeout after
10seconds. When the timeout occurs aTimeoutExceptionwill 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:
Taskhandle for the request- Throws:
IllegalArgumentException-- If the input contains null
- If the input is more than 100 IDs
-
retrieveMembersByIds
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> retrieveMembersByIds(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_PRESENCESintent is enabled, this will load theOnlineStatusandActivitiesof the members. You can useretrieveMembersByIds(boolean, long...)to disable presences.The requests automatically timeout after
10seconds. When the timeout occurs aTimeoutExceptionwill 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:
Taskhandle for the request- Throws:
IllegalArgumentException-- If the input contains null
- If the input is more than 100 IDs
-
retrieveMembers
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> retrieveMembers(boolean includePresence, @NotNull @NotNull Collection<net.dv8tion.jda.api.entities.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_PRESENCESintent enabled.The requests automatically timeout after
10seconds. When the timeout occurs aTimeoutExceptionwill 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:
Taskhandle for the request- Throws:
IllegalArgumentException-- If includePresence is
trueand the GUILD_PRESENCES intent is disabled - If the input contains null
- If the input is more than 100 users
- If includePresence is
-
retrieveMembersByIds
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> retrieveMembersByIds(boolean includePresence, @NotNull @NotNull Collection<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_PRESENCESintent enabled.The requests automatically timeout after
10seconds. When the timeout occurs aTimeoutExceptionwill 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:
Taskhandle for the request- Throws:
IllegalArgumentException-- If includePresence is
trueand the GUILD_PRESENCES intent is disabled - If the input contains null
- If the input is more than 100 IDs
- If includePresence is
-
retrieveMembersByIds
@NotNull public @NotNull net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> retrieveMembersByIds(boolean includePresence, @NotNull @NotNull 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_PRESENCESintent enabled.The requests automatically timeout after
10seconds. When the timeout occurs aTimeoutExceptionwill 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:
Taskhandle for the request- Throws:
IllegalArgumentException-- If includePresence is
trueand the GUILD_PRESENCES intent is disabled - If the input contains null
- If the input is more than 100 IDs
- If includePresence is
-
retrieveMembersByIds
@Nonnull public net.dv8tion.jda.api.utils.concurrent.Task<List<net.dv8tion.jda.api.entities.Member>> retrieveMembersByIds(boolean includePresence, long... ids) -
retrieveMembersByPrefix
-
retrieveActiveThreads
@Nonnull public net.dv8tion.jda.api.requests.RestAction<List<net.dv8tion.jda.api.entities.ThreadChannel>> retrieveActiveThreads() -
moveVoiceMember
@Nonnull public net.dv8tion.jda.api.requests.RestAction<Void> moveVoiceMember(@Nonnull net.dv8tion.jda.api.entities.Member member, @Nullable net.dv8tion.jda.api.entities.AudioChannel audioChannel) -
kickVoiceMember
@NotNull public @NotNull net.dv8tion.jda.api.requests.RestAction<Void> kickVoiceMember(@NotNull @NotNull net.dv8tion.jda.api.entities.Member member) Used to kick aMemberfrom aAudioChannel.
As a note, you cannot kick a Member that isn't already in a AudioChannel. Also, they must be in a AudioChannel in the same Guild.Equivalent to
moveVoiceMember(member, null).Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The target Member cannot be moved due to a permission discrepancyUNKNOWN_MEMBER
The specified Member was removed from the Guild before finishing the taskUNKNOWN_CHANNEL
The specified channel was deleted before finishing the task
- Parameters:
member- TheMemberthat you are moving.- Returns:
RestAction- Throws:
IllegalStateException- If the Member isn't currently in a AudioChannel in this Guild, orCacheFlag.VOICE_STATEis disabled.IllegalArgumentException-- If any of the provided arguments is
null - If the provided Member isn't part of this
Guild - If the provided AudioChannel isn't part of this
Guild
- If any of the provided arguments is
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If this account doesn't havePermission.VOICE_MOVE_OTHERSin the AudioChannel that the Member is currently in.
-
modifyNickname
-
prune
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.AuditableRestAction<Integer> prune(int days, @NotNull @NotNull net.dv8tion.jda.api.entities.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 useGuild.retrievePrunableMemberCount(int)to determine how many Members would be pruned if you were to call this method.This might time out when pruning many members. You can use
prune(days, false)to ignore the prune count and avoid a timeout.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The prune cannot finished due to a permission discrepancy
- Parameters:
days- Minimum number of days since a member has been offline to get affected.roles- Optional roles to include in prune filter- Returns:
AuditableRestAction- Type: Integer
The amount of Members that were pruned from the Guild.- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the account doesn't haveKICK_MEMBERPermission.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
-
modifyRolePositions
@CheckReturnValue @Nonnull public net.dv8tion.jda.api.requests.restaction.order.RoleOrderAction modifyRolePositions(boolean useAscendingOrder) -
getBoosters
- See Also:
-
Guild.getBoosters()
-
getMaxBitrate
public int getMaxBitrate()- See Also:
-
Guild.getMaxBitrate()
-
getMaxFileSize
public long getMaxFileSize()- See Also:
-
Guild.getMaxFileSize()
-
getMaxEmotes
public int getMaxEmotes()- See Also:
-
Guild.getMaxEmotes()
-
getMaxMembers
public int getMaxMembers() -
getMaxPresences
public int getMaxPresences() -
retrieveMetaData
@Nonnull public net.dv8tion.jda.api.requests.RestAction<net.dv8tion.jda.api.entities.Guild.MetaData> retrieveMetaData() -
getAfkChannel
@Nullable public net.dv8tion.jda.api.entities.VoiceChannel getAfkChannel() -
getSystemChannel
@Nullable public net.dv8tion.jda.api.entities.TextChannel getSystemChannel() -
getRulesChannel
@Nullable public net.dv8tion.jda.api.entities.TextChannel getRulesChannel() -
getCommunityUpdatesChannel
@Nullable public net.dv8tion.jda.api.entities.TextChannel getCommunityUpdatesChannel() -
isMember
-
createTextChannel
@Nonnull public net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.TextChannel> createTextChannel(@Nonnull String name) -
createTextChannel
@Nonnull public net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.TextChannel> createTextChannel(@Nonnull String name, @Nonnull net.dv8tion.jda.api.entities.Category parent) -
createNewsChannel
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.NewsChannel> createNewsChannel(@NotNull @NotNull String name) Creates a newNewsChannelin this Guild. For this to be successful, the logged in account has to have theMANAGE_CHANNELPermissionPossible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
name- The name of the NewsChannel to create- Returns:
- A specific
ChannelAction
This action allows setting fields for the new NewsChannel before creating it - Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_CHANNELpermissionIllegalArgumentException- If the provided name isnullor empty or greater than 100 characters in length
-
createNewsChannel
@Nonnull public net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.NewsChannel> createNewsChannel(@Nonnull String name, @Nullable net.dv8tion.jda.api.entities.Category parent) -
createVoiceChannel
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.VoiceChannel> createVoiceChannel(@NotNull @NotNull String name) Creates a newVoiceChannelin this Guild. For this to be successful, the logged in account has to have theMANAGE_CHANNELPermission.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
name- The name of the VoiceChannel to create- Returns:
- A specific
ChannelAction
This action allows setting fields for the new VoiceChannel before creating it - Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_CHANNELpermissionIllegalArgumentException- If the provided name isnullor empty or greater than 100 characters in length
-
createVoiceChannel
@Nonnull public net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.VoiceChannel> createVoiceChannel(@Nonnull String name, @Nullable net.dv8tion.jda.api.entities.Category parent) -
createStageChannel
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.StageChannel> createStageChannel(@NotNull @NotNull String name) Creates a newStageChannelin this Guild. For this to be successful, the logged in account has to have theMANAGE_CHANNELPermission.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
name- The name of the StageChannel to create- Returns:
- A specific
ChannelAction
This action allows setting fields for the new StageChannel before creating it - Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_CHANNELpermissionIllegalArgumentException- If the provided name isnullor empty or greater than 100 characters in length
-
createStageChannel
@Nonnull public net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.StageChannel> createStageChannel(@Nonnull String name, @Nullable net.dv8tion.jda.api.entities.Category parent) -
createCategory
@Nonnull public net.dv8tion.jda.api.requests.restaction.ChannelAction<net.dv8tion.jda.api.entities.Category> createCategory(@Nonnull String name) -
createCopyOfChannel
@NotNull public <T extends net.dv8tion.jda.api.entities.ICopyableChannel> @NotNull net.dv8tion.jda.api.requests.restaction.ChannelAction<T> createCopyOfChannel(@NotNull T channel) Creates a copy of the specifiedGuildChannelin thisGuild.
The provided channel need not be in the same Guild for this to work!This copies the following elements:
- Name
- Parent Category (if present)
- Voice Elements (Bitrate, Userlimit)
- Text Elements (Topic, NSFW)
- All permission overrides for Members/Roles
Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceeded
- Parameters:
channel- TheGuildChannelto use for the copy template- Returns:
- A specific
ChannelAction
This action allows setting fields for the new GuildChannel before creating it! - Throws:
IllegalArgumentException- If the provided channel isnullnet.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the currently logged in account does not have theMANAGE_CHANNELPermission- Since:
- 3.1
- See Also:
-
createTextChannel(String)createVoiceChannel(String)ChannelAction
-
createRole
@Nonnull public net.dv8tion.jda.api.requests.restaction.RoleAction createRole() -
createCopyOfRole
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.RoleAction createCopyOfRole(@NotNull @NotNull net.dv8tion.jda.api.entities.Role role) Creates a newRolein thisGuildwith the same settings as the givenRole.
The position of the specified Role does not matter in this case!It will be placed at the bottom (just over the Public Role) to avoid permission hierarchy conflicts.
For this to be successful, the logged in account has to have theMANAGE_ROLESPermission and allPermissionsthe givenRolehas.Possible
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The role could not be created due to a permission discrepancyMAX_ROLES_PER_GUILD
There are too many roles in this Guild
- Parameters:
role- TheRolethat should be copied- Returns:
RoleAction
RoleAction with already copied values from the specifiedRole- Throws:
net.dv8tion.jda.api.exceptions.InsufficientPermissionException- If the logged in account does not have thePermission.MANAGE_ROLESPermission and every Permission the provided Role hasIllegalArgumentException- If the specified role isnull
-
createEmote
@Nonnull public net.dv8tion.jda.api.requests.restaction.AuditableRestAction<net.dv8tion.jda.api.entities.Emote> createEmote(@Nonnull String name, @Nonnull net.dv8tion.jda.api.entities.Icon icon, @Nonnull net.dv8tion.jda.api.entities.Role... roles) -
modifyCategoryPositions
@Nonnull public net.dv8tion.jda.api.requests.restaction.order.ChannelOrderAction modifyCategoryPositions() -
modifyTextChannelPositions
@Nonnull public net.dv8tion.jda.api.requests.restaction.order.ChannelOrderAction modifyTextChannelPositions() -
modifyVoiceChannelPositions
@Nonnull public net.dv8tion.jda.api.requests.restaction.order.ChannelOrderAction modifyVoiceChannelPositions() -
modifyTextChannelPositions
@Nonnull public net.dv8tion.jda.api.requests.restaction.order.CategoryOrderAction modifyTextChannelPositions(@Nonnull net.dv8tion.jda.api.entities.Category category) -
modifyVoiceChannelPositions
@Nonnull public net.dv8tion.jda.api.requests.restaction.order.CategoryOrderAction modifyVoiceChannelPositions(@Nonnull net.dv8tion.jda.api.entities.Category category) -
modifyRolePositions
@NotNull public @NotNull net.dv8tion.jda.api.requests.restaction.order.RoleOrderAction modifyRolePositions()Modifies the positional order ofGuild.getRoles()using a specificRestActionextension to allow moving Rolesup/downortoa specific position.This uses ascending ordering which means the lowest role is first!
This means the highest role appears at indexn - 1and the lower role at index0.
ProvidingtruetomodifyRolePositions(boolean)will result in the ordering being in ascending order, with the lower role at indexn - 1and the highest at index0.
As a note:Member.getRoles()andGuild.getRoles()are both in descending order.Possible
ErrorResponsesinclude:UNKNOWN_ROLE
One of the roles was deleted before the completion of the taskMISSING_ACCESS
The currently logged in account was removed from the Guild
- Returns:
RoleOrderAction
-
getTextChannelById
@Nullable public net.dv8tion.jda.api.entities.TextChannel getTextChannelById(@NotNull @NotNull String id) -
getTextChannelById
@Nullable public net.dv8tion.jda.api.entities.TextChannel getTextChannelById(long id) -
getTextChannels
Gets allTextChannelsin thisGuild.
The channels returned will be sorted according to their position.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getTextChannelCache()and use its more efficient versions of handling these values.- Returns:
- An immutable List of all
TextChannelsin this Guild.
-
getTextChannelsByName
-
getOwner
- See Also:
-
Guild.getOwner()
-
getOwnerId
-
getOwnerIdLong
public long getOwnerIdLong() -
checkReasonLength
public boolean checkReasonLength(@Nonnull String reason, @Nonnull YSlashCommandInteractionEvent event) -
getTimeCreated
The time this entity was created. Calculated through the Snowflake ingetGuildIdLong().- Returns:
- OffsetDateTime - Time this entity was created at.
- See Also:
-
TimeUtil.getTimeCreated(long)
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
guild
public net.dv8tion.jda.api.entities.Guild guild()Returns the value of theguildrecord component.- Returns:
- the value of the
guildrecord component
-