public final class Guild extends Object implements Entity
Modifier and Type | Class and Description |
---|---|
static class |
Guild.ContentFilterLevel
Automatically scan and delete messages sent in the server that contain explicit content.
|
static class |
Guild.MfaLevel
Prevent potentially dangerous administrative actions for users without two-factor authentication enabled.
|
static class |
Guild.NotificationLevel
Determines whether
Members who have not explicitly set their notification settings receive a
notification for every message sent in the server or not. |
static class |
Guild.VerificationLevel
Members of the server must meet the following criteria before they can send messages in text
channels or initiate a direct message conversation. |
Constructor and Description |
---|
Guild(ServiceMediator serviceMediator,
BaseGuildBean data)
Constructs an
Guild with an associated ServiceMediator and Discord data. |
Modifier and Type | Method and Description |
---|---|
Mono<Void> |
ban(Snowflake userId,
Consumer<? super BanQuerySpec> spec)
Requests to ban the specified user.
|
Mono<String> |
changeSelfNickname(String nickname)
Requests to change the bot user's nickname in this guild.
|
Mono<Category> |
createCategory(Consumer<? super CategoryCreateSpec> spec)
Requests to create a category.
|
Mono<GuildEmoji> |
createEmoji(Consumer<? super GuildEmojiCreateSpec> spec)
Requests to create an emoji.
|
Mono<NewsChannel> |
createNewsChannel(Consumer<? super NewsChannelCreateSpec> spec)
Requests to create a news channel.
|
Mono<Role> |
createRole(Consumer<? super RoleCreateSpec> spec)
Requests to create a role.
|
Mono<StoreChannel> |
createStoreChannel(Consumer<? super StoreChannelCreateSpec> spec)
Requests to create a store channel.
|
Mono<TextChannel> |
createTextChannel(Consumer<? super TextChannelCreateSpec> spec)
Requests to create a text channel.
|
Mono<VoiceChannel> |
createVoiceChannel(Consumer<? super VoiceChannelCreateSpec> spec)
Requests to create a voice channel.
|
Mono<Void> |
delete()
Requests to delete this guild.
|
Mono<Guild> |
edit(Consumer<? super GuildEditSpec> spec)
Requests to edit this guild.
|
boolean |
equals(Object obj) |
Mono<VoiceChannel> |
getAfkChannel()
Requests to retrieve the AFK channel, if present.
|
Optional<Snowflake> |
getAfkChannelId()
Gets the ID of the AFK channel, if present.
|
int |
getAfkTimeout()
Gets the AFK timeout in seconds.
|
Optional<Snowflake> |
getApplicationId()
Gets the application ID of the guild creator if it is bot-created.
|
Flux<AuditLogEntry> |
getAuditLog()
Requests to retrieve the audit log for this guild.
|
Flux<AuditLogEntry> |
getAuditLog(Consumer<? super AuditLogQuerySpec> spec)
Requests to retrieve the audit log for this guild.
|
Mono<Ban> |
getBan(Snowflake userId)
Requests to retrieve the ban for the specified user for this guild.
|
Flux<Ban> |
getBans()
Requests to retrieve all the bans for this guild.
|
Mono<GuildChannel> |
getChannelById(Snowflake id)
Requests to retrieve the channel as represented by the supplied ID.
|
Flux<GuildChannel> |
getChannels()
Requests to retrieve the channels of the guild.
|
DiscordClient |
getClient()
Gets the DiscordClient associated to this object.
|
Guild.ContentFilterLevel |
getContentFilterLevel()
Gets the default explicit content filter level.
|
Mono<GuildChannel> |
getEmbedChannel()
Requests to retrieve the embedded channel, if present.
|
Optional<Snowflake> |
getEmbedChannelId()
Gets the ID of the embedded channel, if present.
|
Set<Snowflake> |
getEmojiIds()
Gets the guild's emoji's IDs.
|
Flux<GuildEmoji> |
getEmojis()
Requests to retrieve the guild's emojis.
|
Mono<Role> |
getEveryoneRole()
Requests to retrieve the guild's @everyone
Role . |
Set<String> |
getFeatures()
Gets the enabled guild features.
|
Mono<GuildEmoji> |
getGuildEmojiById(Snowflake id)
Requests to retrieve the guild emoji as represented by the supplied ID.
|
Optional<String> |
getIconUrl(Image.Format format)
Gets the icon URL of the guild, if present and in a supported format.
|
Snowflake |
getId()
Gets the Snowflake that uniquely identifies this entity.
|
Flux<ExtendedInvite> |
getInvites()
Requests to retrieve the invites of the guild.
|
Optional<Instant> |
getJoinTime()
Gets when this guild was joined at, if present.
|
Mono<Member> |
getMemberById(Snowflake id)
Requests to retrieve the member as represented by the supplied ID.
|
OptionalInt |
getMemberCount()
Gets the total number of members in the guild, if present.
|
Flux<Member> |
getMembers()
Requests to retrieve the members of the guild.
|
Guild.MfaLevel |
getMfaLevel()
Gets the required MFA level for the guild.
|
String |
getName()
Gets the guild name.
|
Guild.NotificationLevel |
getNotificationLevel()
Gets the default message notification level.
|
Mono<Member> |
getOwner()
Requests to retrieve the owner of the guild.
|
Snowflake |
getOwnerId()
Gets the ID of the owner of the guild.
|
Flux<Presence> |
getPresences()
Requests to retrieve the presences of the guild.
|
Mono<Integer> |
getPruneCount(int days)
Requests to retrieve the number of users that will be pruned.
|
Mono<Region> |
getRegion()
Requests to retrieve the voice region for the guild.
|
String |
getRegionId()
Gets the voice region ID for the guild.
|
Flux<Region> |
getRegions()
Requests to retrieve the voice regions for the guild.
|
Mono<Role> |
getRoleById(Snowflake id)
Requests to retrieve the role as represented by the supplied ID.
|
Set<Snowflake> |
getRoleIds()
Gets the guild's roles' IDs.
|
Flux<Role> |
getRoles()
Requests to retrieve the guild's roles.
|
Optional<String> |
getSplashUrl(Image.Format format)
Gets the splash URL of the guild, if present and in a supported format.
|
Mono<TextChannel> |
getSystemChannel()
Requests to retrieve the channel to which system messages are sent, if present.
|
Optional<Snowflake> |
getSystemChannelId()
Gets the ID of the channel to which system messages are sent, if present.
|
Guild.VerificationLevel |
getVerificationLevel()
Gets the level of verification required for the guild.
|
Flux<VoiceState> |
getVoiceStates()
Requests to retrieve the voice states of the guild.
|
Flux<Webhook> |
getWebhooks()
Requests to retrieve the webhooks of the guild.
|
Mono<GuildChannel> |
getWidgetChannel()
Requests to retrieve the channel for the server widget, if present.
|
Optional<Snowflake> |
getWidgetChannelId()
Gets the channel ID for the server widget, if present.
|
int |
hashCode() |
Optional<Boolean> |
isLarge()
Gets whether this guild is considered large, if present.
|
Mono<Void> |
kick(Snowflake userId)
Requests to kick the specified user from this guild.
|
Mono<Void> |
kick(Snowflake userId,
String reason)
Requests to kick the specified user from this guild while optionally specifying a reason.
|
Mono<Void> |
leave()
Requests to leave this guild.
|
Mono<Integer> |
prune(int days)
Requests to prune users.
|
Mono<Integer> |
prune(int days,
String reason)
Requests to prune users while optionally specifying a reason.
|
String |
toString() |
Mono<Void> |
unban(Snowflake userId)
Requests to unban the specified user.
|
Mono<Void> |
unban(Snowflake userId,
String reason)
Requests to unban the specified user while optionally specifying a reason.
|
public Guild(ServiceMediator serviceMediator, BaseGuildBean data)
Guild
with an associated ServiceMediator and Discord data.serviceMediator
- The ServiceMediator associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.public DiscordClient getClient()
DiscordObject
getClient
in interface DiscordObject
public Snowflake getId()
Entity
public String getName()
public Optional<String> getIconUrl(Image.Format format)
format
- The format for the URL. Supported format types are PNG
,
JPEG
, and WebP
.public Optional<String> getSplashUrl(Image.Format format)
format
- The format for the URL. Supported format types are PNG
,
JPEG
, and WebP
.public Snowflake getOwnerId()
public String getRegionId()
public Flux<Region> getRegions()
Flux
that continually emits the guild's voice regions
. If an error is received,
it is emitted through the Flux
.public Optional<Snowflake> getAfkChannelId()
public Mono<VoiceChannel> getAfkChannel()
public int getAfkTimeout()
public Optional<Snowflake> getEmbedChannelId()
public Mono<GuildChannel> getEmbedChannel()
public Guild.VerificationLevel getVerificationLevel()
public Guild.NotificationLevel getNotificationLevel()
public Guild.ContentFilterLevel getContentFilterLevel()
public Set<Snowflake> getRoleIds()
public Flux<Role> getRoles()
The returned Flux
will emit items in order based off their natural position, which is indicated
visually in the Discord client. For roles, the "lowest" role will be emitted first.
public Mono<Role> getRoleById(Snowflake id)
public Mono<Role> getEveryoneRole()
Role
.public Set<Snowflake> getEmojiIds()
public Flux<GuildEmoji> getEmojis()
public Mono<GuildEmoji> getGuildEmojiById(Snowflake id)
id
- The ID of the guild emoji.Mono
where, upon successful completion, emits the GuildEmoji
as represented by the
supplied ID. If an error is received, it is emitted through the Mono
.public Set<String> getFeatures()
public Guild.MfaLevel getMfaLevel()
public Optional<Snowflake> getApplicationId()
public Optional<Snowflake> getWidgetChannelId()
public Mono<GuildChannel> getWidgetChannel()
public Optional<Snowflake> getSystemChannelId()
public Mono<TextChannel> getSystemChannel()
public OptionalInt getMemberCount()
public Flux<VoiceState> getVoiceStates()
Flux
that continually emits the voice states
of the guild. If an error is
received, it is emitted through the Flux
.store
does not save
VoiceStateBean
instances OR the bot is currently not logged in then the returned Flux
will
always be empty.public Mono<Member> getMemberById(Snowflake id)
public Flux<GuildChannel> getChannels()
The returned Flux
will emit items in order based off their natural position, which is indicated
visually in the Discord client. For channels, the "highest" channel will be emitted first.
public Mono<GuildChannel> getChannelById(Snowflake id)
id
- The ID of the channel.Mono
where, upon successful completion, emits the GuildChannel
as represented by the
supplied ID. If an error is received, it is emitted through the Mono
.public Flux<Presence> getPresences()
Flux
that continually emits the presences
of the guild. If an error is
received, it is emitted through the Flux
.store
does not save
PresenceBean
instances OR the bot is currently not logged in then the returned Flux
will
always be empty.public Mono<Guild> edit(Consumer<? super GuildEditSpec> spec)
spec
- A Consumer
that provides a "blank" GuildEditSpec
to be operated on.Mono
where, upon successful completion, emits the edited Guild
. If an error is
received, it is emitted through the Mono
.public Mono<GuildEmoji> createEmoji(Consumer<? super GuildEmojiCreateSpec> spec)
spec
- A Consumer
that provides a "blank" GuildEmojiCreateSpec
to be operated on.Mono
where, upon successful completion, emits the created GuildEmoji
. If an error is
received, it is emitted through the Mono
.public Mono<Role> createRole(Consumer<? super RoleCreateSpec> spec)
spec
- A Consumer
that provides a "blank" RoleCreateSpec
to be operated on.Mono
where, upon successful completion, emits the created Role
. If an error is
received, it is emitted through the Mono
.public Mono<NewsChannel> createNewsChannel(Consumer<? super NewsChannelCreateSpec> spec)
spec
- A Consumer
that provides a "blank" NewsChannelCreateSpec
to be operated on.Mono
where, upon successful completion, emits the created NewsChannel
. If an error is
received, it is emitted through the Mono
.public Mono<StoreChannel> createStoreChannel(Consumer<? super StoreChannelCreateSpec> spec)
spec
- A Consumer
that provides a "blank" StoreChannelCreateSpec
to be operated on.Mono
where, upon successful completion, emits the created StoreChannel
. If an error is
received, it is emitted through the Mono
.public Mono<Category> createCategory(Consumer<? super CategoryCreateSpec> spec)
spec
- A Consumer
that provides a "blank" CategoryCreateSpec
to be operated on.Mono
where, upon successful completion, emits the created Category
. If an error is
received, it is emitted through the Mono
.public Mono<TextChannel> createTextChannel(Consumer<? super TextChannelCreateSpec> spec)
spec
- A Consumer
that provides a "blank" TextChannelCreateSpec
to be operated on.Mono
where, upon successful completion, emits the created TextChannel
. If an error is
received, it is emitted through the Mono
.public Mono<VoiceChannel> createVoiceChannel(Consumer<? super VoiceChannelCreateSpec> spec)
spec
- A Consumer
that provides a "blank" VoiceChannelCreateSpec
to be operated on.Mono
where, upon successful completion, emits the created VoiceChannel
. If an error is
received, it is emitted through the Mono
.public Mono<Void> delete()
Mono
where, upon successful completion, emits nothing; indicating the guild has been deleted.
If an error is received, it is emitted through the Mono
.public Mono<Void> kick(Snowflake userId)
userId
- The ID of the user to kick from this guild.Mono
where, upon successful completion, emits nothing; indicating the specified user was kicked
from this guild. If an error is received, it is emitted through the Mono
.public Mono<Void> kick(Snowflake userId, @Nullable String reason)
userId
- The ID of the user to kick from this guild.reason
- The reason, if present.Mono
where, upon successful completion, emits nothing; indicating the specified user was kicked
from this guild. If an error is received, it is emitted through the Mono
.public Mono<Ban> getBan(Snowflake userId)
public Mono<Void> ban(Snowflake userId, Consumer<? super BanQuerySpec> spec)
userId
- The ID of the user to ban.spec
- A Consumer
that provides a "blank" BanQuerySpec
to be operated on.Mono
where, upon successful completion, emits nothing; indicating the specified user was
banned. If an error is received, it is emitted through the Mono
.public Mono<Void> unban(Snowflake userId)
userId
- The ID of the user to unban.Mono
where, upon successful completion, emits nothing; indicating the specified user was
unbanned. If an error is received, it is emitted through the Mono
.public Mono<Void> unban(Snowflake userId, @Nullable String reason)
userId
- The ID of the user to unban.reason
- The reason, if present.Mono
where, upon successful completion, emits nothing; indicating the specified user was
unbanned. If an error is received, it is emitted through the Mono
.public Mono<Integer> getPruneCount(int days)
days
- The number of days since an user must have been seen to avoid being kicked.Mono
where, upon successful completion, emits the number of users that will be pruned. If an
error is received, it is emitted through the Mono
.public Mono<Integer> prune(int days)
days
- The number of days since an user must have been seen to avoid being kicked.Mono
where, upon successful completion, emits the number of users who were pruned. If an error
is received, it is emitted through the Mono
.public Mono<Integer> prune(int days, @Nullable String reason)
days
- The number of days since an user must have been seen to avoid being kicked.reason
- The reason, if present.Mono
where, upon successful completion, emits the number of users who were pruned. If an error
is received, it is emitted through the Mono
.public Mono<Void> leave()
Mono
where, upon successful completion, emits nothing; indicating this guild has been left. If
an error is received, it is emitted through the Mono
.public Flux<AuditLogEntry> getAuditLog()
Flux
that continually emits entries for this guild's audit log. If an error is received, it is
emitted through the Flux
.public Flux<AuditLogEntry> getAuditLog(Consumer<? super AuditLogQuerySpec> spec)
spec
- A Consumer
that provides a "blank" AuditLogQuerySpec
to be operated on.Flux
that continually emits entries for this guild's audit log. If an error is received, it is
emitted through the Flux
.public Flux<ExtendedInvite> getInvites()
public Mono<String> changeSelfNickname(@Nullable String nickname)
nickname
- The new nickname for the bot user in this guild, or null
to remove it.Mono
where, upon successful completion, emits the bot user's new nickname in this guild. If
the nickname was set to null
, then this Mono
will complete empty. If an error is received, it
is emitted through the Mono
.