public interface Guild extends ISnowflake
Guild
.
This should contain all information provided from Discord about a Guild.Modifier and Type | Interface and Description |
---|---|
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 and Description |
---|---|
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()
Returns the
AudioManager that represents the
audio connection for this Guild. |
GuildController |
getController()
Returns the
GuildController for this Guild. |
Guild.NotificationLevel |
getDefaultNotificationLevel()
Returns the default message Notification-Level of this Guild.
|
Emote |
getEmoteById(java.lang.String id)
Gets an
Emote from this guild that has the same id as the
one provided. |
java.util.List<Emote> |
getEmotes()
|
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. |
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. |
GuildManagerUpdatable |
getManagerUpdatable()
Returns the
Updatable GuildManager for this Guild, used to modify
all properties and settings of the Guild. |
Member |
getMember(User user)
|
Member |
getMemberById(java.lang.String userId)
Gets a
Member object via the id of the user. |
java.util.List<Member> |
getMembers()
A list of all
Members in this Guild. |
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. |
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. |
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. |
java.util.List<Member> |
getMembersWithRoles(java.util.Collection<Role> roles)
|
java.util.List<Member> |
getMembersWithRoles(Role... roles)
|
java.lang.String |
getName()
The human readable name of the
Guild . |
Member |
getOwner()
|
TextChannel |
getPublicChannel()
The default
TextChannel for a Guild . |
Role |
getPublicRole()
|
Region |
getRegion()
|
Guild.MFALevel |
getRequiredMFALevel()
Returns the level of multifactor authentication required to execute administrator restricted functions in this guild.
|
Role |
getRoleById(java.lang.String id)
Gets a
Role from this guild that has the same id as the
one provided. |
java.util.List<Role> |
getRoles()
|
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 |
getTextChannelById(java.lang.String id)
Gets a
TextChannel from this guild that has the same id as the
one provided. |
java.util.List<TextChannel> |
getTextChannels()
Gets all
TextChannels in this Guild . |
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. |
Guild.VerificationLevel |
getVerificationLevel()
Returns the verification-Level of this Guild.
|
VoiceChannel |
getVoiceChannelById(java.lang.String id)
Gets a
VoiceChannel from this guild that has the same id as the
one provided. |
java.util.List<VoiceChannel> |
getVoiceChannels()
Gets all
VoiceChannels in this Guild . |
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.
|
getCreationTime, getId
java.lang.String getName()
Guild
.
This value can be modified using GuildManager.setName(String)
or GuildManagerUpdatable.getNameField()
.
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)
or GuildManagerUpdatable.getIconField()
.
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)
or GuildManagerUpdatable.getIconField()
.
java.lang.String getSplashId()
null
.
The Guild splash can be modified using GuildManager.setSplash(Icon)
or GuildManagerUpdatable.getSplashField()
.
java.lang.String getSplashUrl()
null
.
The Guild splash can be modified using GuildManager.setSplash(Icon)
or GuildManagerUpdatable.getSplashField()
.
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)
or GuildManagerUpdatable.getAfkChannelField()
.
VoiceChannel
that is the AFK Channel.Member getOwner()
Member
object of the owner of this Guild
.
Ownership can be transferred using GuildController.transferOwnership(Member)
.
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)
or GuildManagerUpdatable.getAfkTimeoutField()
.
Timeout
set for this Guild.Region getRegion()
Region
that this Guild
is
using for audio connections.
Region
is not recognized, returns UNKNOWN
.
This value can be modified using GuildManager.setRegion(net.dv8tion.jda.core.Region)
or GuildManagerUpdatable.getRegionField()
.
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)
.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.util.List<Member> getMembers()
Members
in this Guild.
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.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.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.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.util.List<TextChannel> getTextChannels()
TextChannels
in this Guild
.
TextChannels
in this Guild.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.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.util.List<VoiceChannel> getVoiceChannels()
VoiceChannels
in this Guild
.
VoiceChannels
.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.Role getRoleById(java.lang.String id)
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.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
.id
- the emote idjava.util.List<Emote> getEmotes()
Emotes
belonging to this Guild
.
Emotes
.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.name
- The name used to filter the returned Emotes
.ignoreCase
- Determines if the comparison ignores case when comparing. True - case insensitive.Role getPublicRole()
Role
of this Guild
.
Role.getPosition()
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()
.Role
TextChannel getPublicChannel()
TextChannel
for a Guild
.
Public Role
always has the ability to
Permission.MESSAGE_READ
this channel.TextChannel
representing the public channel for this guild.GuildManager getManager()
GuildManager
for this Guild, used to modify
all properties and settings of the Guild.
getManagerUpdatable()
.GuildUnavailableException
- if the guild is temporarily unavailable (isAvailable()
)GuildManagerUpdatable getManagerUpdatable()
Updatable GuildManager
for this Guild, used to modify
all properties and settings of the Guild.
GuildUnavailableException
- if the guild is temporarily unavailable (isAvailable()
)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.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.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()
).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.RestAction<java.util.List<Invite>> getInvites()
Invites
for this guild.
MANAGE_SERVER
in this guild.
Will throw a PermissionException
otherwise.
To get all invites for a Channel
use Channel.getInvites()
RestAction
- Type: List<Invite
>
PermissionException
- if the account does not have MANAGE_SERVER
in this Guild.Channel.getInvites()
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
>
PermissionException
- 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)
or GuildManagerUpdatable.getVerificationLevelField()
Guild.NotificationLevel getDefaultNotificationLevel()
NotificationLevel
.
This value can be modified using GuildManager.setDefaultNotificationLevel(net.dv8tion.jda.core.entities.Guild.NotificationLevel)
or GuildManagerUpdatable.getDefaultNotificationLevelField()
Guild.MFALevel getRequiredMFALevel()
MFALevel
.
This value can be modified using GuildManager.setRequiredMFALevel(net.dv8tion.jda.core.entities.Guild.MFALevel)
or GuildManagerUpdatable.getRequiredMFALevelField()
boolean checkVerification()
VerificationLevel Enum with a list of possible verification-levels and their requirements
boolean isAvailable()