Class RestGuild

java.lang.Object
discord4j.rest.entity.RestGuild

public class RestGuild extends Object
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 Details

    • create

      public static RestGuild create(RestClient restClient, Snowflake id)
      Create a RestGuild for a given ID. This method does not perform any API request.
      Parameters:
      restClient - the client to make API requests
      id - the ID of this entity
      Returns:
      a RestGuild represented by this id.
    • getId

      public Snowflake getId()
      Returns the ID of this guild.
      Returns:
      The ID of this guild
    • getData

      public Mono<discord4j.discordjson.json.GuildUpdateData> getData(@Nullable Boolean withCounts)
      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 in GuildUpdateData.
      Returns:
      a Mono where, upon successful completion, emits the GuildUpdateData belonging to this entity. If an error is received, it is emitted through the Mono.
    • getData

      public Mono<discord4j.discordjson.json.GuildUpdateData> getData()
      Retrieve this guild's data upon subscription.
      Returns:
      a Mono where, upon successful completion, emits the GuildUpdateData belonging to this entity. If an error is received, it is emitted through the Mono.
    • emoji

      public RestEmoji emoji(Snowflake emojiId)
      Return a RestEmoji 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

      public RestMember member(Snowflake memberId)
      Return a RestMember 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

      public RestRole role(Snowflake roleId)
      Return a RestRole 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

      public RestScheduledEvent scheduledEvent(Snowflake eventId)
      Returns a RestScheduledEvent 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 the Permission.MANAGE_GUILD permission. Returns the updated guild object on success.
      Parameters:
      request - the modify request body
      reason - an optional reason for the audit log
      Returns:
      a Mono where, upon subscription, emits the updated GuildUpdateData on success. If an error is received, it is emitted through the Mono.
    • delete

      public Mono<Void> delete()
      Delete a guild permanently. Requires the Permission.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 the Mono.
    • getChannels

      public Flux<discord4j.discordjson.json.ChannelData> getChannels()
      Return a Flux 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 the Permission.MANAGE_CHANNELS permission. Returns the new channel object on success.
      Parameters:
      request - the request body
      reason - an optional reason for the audit log
      Returns:
      a Mono where, upon subscription, emits the created ChannelData on success. If an error is received, it is emitted through the Mono.
    • modifyChannelPositions

      public Flux<discord4j.discordjson.json.RoleData> modifyChannelPositions(List<discord4j.discordjson.json.PositionModifyRequest> requests)
    • getMember

      public Mono<discord4j.discordjson.json.MemberData> getMember(Snowflake userId)
    • getSelfMember

      public Mono<discord4j.discordjson.json.MemberData> getSelfMember()
    • getMembers

      public Flux<discord4j.discordjson.json.MemberData> getMembers()
    • searchMembers

      public Flux<discord4j.discordjson.json.MemberData> searchMembers(Map<String,Object> queryParams)
    • addMember

      public Mono<discord4j.discordjson.json.MemberData> addMember(Snowflake userId, discord4j.discordjson.json.GuildMemberAddRequest request)
    • modifyMember

      public Mono<discord4j.discordjson.json.MemberData> modifyMember(Snowflake userId, discord4j.discordjson.json.GuildMemberModifyRequest request, @Nullable String reason)
    • modifyCurrentMember

      public Mono<discord4j.discordjson.json.MemberData> modifyCurrentMember(discord4j.discordjson.json.CurrentMemberModifyData request)
    • addMemberRole

      public Mono<Void> addMemberRole(Snowflake userId, Snowflake roleId, @Nullable String reason)
    • removeMemberRole

      public Mono<Void> removeMemberRole(Snowflake userId, Snowflake roleId, @Nullable String reason)
    • removeGuildMember

      public Mono<Void> removeGuildMember(Snowflake userId, @Nullable String reason)
    • getBans

      public Flux<discord4j.discordjson.json.BanData> getBans()
    • getBan

      public Mono<discord4j.discordjson.json.BanData> getBan(Snowflake userId)
    • createBan

      public Mono<Void> createBan(Snowflake userId, @Nullable Integer deleteMessageDays, @Nullable String reason)
    • removeGuildBan

      public Mono<Void> removeGuildBan(Snowflake userId, @Nullable String reason)
    • getRoles

      public Flux<discord4j.discordjson.json.RoleData> getRoles()
    • createRole

      public Mono<discord4j.discordjson.json.RoleData> createRole(discord4j.discordjson.json.RoleCreateRequest request, @Nullable String reason)
    • modifyRolePositions

      public Flux<discord4j.discordjson.json.RoleData> modifyRolePositions(List<discord4j.discordjson.json.PositionModifyRequest> requests)
    • modifyRole

      public Mono<discord4j.discordjson.json.RoleData> modifyRole(Snowflake roleId, discord4j.discordjson.json.RoleModifyRequest request, @Nullable String reason)
    • deleteRole

      public Mono<Void> deleteRole(Snowflake roleId, @Nullable String reason)
    • getPruneCount

      public Mono<discord4j.discordjson.json.PruneData> getPruneCount(@Nullable Integer days)
    • beginGuildPrune

      public Mono<discord4j.discordjson.json.PruneData> beginGuildPrune(@Nullable Integer days, @Nullable Boolean computePruneCount, @Nullable String reason)
    • getRegions

      public Flux<discord4j.discordjson.json.RegionData> getRegions()
    • getInvites

      public Flux<discord4j.discordjson.json.InviteData> getInvites()
    • getIntegrations

      public Flux<discord4j.discordjson.json.IntegrationData> getIntegrations()
    • createIntegration

      public Mono<Void> createIntegration(discord4j.discordjson.json.IntegrationCreateRequest request)
    • modifyIntegration

      public Mono<Void> modifyIntegration(Snowflake integrationId, discord4j.discordjson.json.IntegrationModifyRequest request)
    • deleteIntegration

      public Mono<Void> deleteIntegration(Snowflake integrationId)
    • syncIntegration

      public Mono<Void> syncIntegration(Snowflake integrationId)
    • getWidget

      public Mono<discord4j.discordjson.json.GuildWidgetData> getWidget()
    • modifyWidget

      public Mono<discord4j.discordjson.json.GuildWidgetData> modifyWidget(discord4j.discordjson.json.GuildWidgetModifyRequest request)
    • getEmojis

      public Flux<discord4j.discordjson.json.EmojiData> getEmojis()
    • createEmoji

      public Mono<discord4j.discordjson.json.EmojiData> createEmoji(discord4j.discordjson.json.GuildEmojiCreateRequest request, @Nullable String reason)
    • getWebhooks

      public Flux<discord4j.discordjson.json.WebhookData> getWebhooks()
    • getPreview

      public Mono<discord4j.discordjson.json.GuildPreviewData> getPreview()
    • getTemplates

      public Flux<discord4j.discordjson.json.TemplateData> getTemplates()
    • getActiveThreads

      public Mono<discord4j.discordjson.json.ListThreadsData> 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 event
      withUserCount - Whether to optionally include the number of subscribed users
      Returns:
      A Mono where, upon successful completion, emits the GuildScheduledEventData. If an error is received, it is emitted through the Mono.
    • 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 the GuildScheduledEventData associated with this guild. If an error is received, it is emitted through the Flux.
    • createScheduledEvent

      public Mono<discord4j.discordjson.json.GuildScheduledEventData> createScheduledEvent(discord4j.discordjson.json.GuildScheduledEventCreateRequest request)
      Create a new scheduled event for the guild. Requires the Permission.MANAGE_EVENTS permission. Returns the new event object on success.
      Parameters:
      request - the request body
      Returns:
      A Mono where, upon subscription, emits the created GuildScheduledEventData on success. If an error is received, it is emitted through the Mono.
    • 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 the Permission.MANAGE_EVENTS permission. Returns the modified event object on success.
      Parameters:
      eventId - The ID of the event
      request - the request body
      reason - an optional reason for the audit log
      Returns:
      A Mono where, upon subscription, emits the modified GuildScheduledEventData on success. If an error is received, it is emitted through the Mono.
    • deleteScheduledEvent

      public Mono<Void> deleteScheduledEvent(Snowflake eventId, @Nullable String reason)
      Requests to delete a scheduled event. Requires the Permission.MANAGE_EVENTS permission.
      Parameters:
      eventId - The ID of the event
      reason - 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 the Mono.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object