Package discord4j.rest.entity
Class RestGuild
java.lang.Object
discord4j.rest.entity.RestGuild
Represents a guild entity in Discord. Guilds in Discord represent an isolated collection of users and channels,
and are often referred to as "servers" in the UI.
-
Method Summary
Modifier and TypeMethodDescriptionMono<discord4j.discordjson.json.MemberData>
addMemberRole
(Snowflake userId, Snowflake roleId, String reason) Mono<discord4j.discordjson.json.PruneData>
beginGuildPrune
(Integer days, Boolean computePruneCount, String reason) static RestGuild
create
(RestClient restClient, Snowflake id) Create aRestGuild
for a given ID.Mono<discord4j.discordjson.json.ChannelData>
createChannel
(discord4j.discordjson.json.ChannelCreateRequest request, String reason) Create a new channel object for the guild.Mono<discord4j.discordjson.json.EmojiData>
createEmoji
(discord4j.discordjson.json.GuildEmojiCreateRequest request, String reason) createIntegration
(discord4j.discordjson.json.IntegrationCreateRequest request) Mono<discord4j.discordjson.json.RoleData>
createRole
(discord4j.discordjson.json.RoleCreateRequest request, String reason) Mono<discord4j.discordjson.json.GuildScheduledEventData>
createScheduledEvent
(discord4j.discordjson.json.GuildScheduledEventCreateRequest request) Create a new scheduled event for the guild.delete()
Delete a guild permanently.deleteIntegration
(Snowflake integrationId) deleteRole
(Snowflake roleId, String reason) deleteScheduledEvent
(Snowflake eventId, String reason) Requests to delete a scheduled event.Return aRestEmoji
representation under this guild.boolean
Mono<discord4j.discordjson.json.ListThreadsData>
Mono<discord4j.discordjson.json.BanData>
Flux<discord4j.discordjson.json.BanData>
getBans()
Flux<discord4j.discordjson.json.ChannelData>
Return aFlux
of guild channels.Mono<discord4j.discordjson.json.GuildUpdateData>
getData()
Retrieve this guild's data upon subscription.Mono<discord4j.discordjson.json.GuildUpdateData>
Retrieve this guild's data upon subscription.Flux<discord4j.discordjson.json.EmojiData>
getId()
Returns the ID of this guild.Flux<discord4j.discordjson.json.IntegrationData>
Flux<discord4j.discordjson.json.InviteData>
Mono<discord4j.discordjson.json.MemberData>
Flux<discord4j.discordjson.json.MemberData>
Mono<discord4j.discordjson.json.GuildPreviewData>
Mono<discord4j.discordjson.json.PruneData>
getPruneCount
(Integer days) Flux<discord4j.discordjson.json.RegionData>
Flux<discord4j.discordjson.json.RoleData>
getRoles()
Mono<discord4j.discordjson.json.GuildScheduledEventData>
getScheduledEvent
(Snowflake eventId, Boolean withUserCount) Requests to retrieve the scheduled event under this guild.Flux<discord4j.discordjson.json.GuildScheduledEventData>
getScheduledEvents
(Boolean withUserCount) Requests to retrieve the scheduled events under this guild.Mono<discord4j.discordjson.json.MemberData>
Flux<discord4j.discordjson.json.TemplateData>
Flux<discord4j.discordjson.json.WebhookData>
Mono<discord4j.discordjson.json.GuildWidgetData>
int
hashCode()
Return aRestMember
representation under this guild.Mono<discord4j.discordjson.json.GuildUpdateData>
Modify a guild's settings.Flux<discord4j.discordjson.json.RoleData>
modifyChannelPositions
(List<discord4j.discordjson.json.PositionModifyRequest> requests) Mono<discord4j.discordjson.json.MemberData>
modifyCurrentMember
(discord4j.discordjson.json.CurrentMemberModifyData request) modifyIntegration
(Snowflake integrationId, discord4j.discordjson.json.IntegrationModifyRequest request) Mono<discord4j.discordjson.json.MemberData>
modifyMember
(Snowflake userId, discord4j.discordjson.json.GuildMemberModifyRequest request, String reason) Mono<discord4j.discordjson.json.RoleData>
modifyRole
(Snowflake roleId, discord4j.discordjson.json.RoleModifyRequest request, String reason) Flux<discord4j.discordjson.json.RoleData>
modifyRolePositions
(List<discord4j.discordjson.json.PositionModifyRequest> requests) Mono<discord4j.discordjson.json.GuildScheduledEventData>
modifyScheduledEvent
(Snowflake eventId, discord4j.discordjson.json.GuildScheduledEventModifyRequest request, String reason) Requests to modify a scheduled event.Mono<discord4j.discordjson.json.GuildWidgetData>
modifyWidget
(discord4j.discordjson.json.GuildWidgetModifyRequest request) removeGuildBan
(Snowflake userId, String reason) removeGuildMember
(Snowflake userId, String reason) removeMemberRole
(Snowflake userId, Snowflake roleId, String reason) Return aRestRole
representation under this guild.scheduledEvent
(Snowflake eventId) Returns aRestScheduledEvent
representation under this guild.Flux<discord4j.discordjson.json.MemberData>
searchMembers
(Map<String, Object> queryParams) syncIntegration
(Snowflake integrationId)
-
Method Details
-
create
Create aRestGuild
for a given ID. This method does not perform any API request.- Parameters:
restClient
- the client to make API requestsid
- the ID of this entity- Returns:
- a
RestGuild
represented by thisid
.
-
getId
Returns the ID of this guild.- Returns:
- The ID of this guild
-
getData
Retrieve this guild's data upon subscription.- Parameters:
withCounts
- when true, will return approximate member and presence counts for the guild too. otherwise approximate member and presence counts will be null inGuildUpdateData
.- Returns:
- a
Mono
where, upon successful completion, emits theGuildUpdateData
belonging to this entity. If an error is received, it is emitted through theMono
.
-
getData
Retrieve this guild's data upon subscription.- Returns:
- a
Mono
where, upon successful completion, emits theGuildUpdateData
belonging to this entity. If an error is received, it is emitted through theMono
.
-
emoji
Return aRestEmoji
representation under this guild. This method does not perform any API request.- Parameters:
emojiId
- the entity ID- Returns:
- a
RestEmoji
with the given ID, under this guild
-
member
Return aRestMember
representation under this guild. This method does not perform any API request.- Parameters:
memberId
- the entity ID- Returns:
- a
RestMember
with the given ID, under this guild
-
role
Return aRestRole
representation under this guild. This method does not perform any API request.- Parameters:
roleId
- the entity ID- Returns:
- a
RestRole
with the given ID, under this guild
-
scheduledEvent
Returns aRestScheduledEvent
representation under this guild. This method does not perform any API request.- Parameters:
eventId
- The entity ID- Returns:
- a
RestGuildScheduledEvent
with the given ID, under this guild
-
modify
public Mono<discord4j.discordjson.json.GuildUpdateData> modify(discord4j.discordjson.json.GuildModifyRequest request, @Nullable String reason) Modify a guild's settings. Requires thePermission.MANAGE_GUILD
permission. Returns the updated guild object on success.- Parameters:
request
- the modify request bodyreason
- an optional reason for the audit log- Returns:
- a
Mono
where, upon subscription, emits the updatedGuildUpdateData
on success. If an error is received, it is emitted through theMono
.
-
delete
Delete a guild permanently. Requires thePermission.MANAGE_GUILD
permission. Returns empty on success.- Returns:
- a
Mono
where, upon subscription, emits a complete signal on success. If an error is received, it is emitted through theMono
.
-
getChannels
Return aFlux
of guild channels.- Returns:
- a sequence of this guild channels
-
createChannel
public Mono<discord4j.discordjson.json.ChannelData> createChannel(discord4j.discordjson.json.ChannelCreateRequest request, @Nullable String reason) Create a new channel object for the guild. Requires thePermission.MANAGE_CHANNELS
permission. Returns the new channel object on success.- Parameters:
request
- the request bodyreason
- an optional reason for the audit log- Returns:
- a
Mono
where, upon subscription, emits the createdChannelData
on success. If an error is received, it is emitted through theMono
.
-
modifyChannelPositions
-
getMember
-
getSelfMember
-
getMembers
-
searchMembers
-
addMember
-
modifyMember
-
modifyCurrentMember
public Mono<discord4j.discordjson.json.MemberData> modifyCurrentMember(discord4j.discordjson.json.CurrentMemberModifyData request) -
addMemberRole
-
removeMemberRole
-
removeGuildMember
-
getBans
-
getBan
-
createBan
-
removeGuildBan
-
getRoles
-
createRole
-
modifyRolePositions
-
modifyRole
-
deleteRole
-
getPruneCount
-
beginGuildPrune
-
getRegions
-
getInvites
-
getIntegrations
-
createIntegration
-
modifyIntegration
-
deleteIntegration
-
syncIntegration
-
getWidget
-
modifyWidget
public Mono<discord4j.discordjson.json.GuildWidgetData> modifyWidget(discord4j.discordjson.json.GuildWidgetModifyRequest request) -
getEmojis
-
createEmoji
-
getWebhooks
-
getPreview
-
getTemplates
-
getActiveThreads
-
getScheduledEvent
public Mono<discord4j.discordjson.json.GuildScheduledEventData> getScheduledEvent(Snowflake eventId, @Nullable Boolean withUserCount) Requests to retrieve the scheduled event under this guild.- Parameters:
eventId
- The ID of the eventwithUserCount
- Whether to optionally include the number of subscribed users- Returns:
- A
Mono
where, upon successful completion, emits theGuildScheduledEventData
. If an error is received, it is emitted through theMono
.
-
getScheduledEvents
public Flux<discord4j.discordjson.json.GuildScheduledEventData> getScheduledEvents(@Nullable Boolean withUserCount) Requests to retrieve the scheduled events under this guild.- Parameters:
withUserCount
- Whether to optionally include the number of subscribed users for each event- Returns:
- A
Flux
that continually emits all theGuildScheduledEventData
associated with this guild. If an error is received, it is emitted through theFlux
.
-
createScheduledEvent
public Mono<discord4j.discordjson.json.GuildScheduledEventData> createScheduledEvent(discord4j.discordjson.json.GuildScheduledEventCreateRequest request) Create a new scheduled event for the guild. Requires thePermission.MANAGE_EVENTS
permission. Returns the new event object on success.- Parameters:
request
- the request body- Returns:
- A
Mono
where, upon subscription, emits the createdGuildScheduledEventData
on success. If an error is received, it is emitted through theMono
.
-
modifyScheduledEvent
public Mono<discord4j.discordjson.json.GuildScheduledEventData> modifyScheduledEvent(Snowflake eventId, discord4j.discordjson.json.GuildScheduledEventModifyRequest request, @Nullable String reason) Requests to modify a scheduled event. Requires thePermission.MANAGE_EVENTS
permission. Returns the modified event object on success.- Parameters:
eventId
- The ID of the eventrequest
- the request bodyreason
- an optional reason for the audit log- Returns:
- A
Mono
where, upon subscription, emits the modifiedGuildScheduledEventData
on success. If an error is received, it is emitted through theMono
.
-
deleteScheduledEvent
Requests to delete a scheduled event. Requires thePermission.MANAGE_EVENTS
permission.- Parameters:
eventId
- The ID of the eventreason
- an optional reason for the audit log- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the event has been deleted. If an error is received, it is emitted through theMono
.
-
equals
-
hashCode
public int hashCode()
-