ISnowflake
public interface Guild extends ISnowflake
Guild
.
This should contain all information provided from Discord about a Guild.Modifier and Type | Interface | Description |
---|---|---|
static class |
Guild.Ban |
Represents a Ban object.
|
static class |
Guild.ExplicitContentLevel |
The Explicit-Content-Filter Level of a Guild.
|
static class |
Guild.MFALevel |
Represents the Multifactor Authentication level required by the Guild.
|
static class |
Guild.NotificationLevel |
Represents the Notification-level of the Guild.
|
static class |
Guild.Timeout |
Represents the idle time allowed until a user is moved to the
AFK
VoiceChannel if one is set
(Guild.getAfkChannel() ). |
static class |
Guild.VerificationLevel |
Represents the Verification-Level of the Guild.
|
Modifier and Type | Method | Description |
---|---|---|
default MemberAction |
addMember(java.lang.String accessToken,
long userId) |
Adds the user represented by the provided id to this guild.
|
MemberAction |
addMember(java.lang.String accessToken,
java.lang.String userId) |
Adds the user represented by the provided id to this guild.
|
default MemberAction |
addMember(java.lang.String accessToken,
User user) |
Adds the provided user to this guild.
|
boolean |
checkVerification() |
Checks if the current Verification-level of this guild allows JDA to send messages to it.
|
RestAction<java.lang.Void> |
delete() |
Used to completely delete a Guild.
|
RestAction<java.lang.Void> |
delete(java.lang.String mfaCode) |
Used to completely delete a guild.
|
VoiceChannel |
getAfkChannel() |
Provides the
VoiceChannel that has been set as the channel
which Members will be moved to after they have been inactive in a
VoiceChannel for longer than getAfkTimeout() . |
Guild.Timeout |
getAfkTimeout() |
The
Timeout set for this Guild representing the amount of time
that must pass for a Member to have had no activity in a VoiceChannel
to be considered AFK. |
AudioManager |
getAudioManager() |
The
AudioManager that represents the
audio connection for this Guild. |
AuditLogPaginationAction |
getAuditLogs() |
|
default RestAction<Guild.Ban> |
getBan(User bannedUser) |
Retrieves a
Ban of the provided User
If you wish to ban or unban a user, use either GuildController.ban(User, int) or
GuildController.unban(User) . |
default RestAction<Guild.Ban> |
getBanById(long userId) |
Retrieves a
Ban of the provided ID
If you wish to ban or unban a user, use either GuildController.ban(String, int) GuildController.ban(id, int)} or
GuildController.unban(String) GuildController.unban(id)}. |
RestAction<Guild.Ban> |
getBanById(java.lang.String userId) |
Retrieves a
Ban of the provided ID
If you wish to ban or unban a user, use either GuildController.ban(id, int) or
GuildController.unban(id) . |
RestAction<java.util.List<Guild.Ban>> |
getBanList() |
Retrieves an unmodifiable list of the currently banned
Users . |
default java.util.List<Category> |
getCategories() |
Gets all
Categories in this Guild . |
default java.util.List<Category> |
getCategoriesByName(java.lang.String name,
boolean ignoreCase) |
Gets a list of all
Categories in this Guild that have the same
name as the one provided. |
default Category |
getCategoryById(long id) |
Gets the
Category from this guild that matches the provided id. |
default Category |
getCategoryById(java.lang.String id) |
Gets the
Category from this guild that matches the provided id. |
SnowflakeCacheView<Category> |
getCategoryCache() |
Sorted
SnowflakeCacheView of
all cached Categories of this Guild. |
default java.util.List<Channel> |
getChannels() |
Populated list of
channels for this guild. |
java.util.List<Channel> |
getChannels(boolean includeHidden) |
Populated list of
channels for this guild. |
GuildController |
getController() |
Returns the
GuildController for this Guild. |
TextChannel |
getDefaultChannel() |
The default
TextChannel for a Guild . |
Guild.NotificationLevel |
getDefaultNotificationLevel() |
Returns the default message Notification-Level of this Guild.
|
default Emote |
getEmoteById(long id) |
Gets an
Emote from this guild that has the same id as the
one provided. |
default Emote |
getEmoteById(java.lang.String id) |
Gets an
Emote from this guild that has the same id as the
one provided. |
SnowflakeCacheView<Emote> |
getEmoteCache() |
SnowflakeCacheView of
all cached Emotes of this Guild. |
default java.util.List<Emote> |
getEmotes() |
|
default java.util.List<Emote> |
getEmotesByName(java.lang.String name,
boolean ignoreCase) |
Gets a list of all
Emotes in this Guild that have the same
name as the one provided. |
Guild.ExplicitContentLevel |
getExplicitContentLevel() |
The level of content filtering enabled in this Guild.
|
java.util.Set<java.lang.String> |
getFeatures() |
The Features of the
Guild . |
java.lang.String |
getIconId() |
The Discord hash-id of the
Guild icon image. |
java.lang.String |
getIconUrl() |
The URL of the
Guild icon image. |
RestAction<java.util.List<Invite>> |
getInvites() |
Retrieves all
Invites for this guild. |
JDA |
getJDA() |
Returns the
JDA instance of this Guild |
GuildManager |
getManager() |
Returns the
GuildManager for this Guild, used to modify
all properties and settings of the Guild. |
Member |
getMember(User user) |
|
default Member |
getMemberById(long userId) |
Gets a
Member object via the id of the user. |
default Member |
getMemberById(java.lang.String userId) |
Gets a
Member object via the id of the user. |
MemberCacheView |
getMemberCache() |
MemberCacheView for all cached
Members of this Guild. |
default java.util.List<Member> |
getMembers() |
A list of all
Members in this Guild. |
default java.util.List<Member> |
getMembersByEffectiveName(java.lang.String name,
boolean ignoreCase) |
Gets a list of all
Members who have the same effective name as the one provided. |
default java.util.List<Member> |
getMembersByName(java.lang.String name,
boolean ignoreCase) |
Gets a list of all
Members who have the same name as the one provided. |
default java.util.List<Member> |
getMembersByNickname(java.lang.String nickname,
boolean ignoreCase) |
Gets a list of all
Members who have the same nickname as the one provided. |
default java.util.List<Member> |
getMembersWithRoles(java.util.Collection<Role> roles) |
|
default java.util.List<Member> |
getMembersWithRoles(Role... roles) |
|
java.lang.String |
getName() |
The human readable name of the
Guild . |
Member |
getOwner() |
The
Member object for the owner of this Guild. |
default java.lang.String |
getOwnerId() |
The ID for the current owner of this guild.
|
long |
getOwnerIdLong() |
The ID for the current owner of this guild.
|
RestAction<java.lang.Integer> |
getPrunableMemberCount(int days) |
The method calculates the amount of Members that would be pruned if
GuildController.prune(int) was executed. |
Role |
getPublicRole() |
|
MentionPaginationAction |
getRecentMentions() |
Retrieves the recent mentions for the currently logged in
client account in this Guild.
|
default Region |
getRegion() |
The Voice
Region that this Guild is
using for audio connections. |
java.lang.String |
getRegionRaw() |
The raw voice region name that this Guild is using
for audio connections.
|
Guild.MFALevel |
getRequiredMFALevel() |
Returns the level of multifactor authentication required to execute administrator restricted functions in this guild.
|
default Role |
getRoleById(long id) |
Gets a
Role from this guild that has the same id as the
one provided. |
default Role |
getRoleById(java.lang.String id) |
Gets a
Role from this guild that has the same id as the
one provided. |
SnowflakeCacheView<Role> |
getRoleCache() |
Sorted
SnowflakeCacheView of
all cached Roles of this Guild. |
default java.util.List<Role> |
getRoles() |
|
default java.util.List<Role> |
getRolesByName(java.lang.String name,
boolean ignoreCase) |
Gets a list of all
Roles in this Guild that have the same
name as the one provided. |
Member |
getSelfMember() |
Gets the
Member object of the currently logged in account in this guild. |
java.lang.String |
getSplashId() |
The Discord hash-id of the splash image for this Guild.
|
java.lang.String |
getSplashUrl() |
The URL of the splash image for this Guild.
|
TextChannel |
getSystemChannel() |
Provides the
TextChannel that has been set as the channel
which newly joined Members will be announced in. |
default TextChannel |
getTextChannelById(long id) |
Gets a
TextChannel from this guild that has the same id as the
one provided. |
default TextChannel |
getTextChannelById(java.lang.String id) |
Gets a
TextChannel from this guild that has the same id as the
one provided. |
SnowflakeCacheView<TextChannel> |
getTextChannelCache() |
Sorted
SnowflakeCacheView of
all cached TextChannels of this Guild. |
default java.util.List<TextChannel> |
getTextChannels() |
Gets all
TextChannels in this Guild . |
default java.util.List<TextChannel> |
getTextChannelsByName(java.lang.String name,
boolean ignoreCase) |
Gets a list of all
TextChannels in this Guild that have the same
name as the one provided. |
RestAction<java.lang.String> |
getVanityUrl() |
Gets the vanity url for this Guild.
|
Guild.VerificationLevel |
getVerificationLevel() |
Returns the verification-Level of this Guild.
|
default VoiceChannel |
getVoiceChannelById(long id) |
Gets a
VoiceChannel from this guild that has the same id as the
one provided. |
default VoiceChannel |
getVoiceChannelById(java.lang.String id) |
Gets a
VoiceChannel from this guild that has the same id as the
one provided. |
SnowflakeCacheView<VoiceChannel> |
getVoiceChannelCache() |
Sorted
SnowflakeCacheView of
all cached VoiceChannels of this Guild. |
default java.util.List<VoiceChannel> |
getVoiceChannels() |
Gets all
VoiceChannels in this Guild . |
default java.util.List<VoiceChannel> |
getVoiceChannelsByName(java.lang.String name,
boolean ignoreCase) |
Gets a list of all
VoiceChannels in this Guild that have the same
name as the one provided. |
java.util.List<GuildVoiceState> |
getVoiceStates() |
|
RestAction<java.util.List<Webhook>> |
getWebhooks() |
Retrieves all
Webhooks for this Guild. |
boolean |
isAvailable() |
Returns whether or not this Guild is available.
|
boolean |
isMember(User user) |
Used to determine if the provided
User is a member of this Guild. |
RestAction<java.lang.Void> |
leave() |
Used to leave a Guild.
|
default RestAction<ListedEmote> |
retrieveEmote(Emote emote) |
Retrieves a listed emote together with its respective creator.
|
default RestAction<ListedEmote> |
retrieveEmoteById(long id) |
Retrieves a listed emote together with its respective creator.
|
RestAction<ListedEmote> |
retrieveEmoteById(java.lang.String id) |
Retrieves a listed emote together with its respective creator.
|
RestAction<java.util.List<ListedEmote>> |
retrieveEmotes() |
Retrieves a list of emotes together with their respective creators.
|
default RestAction<java.util.EnumSet<Region>> |
retrieveRegions() |
Retrieves the available regions for this Guild
Shortcut for retrieveRegions(true)
This will include deprecated voice regions by default. |
RestAction<java.util.EnumSet<Region>> |
retrieveRegions(boolean includeDeprecated) |
Retrieves the available regions for this Guild
|
getCreationTime, getId, getIdLong
@CheckReturnValue default RestAction<java.util.EnumSet<Region>> retrieveRegions()
retrieveRegions(true)
RestAction
- Type EnumSet
@CheckReturnValue RestAction<java.util.EnumSet<Region>> retrieveRegions(boolean includeDeprecated)
includeDeprecated
- Whether to include deprecated regionsRestAction
- Type EnumSet
@CheckReturnValue MemberAction addMember(java.lang.String accessToken, java.lang.String userId)
guilds.join
.accessToken
- The access tokenuserId
- The user idMemberAction
java.lang.IllegalArgumentException
- If the user id or access token is blank, empty, or null,
or if the provided user is already in this guildInsufficientPermissionException
- If the currently logged in account does not have Permission.CREATE_INSTANT_INVITE
@CheckReturnValue default MemberAction addMember(java.lang.String accessToken, User user)
guilds.join
.accessToken
- The access tokenuser
- The userMemberAction
java.lang.IllegalArgumentException
- If the user or access token is blank, empty, or null,
or if the provided user is already in this guildInsufficientPermissionException
- If the currently logged in account does not have Permission.CREATE_INSTANT_INVITE
@CheckReturnValue default MemberAction addMember(java.lang.String accessToken, long userId)
guilds.join
.accessToken
- The access tokenuserId
- The user idMemberAction
java.lang.IllegalArgumentException
- If the user id or access token is blank, empty, or null,
or if the provided user is already in this guildInsufficientPermissionException
- If the currently logged in account does not have Permission.CREATE_INSTANT_INVITE
java.lang.String getName()
Guild
.
This value can be modified using GuildManager.setName(String)
.
java.lang.String getIconId()
Guild
icon image.
If no icon has been set, this returns null
.
The Guild icon can be modified using GuildManager.setIcon(Icon)
.
java.lang.String getIconUrl()
Guild
icon image.
If no icon has been set, this returns null
.
The Guild icon can be modified using GuildManager.setIcon(Icon)
.
java.util.Set<java.lang.String> getFeatures()
Guild
.
Possible known features:
getVanityUrl()
getSplashId()
and getSplashUrl()
java.lang.String getSplashId()
null
.
The Guild splash can be modified using GuildManager.setSplash(Icon)
.
java.lang.String getSplashUrl()
null
.
The Guild splash can be modified using GuildManager.setSplash(Icon)
.
@CheckReturnValue RestAction<java.lang.String> getVanityUrl()
discord.gg/{code}
to get the invite link.
getFeatures()
to see if this Guild has a vanity url
This action requires the MANAGE_SERVER
permission.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
RestAction
- Type: String
InsufficientPermissionException
- If the logged in account does not have the MANAGE_SERVER
permission.java.lang.IllegalStateException
- If the guild doesn't have the VANITY_URL featuregetFeatures()
VoiceChannel getAfkChannel()
VoiceChannel
that has been set as the channel
which Members
will be moved to after they have been inactive in a
VoiceChannel
for longer than getAfkTimeout()
.
null
.
This value can be modified using GuildManager.setAfkChannel(VoiceChannel)
.
VoiceChannel
that is the AFK Channel.TextChannel getSystemChannel()
TextChannel
that has been set as the channel
which newly joined Members
will be announced in.
null
.
This value can be modified using GuildManager.setSystemChannel(TextChannel)
.
TextChannel
that is the system Channel.Member getOwner()
Member
object for the owner of this Guild.
Ownership can be transferred using GuildController.transferOwnership(Member)
.
getOwnerIdLong()
long getOwnerIdLong()
getOwner()
default java.lang.String getOwnerId()
getOwner()
Guild.Timeout getAfkTimeout()
Timeout
set for this Guild representing the amount of time
that must pass for a Member to have had no activity in a VoiceChannel
to be considered AFK. If getAfkChannel()
is not null
(thus an AFK channel has been set) then Member
will be automatically moved to the AFK channel after they have been inactive for longer than the returned Timeout.
300 seconds (5 minutes)
.
This value can be modified using GuildManager.setAfkTimeout(net.dv8tion.jda.core.entities.Guild.Timeout)
.
Timeout
set for this Guild.default Region getRegion()
Region
that this Guild is
using for audio connections.
UNKNOWN
but you
can still use the getRegionRaw()
to retrieve the raw name this region has.
This value can be modified using GuildManager.setRegion(net.dv8tion.jda.core.Region)
.
java.lang.String getRegionRaw()
Region
by getRegion()
!
This value can be modified using GuildManager.setRegion(net.dv8tion.jda.core.Region)
.
boolean isMember(User user)
User
is a member of this Guild.user
- The user to determine whether or not they are a member of this guild.Member getSelfMember()
Member
object of the currently logged in account in this guild.
JDA.getSelfUser()
being provided to getMember(User)
.default Member getMemberById(java.lang.String userId)
Member
object via the id of the user. The id relates to
ISnowflake.getId()
, and this method is similar to JDA.getUserById(String)
JDA.getUserById(String)
and getMember(User)
.
userId
provided, this returns null
.userId
- The Discord id of the User for which a Member object is requested.Member
with the related userId
.java.lang.NumberFormatException
- If the provided id
cannot be parsed by Long.parseLong(String)
default Member getMemberById(long userId)
Member
object via the id of the user. The id relates to
ISnowflake.getIdLong()
, and this method is similar to JDA.getUserById(long)
JDA.getUserById(long)
and getMember(User)
.
userId
provided, this returns null
.userId
- The Discord id of the User for which a Member object is requested.Member
with the related userId
.default java.util.List<Member> getMembers()
Members
in this Guild.
default java.util.List<Member> getMembersByName(java.lang.String name, boolean ignoreCase)
Members
who have the same name as the one provided.
Member.getUser()
.getName()
Members
with the provided name, then this returns an empty list.name
- The name used to filter the returned Members.ignoreCase
- Determines if the comparison ignores case when comparing. True - case insensitive.default java.util.List<Member> getMembersByNickname(java.lang.String nickname, boolean ignoreCase)
Members
who have the same nickname as the one provided.
Member.getNickname()
. If a Member does not have a nickname, the comparison results as false.
Members
with the provided name, then this returns an empty list.nickname
- The nickname used to filter the returned Members.ignoreCase
- Determines if the comparison ignores case when comparing. True - case insensitive.default java.util.List<Member> getMembersByEffectiveName(java.lang.String name, boolean ignoreCase)
Members
who have the same effective name as the one provided.
Member.getEffectiveName()
}.
Members
with the provided name, then this returns an empty list.name
- The name used to filter the returned Members.ignoreCase
- Determines if the comparison ignores case when comparing. True - case insensitive.default java.util.List<Member> getMembersWithRoles(java.util.Collection<Role> roles)
MemberCacheView getMemberCache()
MemberCacheView
for all cached
Members
of this Guild.MemberCacheView
default Category getCategoryById(java.lang.String id)
Category
from this guild that matches the provided id.
This method is similar to JDA.getCategoryById(String)
, but it only checks in this
specific Guild. Category
this returns
null
.id
- The snowflake ID of the wanted CategoryCategory
for the provided ID.java.lang.IllegalArgumentException
- If the provided ID is not a valid long
default Category getCategoryById(long id)
Category
from this guild that matches the provided id.
This method is similar to JDA.getCategoryById(String)
, but it only checks in this
specific Guild. Category
this returns
null
.id
- The snowflake ID of the wanted CategoryCategory
for the provided ID.default java.util.List<Category> getCategories()
Categories
in this Guild
.
Categories
in this Guild.default java.util.List<Category> getCategoriesByName(java.lang.String name, boolean ignoreCase)
Categories
in this Guild that have the same
name as the one provided. name
- The name to checkignoreCase
- Whether to ignore case on name checkingjava.lang.IllegalArgumentException
- If the provided name is null
SnowflakeCacheView<Category> getCategoryCache()
SnowflakeCacheView
of
all cached Categories
of this Guild.
SnowflakeCacheView
default TextChannel getTextChannelById(java.lang.String id)
TextChannel
from this guild that has the same id as the
one provided. This method is similar to JDA.getTextChannelById(String)
, but it only
checks this specific Guild for a TextChannel.
TextChannel
with an id that matches the provided
one, then this returns null
.id
- The id of the TextChannel
.TextChannel
with matching id.java.lang.NumberFormatException
- If the provided id
cannot be parsed by Long.parseLong(String)
default TextChannel getTextChannelById(long id)
TextChannel
from this guild that has the same id as the
one provided. This method is similar to JDA.getTextChannelById(long)
, but it only
checks this specific Guild for a TextChannel.
TextChannel
with an id that matches the provided
one, then this returns null
.id
- The id of the TextChannel
.TextChannel
with matching id.default java.util.List<TextChannel> getTextChannels()
TextChannels
in this Guild
.
TextChannels
in this Guild.default java.util.List<TextChannel> getTextChannelsByName(java.lang.String name, boolean ignoreCase)
TextChannels
in this Guild that have the same
name as the one provided.
TextChannels
with the provided name, then this returns an empty list.name
- The name used to filter the returned TextChannels
.ignoreCase
- Determines if the comparison ignores case when comparing. True - case insensitive.SnowflakeCacheView<TextChannel> getTextChannelCache()
SnowflakeCacheView
of
all cached TextChannels
of this Guild.
SnowflakeCacheView
default VoiceChannel getVoiceChannelById(java.lang.String id)
VoiceChannel
from this guild that has the same id as the
one provided. This method is similar to JDA.getVoiceChannelById(String)
, but it only
checks this specific Guild for a VoiceChannel.
VoiceChannel
with an id that matches the provided
one, then this returns null
.id
- The id of the VoiceChannel
.VoiceChannel
with matching id.java.lang.NumberFormatException
- If the provided id
cannot be parsed by Long.parseLong(String)
default VoiceChannel getVoiceChannelById(long id)
VoiceChannel
from this guild that has the same id as the
one provided. This method is similar to JDA.getVoiceChannelById(long)
, but it only
checks this specific Guild for a VoiceChannel.
VoiceChannel
with an id that matches the provided
one, then this returns null
.id
- The id of the VoiceChannel
.VoiceChannel
with matching id.default java.util.List<VoiceChannel> getVoiceChannels()
VoiceChannels
in this Guild
.
VoiceChannels
.default java.util.List<VoiceChannel> getVoiceChannelsByName(java.lang.String name, boolean ignoreCase)
VoiceChannels
in this Guild that have the same
name as the one provided.
VoiceChannels
with the provided name, then this returns an empty list.name
- The name used to filter the returned VoiceChannels
.ignoreCase
- Determines if the comparison ignores case when comparing. True - case insensitive.SnowflakeCacheView<VoiceChannel> getVoiceChannelCache()
SnowflakeCacheView
of
all cached VoiceChannels
of this Guild.
SnowflakeCacheView
default java.util.List<Channel> getChannels()
channels
for this guild.
This includes all types of channels, such as category/voice/text.
The returned list is ordered in the same fashion as it would be by the official discord client.
getChannels(boolean)
java.util.List<Channel> getChannels(boolean includeHidden)
channels
for this guild.
This includes all types of channels, such as category/voice/text.
The returned list is ordered in the same fashion as it would be by the official discord client.
includeHidden
- Whether to include channels with denied View Channel Permission
getChannels()
default Role getRoleById(java.lang.String id)
default Role getRoleById(long id)
default java.util.List<Role> getRolesByName(java.lang.String name, boolean ignoreCase)
Roles
in this Guild that have the same
name as the one provided.
Roles
with the provided name, then this returns an empty list.name
- The name used to filter the returned Roles
.ignoreCase
- Determines if the comparison ignores case when comparing. True - case insensitive.SnowflakeCacheView<Role> getRoleCache()
SnowflakeCacheView
of
all cached Roles
of this Guild.
SnowflakeCacheView
default Emote getEmoteById(java.lang.String id)
Emote
from this guild that has the same id as the
one provided.
Emote
with an id that matches the provided
one, then this returns null
.
CacheFlag.EMOTE
is disabled.
Unicode emojis are not included as Emote
!
id
- the emote idjava.lang.NumberFormatException
- If the provided id
cannot be parsed by Long.parseLong(String)
default Emote getEmoteById(long id)
Emote
from this guild that has the same id as the
one provided.
Emote
with an id that matches the provided
one, then this returns null
.
CacheFlag.EMOTE
is disabled.
Unicode emojis are not included as Emote
!
id
- the emote iddefault java.util.List<Emote> getEmotes()
Emotes
belonging to this Guild
.
Unicode emojis are not included as Emote
!
Emotes
.default java.util.List<Emote> getEmotesByName(java.lang.String name, boolean ignoreCase)
Emotes
in this Guild that have the same
name as the one provided.
Emotes
with the provided name, then this returns an empty list.
CacheFlag.EMOTE
is disabled.
Unicode emojis are not included as Emote
!
name
- The name used to filter the returned Emotes
.ignoreCase
- Determines if the comparison ignores case when comparing. True - case insensitive.SnowflakeCacheView<Emote> getEmoteCache()
SnowflakeCacheView
of
all cached Emotes
of this Guild.
CacheFlag.EMOTE
is disabled.SnowflakeCacheView
@Nonnull @CheckReturnValue RestAction<java.util.List<ListedEmote>> retrieveEmotes()
Note that ListedEmote.getUser()
is only available if the currently
logged in account has Permission.MANAGE_EMOTES
.
RestAction
- Type: List of ListedEmote
@Nonnull @CheckReturnValue RestAction<ListedEmote> retrieveEmoteById(@Nonnull java.lang.String id)
Note that ListedEmote.getUser()
is only available if the currently
logged in account has Permission.MANAGE_EMOTES
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
UNKNOWN_EMOJI
id
- The emote idRestAction
- Type: ListedEmote
java.lang.IllegalArgumentException
- If the provided id is not a valid snowflake@Nonnull @CheckReturnValue default RestAction<ListedEmote> retrieveEmoteById(long id)
Note that ListedEmote.getUser()
is only available if the currently
logged in account has Permission.MANAGE_EMOTES
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
UNKNOWN_EMOJI
id
- The emote idRestAction
- Type: ListedEmote
@Nonnull @CheckReturnValue default RestAction<ListedEmote> retrieveEmote(@Nonnull Emote emote)
Note that ListedEmote.getUser()
is only available if the currently
logged in account has Permission.MANAGE_EMOTES
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
UNKNOWN_EMOJI
emote
- The emoteRestAction
- Type: ListedEmote
@Nonnull @CheckReturnValue RestAction<java.util.List<Guild.Ban>> getBanList()
Users
.
GuildController.ban(User, int)
or
GuildController.unban(User)
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
RestAction
- Type: List<Ban
>
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.@Nonnull @CheckReturnValue default RestAction<Guild.Ban> getBanById(long userId)
Ban
of the provided ID
GuildController.ban(String, int)
GuildController.ban(id, int)} or
GuildController.unban(String)
GuildController.unban(id)}.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_BAN
userId
- the id of the banned userRestAction
- Type: Ban
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.@Nonnull @CheckReturnValue RestAction<Guild.Ban> getBanById(@Nonnull java.lang.String userId)
Ban
of the provided ID
GuildController.ban(id, int)
or
GuildController.unban(id)
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_BAN
userId
- the id of the banned userRestAction
- Type: Ban
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.@Nonnull @CheckReturnValue default RestAction<Guild.Ban> getBan(@Nonnull User bannedUser)
Ban
of the provided User
GuildController.ban(User, int)
or
GuildController.unban(User)
.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
UNKNOWN_BAN
bannedUser
- the banned userRestAction
- Type: Ban
InsufficientPermissionException
- If the logged in account does not have the Permission.BAN_MEMBERS
permission.@CheckReturnValue RestAction<java.lang.Integer> getPrunableMemberCount(int days)
GuildController.prune(int)
was executed.
Prunability is determined by a Member being offline for at least days days.
Possible ErrorResponses
caused by
the returned RestAction
include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
days
- Minimum number of days since a member has been offline to get affected.RestAction
- Type: Integer
InsufficientPermissionException
- If the account doesn't have KICK_MEMBER
Permission.java.lang.IllegalArgumentException
- If the provided days are less than 1
Role getPublicRole()
Role
of this Guild
.
position
is calculated as
-1
. All other role positions are 0 or greater. This implies that the public role is always below
any custom roles created in this Guild. Additionally, all members of this guild are implied to have this role so
it is not included in the list returned by Member.getRoles()
.
getRoleById(getIdLong())
.Role
@Nullable TextChannel getDefaultChannel()
TextChannel
for a Guild
.
TextChannel
.
Note: This channel is the first channel in the guild (ordered by position) that the getPublicRole()
has the Permission.MESSAGE_READ
in.
TextChannel
representing the default channel for this guildGuildManager getManager()
GuildManager
for this Guild, used to modify
all properties and settings of the Guild.
RestAction.queue()
.InsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_SERVER
GuildController getController()
GuildController
for this Guild. The controller
is used to perform all admin style functions in the Guild. A few include: kicking, banning, changing member roles,
changing role and channel positions, and more. Checkout the GuildController
class for more info.@CheckReturnValue MentionPaginationAction getRecentMentions()
The returned MentionPaginationAction
allows to filter by whether the messages mention everyone or a role.
MentionPaginationAction
AccountTypeException
- If the currently logged in account is not from AccountType.CLIENT
JDA.asClient()
,
JDAClient.getRecentMentions(Guild)
@CheckReturnValue AuditLogPaginationAction getAuditLogs()
PaginationAction
implementation
that allows to iterate
over all AuditLogEntries
of
this Guild.
public boolean isLogged(Guild guild, ActionType type, long targetId)
{
for (AuditLogEntry entry : guild.getAuditLogs().cache(false))
{
if (entry.getType() == type&& entry.getTargetIdLong() == targetId)
return true; // The action is logged
}
return false; // nothing found in audit logs
}
publicList<AuditLogEntry> getActionsBy(Guild guild, User user)
{
return guild.getAuditLogs().cache(false).stream()
.filter(it-> it.getUser().equals(user))
.collect(Collectors.toList()); // collects actions done by user
}
AuditLogPaginationAction
InsufficientPermissionException
- If the currently logged in account
does not have the permission VIEW_AUDIT_LOGS
@CheckReturnValue RestAction<java.lang.Void> leave()
getOwner()
)
then ownership of the Guild needs to be transferred to a different Member
before leaving using GuildController.transferOwnership(Member)
.RestAction
- Type: Void
java.lang.IllegalStateException
- Thrown if the currently logged in account is the Owner of this Guild.@CheckReturnValue RestAction<java.lang.Void> delete()
delete(String)
instead to provide the MFA code.RestAction
- Type: Void
PermissionException
- Thrown if the currently logged in account is not the owner of this Guild.java.lang.IllegalStateException
- If the currently logged in account has MFA enabled. (SelfUser.isMfaEnabled()
).@CheckReturnValue RestAction<java.lang.Void> delete(java.lang.String mfaCode)
SelfUser.isMfaEnabled()
.
If MFA is not enabled, use delete()
.mfaCode
- The Multifactor Authentication code generated by an app like
Google Authenticator.
RestAction
- Type: Void
PermissionException
- Thrown if the currently logged in account is not the owner of this Guild.java.lang.IllegalArgumentException
- If the provided mfaCode
is null
or empty when SelfUser.isMfaEnabled()
is true.AudioManager getAudioManager()
AudioManager
that represents the
audio connection for this Guild.
JDA.getAudioManagerCache()
@CheckReturnValue RestAction<java.util.List<Invite>> getInvites()
Invites
for this guild.
MANAGE_SERVER
in this guild.
Will throw a InsufficientPermissionException
otherwise.
To get all invites for a Channel
use Channel.getInvites()
RestAction
- Type: List<Invite
>
InsufficientPermissionException
- if the account does not have MANAGE_SERVER
in this Guild.Channel.getInvites()
@CheckReturnValue RestAction<java.util.List<Webhook>> getWebhooks()
Webhooks
for this Guild.
MANAGE_WEBHOOKS
in this Guild.
To get all webhooks for a specific TextChannel
, use
TextChannel.getWebhooks()
RestAction
- Type: List<Webhook
>
InsufficientPermissionException
- if the account does not have MANAGE_WEBHOOKS
in this Guild.TextChannel.getWebhooks()
java.util.List<GuildVoiceState> getVoiceStates()
GuildVoiceState
of every Member
in this Guild
.
Members
in this Guild
, which is
impossible.GuildVoiceStates
on this Guild
.Guild.VerificationLevel getVerificationLevel()
Guild.VerificationLevel
.
This value can be modified using GuildManager.setVerificationLevel(net.dv8tion.jda.core.entities.Guild.VerificationLevel)
.
Guild.NotificationLevel getDefaultNotificationLevel()
NotificationLevel
.
This value can be modified using GuildManager.setDefaultNotificationLevel(net.dv8tion.jda.core.entities.Guild.NotificationLevel)
.
Guild.MFALevel getRequiredMFALevel()
MFALevel
.
This value can be modified using GuildManager.setRequiredMFALevel(net.dv8tion.jda.core.entities.Guild.MFALevel)
.
Guild.ExplicitContentLevel getExplicitContentLevel()
ExplicitContentLevel
for this Guildboolean checkVerification()
VerificationLevel Enum with a list of possible verification-levels and their requirements
boolean isAvailable()