Class Guild

    • Constructor Detail

      • Guild

        public Guild​(GatewayDiscordClient gateway,
                     discord4j.discordjson.json.GuildData data)
        Constructs a Guild with an associated GatewayDiscordClient and Discord data.
        Parameters:
        gateway - The GatewayDiscordClient associated to this object, must be non-null.
        data - The raw data as represented by Discord, must be non-null.
    • Method Detail

      • getId

        public Snowflake getId()
        Description copied from interface: Entity
        Gets the Snowflake that uniquely identifies this entity.
        Specified by:
        getId in interface Entity
        Returns:
        The Snowflake that uniquely identifies this entity.
      • getData

        public discord4j.discordjson.json.GuildData getData()
        Gets the data of the guild.
        Returns:
        The data of the guild.
      • getName

        public String getName()
        Gets the guild name.
        Returns:
        The guild name.
      • getIconUrl

        public Optional<String> getIconUrl​(Image.Format format)
        Gets the icon URL of the guild, if present.
        Parameters:
        format - The format for the URL.
        Returns:
        The icon URL of the guild, if present.
      • getIcon

        public Mono<Image> getIcon​(Image.Format format)
        Gets the icon of the guild.
        Parameters:
        format - The format in which to get the image.
        Returns:
        A Mono where, upon successful completion, emits the icon of the guild. If an error is received, it is emitted through the Mono.
      • getSplashUrl

        public Optional<String> getSplashUrl​(Image.Format format)
        Gets the splash URL of the guild, if present.
        Parameters:
        format - The format for the URL.
        Returns:
        The splash URL of the guild, if present.
      • getSplash

        public Mono<Image> getSplash​(Image.Format format)
        Gets the splash of the guild.
        Parameters:
        format - The format in which to get the image.
        Returns:
        A Mono where, upon successful completion, emits the splash of the guild. If an error is received, it is emitted through the Mono.
      • getDiscoverySplashUrl

        public Optional<String> getDiscoverySplashUrl​(Image.Format format)
        Gets the discovery splash URL of the guild, if present.
        Parameters:
        format - The format for the URL.
        Returns:
        The discovery splash URL of the guild, if present.
      • getDiscoverySplash

        public Mono<Image> getDiscoverySplash​(Image.Format format)
        Gets the discovery splash of the guild.
        Parameters:
        format - The format in which to get the image.
        Returns:
        A Mono where, upon successful completion, emits the discovery splash of the guild. If an error is received, it is emitted through the Mono.
      • getBannerUrl

        public Optional<String> getBannerUrl​(Image.Format format)
        Gets the banner URL of the guild, if present.
        Parameters:
        format - The format for the URL.
        Returns:
        The banner URL of the guild, if present.
      • getBanner

        public Mono<Image> getBanner​(Image.Format format)
        Gets the banner of the guild.
        Parameters:
        format - The format in which to get the image.
        Returns:
        A Mono where, upon successful completion, emits the banner of the guild. If an error is received, it is emitted through the Mono.
      • getOwnerId

        public Snowflake getOwnerId()
        Gets the ID of the owner of the guild.
        Returns:
        The ID of the owner of the guild.
      • getOwner

        public Mono<Member> getOwner()
        Requests to retrieve the owner of the guild.
        Returns:
        A Mono where, upon successful completion, emits the owner of the guild. If an error is received, it is emitted through the Mono.
      • getRegionId

        @Deprecated
        public Region.Id getRegionId()
        Deprecated.
        Voice region are now specific to voice channels. Use VoiceChannel#getRtcRegion instead.
        Gets the voice region ID for the guild.
        Returns:
        The voice region ID for the guild.
      • getRegion

        @Deprecated
        public Mono<Region> getRegion()
        Deprecated.
        Voice regions are now specific to voice channels. Use VoiceChannel#getRtcRegion instead.
        Requests to retrieve the voice region for the guild.
        Returns:
        A Mono where, upon successful completion, emits the voice region for the guild. If an error is received, it is emitted through the Mono.
      • getRegions

        public Flux<Region> getRegions()
        Requests to retrieve the voice regions for the guild.
        Returns:
        A Flux that continually emits the guild's voice regions. If an error is received, it is emitted through the Flux.
      • getAfkChannelId

        public Optional<Snowflake> getAfkChannelId()
        Gets the ID of the AFK channel, if present.
        Returns:
        The ID of the AFK channel, if present.
      • getAfkChannel

        public Mono<VoiceChannel> getAfkChannel()
        Requests to retrieve the AFK channel, if present.
        Returns:
        A Mono where, upon successful completion, emits the AFK channel, if present. If an error is received, it is emitted through the Mono.
      • getAfkChannel

        public Mono<VoiceChannel> getAfkChannel​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the AFK channel, if present, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the AFK channel
        Returns:
        A Mono where, upon successful completion, emits the AFK channel, if present. If an error is received, it is emitted through the Mono.
      • getAfkTimeout

        public int getAfkTimeout()
        Gets the AFK timeout in seconds.
        Returns:
        The AFK timeout in seconds.
      • getPremiumTier

        public Guild.PremiumTier getPremiumTier()
        Gets the Premium Tier (Server Boost level) for the guild.
        Returns:
        The Premium Tier (Server Boost level) for the guild.
      • getPremiumSubscriptionCount

        public OptionalInt getPremiumSubscriptionCount()
        Gets the number of boosts this server currently has, if present.
        Returns:
        The number of boosts this server currently has, if present.
      • getPreferredLocale

        public Locale getPreferredLocale()
        Gets the preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US".
        Returns:
        The preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US".
      • getVerificationLevel

        public Guild.VerificationLevel getVerificationLevel()
        Gets the level of verification required for the guild.
        Returns:
        The level of verification required for the guild.
      • getNotificationLevel

        public Guild.NotificationLevel getNotificationLevel()
        Gets the default message notification level..
        Returns:
        The default message notification level.
      • getContentFilterLevel

        public Guild.ContentFilterLevel getContentFilterLevel()
        Gets the default explicit content filter level.
        Returns:
        The default explicit content filter level.
      • getRoleIds

        public Set<Snowflake> getRoleIds()
        Gets the guild's roles' IDs.
        Returns:
        The guild's roles' IDs.
      • getRoles

        public Flux<Role> getRoles()
        Requests to retrieve the guild's roles.

        The order of items emitted by the returned Flux is unspecified. Use OrderUtil.orderRoles(Flux) to consistently order roles.

        Returns:
        A Flux that continually emits the guild's roles. If an error is received, it is emitted through the Flux.
      • getRoles

        public Flux<Role> getRoles​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the guild's roles, using the given retrieval strategy.

        The order of items emitted by the returned Flux is unspecified. Use OrderUtil.orderRoles(Flux) to consistently order roles.

        Parameters:
        retrievalStrategy - the strategy to use to get the roles
        Returns:
        A Flux that continually emits the guild's roles. If an error is received, it is emitted through the Flux.
      • getRoleById

        public Mono<Role> getRoleById​(Snowflake id)
        Requests to retrieve the role as represented by the supplied ID.
        Parameters:
        id - The ID of the role.
        Returns:
        A Mono where, upon successful completion, emits the Role as represented by the supplied ID. If an error is received, it is emitted through the Mono.
      • getRoleById

        public Mono<Role> getRoleById​(Snowflake id,
                                      EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the role as represented by the supplied ID, using the given retrieval strategy.
        Parameters:
        id - The ID of the role.
        retrievalStrategy - the strategy to use to get the role
        Returns:
        A Mono where, upon successful completion, emits the Role as represented by the supplied ID. If an error is received, it is emitted through the Mono.
      • getEveryoneRole

        public Mono<Role> getEveryoneRole()
        Requests to retrieve the guild's @everyone Role.
        Returns:
        A Mono where, upon successful completion, emits the @everyone Role, if present. If an error is received, it is emitted through the Mono.
      • getEveryoneRole

        public Mono<Role> getEveryoneRole​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the guild's @everyone Role, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the everyone role
        Returns:
        A Mono where, upon successful completion, emits the @everyone Role, if present. If an error is received, it is emitted through the Mono.
      • getEmojiIds

        public Set<Snowflake> getEmojiIds()
        Gets the guild's emoji's IDs.
        Returns:
        The guild's emoji's IDs.
      • getEmojis

        public Flux<GuildEmoji> getEmojis()
        Requests to retrieve the guild's emojis.
        Returns:
        A Flux that continually emits guild's emojis. If an error is received, it is emitted through the Flux.
      • getEmojis

        public Flux<GuildEmoji> getEmojis​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the guild's emojis, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the emojis
        Returns:
        A Flux that continually emits guild's emojis. If an error is received, it is emitted through the Flux.
      • getGuildEmojiById

        public Mono<GuildEmoji> getGuildEmojiById​(Snowflake id)
        Requests to retrieve the guild emoji as represented by the supplied ID.
        Parameters:
        id - The ID of the guild emoji.
        Returns:
        A 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.
      • getGuildEmojiById

        public Mono<GuildEmoji> getGuildEmojiById​(Snowflake id,
                                                  EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the guild emoji as represented by the supplied ID, using the given retrieval strategy.
        Parameters:
        id - The ID of the guild emoji.
        retrievalStrategy - the strategy to use to get the guild emoji
        Returns:
        A 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.
      • getFeatures

        public Set<String> getFeatures()
        Gets the enabled guild features.
        You can see the available guild features
        Returns:
        The enabled guild features.
      • getMfaLevel

        public Guild.MfaLevel getMfaLevel()
        Gets the required MFA level for the guild.
        Returns:
        The required MFA level for the guild.
      • getApplicationId

        public Optional<Snowflake> getApplicationId()
        Gets the application ID of the guild creator if it is bot-created.
        Returns:
        The application ID of the guild creator if it is bot-created.
      • isWidgetEnabled

        public boolean isWidgetEnabled()
        Gets whether or not the server widget is enabled.
        Returns:
        Whether or not the server widget is enabled.
      • getWidgetChannelId

        public Optional<Snowflake> getWidgetChannelId()
        Gets the channel ID that the widget will generate an invite to, if present.
        Returns:
        The channel ID that the widget will generate an invite to, if present.
      • getWidgetChannel

        public Mono<GuildChannel> getWidgetChannel()
        Requests to retrieve the channel for the server widget, if present.
        Returns:
        A Mono where, upon successful completion, emits the channel for the server widget, if present. If an error is received, it is emitted through the Mono.
      • getWidgetChannel

        public Mono<GuildChannel> getWidgetChannel​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the channel for the server widget, if present, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the widget channel
        Returns:
        A Mono where, upon successful completion, emits the channel for the server widget, if present. If an error is received, it is emitted through the Mono.
      • getSystemChannelId

        public Optional<Snowflake> getSystemChannelId()
        Gets the ID of the channel where guild notices such as welcome messages and boost events are posted, if present.
        Returns:
        The ID of the channel where guild notices such as welcome messages and boost events are posted, if present.
      • getSystemChannel

        public Mono<TextChannel> getSystemChannel()
        Requests to retrieve the channel to which system messages are sent, if present.
        Returns:
        A Mono where, upon successful completion, emits the channel to which system messages are sent, if present. If an error is received, it is emitted through the Mono.
      • getSystemChannel

        public Mono<TextChannel> getSystemChannel​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the channel to which system messages are sent, if present, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the system channel
        Returns:
        A Mono where, upon successful completion, emits the channel to which system messages are sent, if present. If an error is received, it is emitted through the Mono.
      • getRulesChannelId

        public Optional<Snowflake> getRulesChannelId()
        Gets the id of the channel where Community guilds display rules and/or guidelines, if present.
        Returns:
        The id of the channel where Community guilds display rules and/or guidelines, if present.
      • getRulesChannel

        public Mono<TextChannel> getRulesChannel()
        Requests to retrieve the channel where Community guilds display rules and/or guidelines, if present.
        Returns:
        A Mono where, upon successful completion, emits the channel where Community guilds display rules and/or guidelines, if present. If an error is received, it is emitted through the Mono.
      • getRulesChannel

        public Mono<TextChannel> getRulesChannel​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the channel where Community guilds display rules and/or guidelines, if present, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the rules channel
        Returns:
        A Mono where, upon successful completion, emits the channel where Community guilds display rules and/or guidelines, if present. If an error is received, it is emitted through the Mono.
      • getPublicUpdatesChannelId

        public Optional<Snowflake> getPublicUpdatesChannelId()
        Gets the id of the channel where admins and moderators of Community guilds receive notices from Discord, if present.
        Returns:
        The id of the channel where admins and moderators of Community guilds receive notices from Discord, if present.
      • getPublicUpdatesChannel

        public Mono<TextChannel> getPublicUpdatesChannel()
        Requests to retrieve the channel where admins and moderators of Community guilds receive notices from Discord, if present.
        Returns:
        A Mono where, upon successful completion, emits the channel where admins and moderators of Community guilds receive notices from Discord, if present. If an error is received, it is emitted through the Mono.
      • getPublicUpdatesChannel

        public Mono<TextChannel> getPublicUpdatesChannel​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the channel where admins and moderators of Community guilds receive notices from Discord, if present, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the rules channel
        Returns:
        A Mono where, upon successful completion, emits the channel where admins and moderators of Community guilds receive notices from Discord, if present. If an error is received, it is emitted through the Mono.
      • getMaxVideoChannelUsers

        public Optional<Integer> getMaxVideoChannelUsers()
        Gets the maximum amount of users in a video channel, if present.
        Returns:
        The maximum amount of users in a video channel, if present.
      • getJoinTime

        public Instant getJoinTime()
        Gets when this guild was joined at. If this Guild object was retrieved using REST API, then calling this method will throw DateTimeParseException.
        Returns:
        When this guild was joined at.
      • isLarge

        public boolean isLarge()
        Gets whether this guild is considered large. If this Guild object was retrieved using REST API, then calling this method will always return false.
        Returns:
        If present, true if the guild is considered large, false otherwise.
      • isUnavailable

        public boolean isUnavailable()
        Gets whether this guild is unavailable.
        Returns:
        If present, true if the guild is unavailable, false otherwise.
      • isEmbedEnabled

        @Deprecated
        public boolean isEmbedEnabled()
        Deprecated.
        Use Guild#isWidgetEnabled instead
        Gets whether this guild is embeddable (e.g. widget).
        Returns:
        Whether this guild is embeddable (e.g. widget).
      • getMemberCount

        public int getMemberCount()
        Gets the total number of members in the guild. If this Guild object was retrieved using REST API, then calling this method will always return the same value.
        Returns:
        The total number of members in the guild.
      • isNsfw

        @Deprecated
        public boolean isNsfw()
        Deprecated.
        Use getNsfwLevel() instead
        Gets whether this guild is designated as NSFW.
        Returns:
        Whether this guild is designated as NSFW.
      • getNsfwLevel

        public Guild.NsfwLevel getNsfwLevel()
        Gets the guild NSFW level.
        Returns:
        The guild NSFW level.
      • getVoiceStates

        public Flux<VoiceState> getVoiceStates()
        Requests to retrieve the voice states of the guild.
        Returns:
        A Flux that continually emits the voice states of the guild. If an error is received, it is emitted through the Flux.
      • getMembers

        public Flux<Member> getMembers()
        Requests to retrieve the members of the guild.
        Returns:
        A Flux that continually emits the members of the guild. If an error is received, it is emitted through the Flux.
      • getMembers

        public Flux<Member> getMembers​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the members of the guild, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the members
        Returns:
        A Flux that continually emits the members of the guild. If an error is received, it is emitted through the Flux.
      • requestMembers

        public Flux<Member> requestMembers()
        Return all members from this Guild using the current Gateway connection.
        Returns:
        a Flux of Member for the given Guild. If an error occurs, it is emitted through the Flux.
      • requestMembers

        public Flux<Member> requestMembers​(Set<Snowflake> userIds)
        Return a set of members from this guild using the current Gateway connection. This method performs a check to validate whether the given guild's data can be obtained from this GatewayDiscordClient.
        Parameters:
        userIds - the Snowflake set of users to request
        Returns:
        a Flux of Member for the given Guild. If an error occurs, it is emitted through the Flux.
      • searchMembers

        public Flux<Member> searchMembers​(String username,
                                          int limit)
        Returns a list of members whose username or nickname starts with the provided username.
        Parameters:
        username - the string to match username(s) and nickname(s) against.
        limit - the max number of members to return.
        Returns:
        a Flux of Member whose username or nickname starts with the provided username. If an error occurs, it is emitted through the Flux.
      • getMemberById

        public Mono<Member> getMemberById​(Snowflake id)
        Requests to retrieve the member as represented by the supplied ID.
        Parameters:
        id - The ID of the member.
        Returns:
        A Mono where, upon successful completion, emits the Member as represented by the supplied ID. If an error is received, it is emitted through the Mono.
      • getMemberById

        public Mono<Member> getMemberById​(Snowflake id,
                                          EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the member as represented by the supplied ID, using the given retrieval strategy.
        Parameters:
        id - The ID of the member.
        retrievalStrategy - the strategy to use to get the member
        Returns:
        A Mono where, upon successful completion, emits the Member as represented by the supplied ID. If an error is received, it is emitted through the Mono.
      • getSelfMember

        public Mono<Member> getSelfMember()
        Requests to retrieve the member as represented by the bot user's ID.
        Returns:
        A Mono where, upon successful completion, emits the Member as represented by the bot user's ID. If an error is received, it is emitted through the Mono.
      • getChannels

        public Flux<GuildChannel> getChannels()
        Requests to retrieve the guild's channels.

        The order of items emitted by the returned Flux is unspecified. Use OrderUtil.orderGuildChannels(Flux) to consistently order channels.

        Returns:
        A Flux that continually emits the guild's channels. If an error is received, it is emitted through the Flux.
      • getChannels

        public Flux<GuildChannel> getChannels​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the guild's channels, using the given retrieval strategy.

        The order of items emitted by the returned Flux is unspecified. Use OrderUtil.orderGuildChannels(Flux) to consistently order channels.

        Parameters:
        retrievalStrategy - the strategy to use to get the channels
        Returns:
        A Flux that continually emits the guild's channels. If an error is received, it is emitted through the Flux.
      • getChannelById

        public Mono<GuildChannel> getChannelById​(Snowflake id)
        Requests to retrieve the channel as represented by the supplied ID.
        Parameters:
        id - The ID of the channel.
        Returns:
        A 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.
      • getChannelById

        public Mono<GuildChannel> getChannelById​(Snowflake id,
                                                 EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the channel as represented by the supplied ID, using the given retrieval strategy.
        Parameters:
        id - The ID of the channel.
        retrievalStrategy - the strategy to use to get the channel
        Returns:
        A 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.
      • getPresences

        public Flux<Presence> getPresences()
        Requests to retrieve the presences of the guild.
        Returns:
        A Flux that continually emits the presences of the guild. If an error is received, it is emitted through the Flux.
      • getVanityUrlCode

        public Optional<String> getVanityUrlCode()
        Gets the vanity url code of the guild, if present.
        Returns:
        The vanity url code of the guild, if present.
      • getDescription

        public Optional<String> getDescription()
        Gets the description of the guild, if present.
        Returns:
        The description of the guild, if present.
      • getMaxPresences

        public int getMaxPresences()
        Gets the maximum amount of presences of the guild.
        Returns:
        The maximum amount of presences for the guild.
      • getMaxMembers

        public OptionalInt getMaxMembers()
        Gets the maximum amount of members of the guild, if present.
        Returns:
        The maximum amount of members for the guild, if present.
      • edit

        public discord4j.core.spec.GuildEditMono edit()
        Requests to edit this guild. Properties specifying how to edit this guild can be set via the withXxx methods of the returned GuildEditMono.
        Returns:
        A GuildEditMono where, upon successful completion, emits the edited Guild. If an error is received, it is emitted through the GuildEditMono.
      • edit

        public Mono<Guild> edit​(discord4j.core.spec.GuildEditSpec spec)
        Requests to edit this guild.
        Parameters:
        spec - an immutable object that specifies how to edit this guild
        Returns:
        A Mono where, upon successful completion, emits the edited Guild. If an error is received, it is emitted through the Mono.
      • createEmoji

        public discord4j.core.spec.GuildEmojiCreateMono createEmoji​(String name,
                                                                    Image image)
        Requests to create an emoji. Properties specifying how to create an emoji can be set via the withXxx methods of the returned GuildEmojiCreateMono.
        Parameters:
        name - the name of the emoji to create
        image - the image of the emoji to create
        Returns:
        A GuildEmojiCreateMono where, upon successful completion, emits the created GuildEmoji. If an error is received, it is emitted through the GuildEmojiCreateMono.
      • createEmoji

        public Mono<GuildEmoji> createEmoji​(discord4j.core.spec.GuildEmojiCreateSpec spec)
        Requests to create an emoji.
        Parameters:
        spec - an immutable object that specifies how to create the emoji
        Returns:
        A Mono where, upon successful completion, emits the created GuildEmoji. If an error is received, it is emitted through the Mono.
      • createTemplate

        public discord4j.core.spec.GuildTemplateCreateMono createTemplate​(String name)
        Requests to create a template based on this guild. A description for this template can be set via the GuildTemplateCreateMono.withDescriptionOrNull(String) method of the returned GuildTemplateCreateMono.
        Parameters:
        name - the name of the template to create
        Returns:
        A Mono where, upon subscription, emits the created GuildTemplate on success. If an error is received, it is emitted through the Mono.
      • createTemplate

        public Mono<GuildTemplate> createTemplate​(discord4j.core.spec.GuildTemplateCreateSpec spec)
        Requests to create a template based on this guild.
        Parameters:
        spec - an immutable object that specifies how to create a template for this guild
        Returns:
        A Mono where, upon subscription, emits the created GuildTemplate on success. If an error is received, it is emitted through the Mono.
      • createRole

        public discord4j.core.spec.RoleCreateMono createRole()
        Requests to create a role. Properties specifying how to create the role can be set via the withXxx methods of the returned RoleCreateMono.
        Returns:
        A RoleCreateMono where, upon successful completion, emits the created Role. If an error is received, it is emitted through the RoleCreateMono.
      • createRole

        public Mono<Role> createRole​(discord4j.core.spec.RoleCreateSpec spec)
        Requests to create a role.
        Parameters:
        spec - an immutable object that specifies how to create the role
        Returns:
        A Mono where, upon successful completion, emits the created Role. If an error is received, it is emitted through the Mono.
      • createNewsChannel

        public discord4j.core.spec.NewsChannelCreateMono createNewsChannel​(String name)
        Requests to create a news channel. Properties specifying how to create the news channel can be set via the withXxx methods of the returned NewsChannelCreateMono.
        Parameters:
        name - the name of the news channel to create
        Returns:
        A NewsChannelCreateMono where, upon successful completion, emits the created NewsChannel. If an error is received, it is emitted through the NewsChannelCreateMono.
      • createNewsChannel

        public Mono<NewsChannel> createNewsChannel​(discord4j.core.spec.NewsChannelCreateSpec spec)
        Requests to create a news channel.
        Parameters:
        spec - an immutable object that specifies how to create the news channel
        Returns:
        A Mono where, upon successful completion, emits the created NewsChannel. If an error is received, it is emitted through the Mono.
      • createCategory

        public discord4j.core.spec.CategoryCreateMono createCategory​(String name)
        Requests to create a category. Properties specifying how to create the category can be set via the withXxx methods of the returned CategoryCreateMono.
        Parameters:
        name - the name of the category to create
        Returns:
        A CategoryCreateMono where, upon successful completion, emits the created Category. If an error is received, it is emitted through the CategoryCreateMono.
      • createCategory

        public Mono<Category> createCategory​(discord4j.core.spec.CategoryCreateSpec spec)
        Requests to create a category.
        Parameters:
        spec - an immutable object that specifies how to create the category
        Returns:
        A Mono where, upon successful completion, emits the created Category. If an error is received, it is emitted through the Mono.
      • createTextChannel

        public discord4j.core.spec.TextChannelCreateMono createTextChannel​(String name)
        Requests to create a text channel. Properties specifying how to create the text channel can be set via the withXxx methods of the returned TextChannelCreateMono.
        Parameters:
        name - the name of the text channel to create
        Returns:
        A TextChannelCreateMono where, upon successful completion, emits the created TextChannel. If an error is received, it is emitted through the TextChannelCreateMono.
      • createTextChannel

        public Mono<TextChannel> createTextChannel​(discord4j.core.spec.TextChannelCreateSpec spec)
        Requests to create a text channel.
        Parameters:
        spec - an immutable object that specifies how to create the text channel
        Returns:
        A Mono where, upon successful completion, emits the created TextChannel. If an error is received, it is emitted through the Mono.
      • createVoiceChannel

        public discord4j.core.spec.VoiceChannelCreateMono createVoiceChannel​(String name)
        Requests to create a voice channel. Properties specifying how to create the voice channel can be set via the withXxx methods of the returned VoiceChannelCreateMono.
        Parameters:
        name - the name of the voice channel to create
        Returns:
        A VoiceChannelCreateMono where, upon successful completion, emits the created VoiceChannel. If an error is received, it is emitted through the VoiceChannelCreateMono.
      • createVoiceChannel

        public Mono<VoiceChannel> createVoiceChannel​(discord4j.core.spec.VoiceChannelCreateSpec spec)
        Requests to create a voice channel.
        Parameters:
        spec - an immutable object that specifies how to create the voice channel
        Returns:
        A Mono where, upon successful completion, emits the created VoiceChannel. If an error is received, it is emitted through the Mono.
      • delete

        public Mono<Void> delete()
        Requests to delete this guild.
        Returns:
        A Mono where, upon successful completion, emits nothing; indicating the guild has been deleted. If an error is received, it is emitted through the Mono.
      • kick

        public Mono<Void> kick​(Snowflake userId)
        Requests to kick the specified user from this guild.
        Parameters:
        userId - The ID of the user to kick from this guild.
        Returns:
        A 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.
      • kick

        public Mono<Void> kick​(Snowflake userId,
                               @Nullable
                               String reason)
        Requests to kick the specified user from this guild while optionally specifying a reason.
        Parameters:
        userId - The ID of the user to kick from this guild.
        reason - The reason, if present.
        Returns:
        A 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.
      • getBans

        public Flux<Ban> getBans()
        Requests to retrieve all the bans for this guild.
        Returns:
        A Flux that continually emits the bans for this guild. If an error is received, it is emitted through the Flux.
      • getBan

        public Mono<Ban> getBan​(Snowflake userId)
        Requests to retrieve the ban for the specified user for this guild.
        Parameters:
        userId - The ID of the user to retrieve the ban for this guild.
        Returns:
        A Mono where, upon successful completion, emits the ban for the specified user for this guild. If an error is received, it is meitted through the Mono.
      • ban

        public discord4j.core.spec.GuildBanQueryMono ban​(Snowflake userId)
        Requests to ban the specified user. Properties specifying how to ban the user can be set via the withXxx methods of the returned GuildBanQueryMono.
        Parameters:
        userId - The ID of the user to ban.
        Returns:
        A GuildBanQueryMono where, upon successful completion, emits nothing; indicating the specified user was banned. If an error is received, it is emitted through the GuildBanQueryMono.
      • ban

        public Mono<Void> ban​(Snowflake userId,
                              discord4j.core.spec.BanQuerySpec spec)
        Requests to ban the specified user.
        Parameters:
        userId - The ID of the user to ban.
        spec - an immutable object that specifies how to ban the user
        Returns:
        A Mono where, upon successful completion, emits nothing; indicating the specified user was banned. If an error is received, it is emitted through the Mono.
      • unban

        public Mono<Void> unban​(Snowflake userId)
        Requests to unban the specified user.
        Parameters:
        userId - The ID of the user to unban.
        Returns:
        A Mono where, upon successful completion, emits nothing; indicating the specified user was unbanned. If an error is received, it is emitted through the Mono.
      • unban

        public Mono<Void> unban​(Snowflake userId,
                                @Nullable
                                String reason)
        Requests to unban the specified user while optionally specifying a reason.
        Parameters:
        userId - The ID of the user to unban.
        reason - The reason, if present.
        Returns:
        A Mono where, upon successful completion, emits nothing; indicating the specified user was unbanned. If an error is received, it is emitted through the Mono.
      • getPruneCount

        public discord4j.core.spec.GuildPruneCountMono getPruneCount​(int days)
        Requests to retrieve the number of users that will be pruned. Users are pruned if they have not been seen within the past specified amount of days. Included roles can be set via the GuildPruneCountMono.withRoles(Snowflake...) method of the returned GuildPruneCountMono.
        Parameters:
        days - The number of days since an user must have been seen to avoid being kicked.
        Returns:
        A GuildPruneCountMono where, upon successful completion, emits the number of users that will be pruned. If an error is received, it is emitted through the GuildPruneCountMono.
      • getPruneCount

        public Mono<Integer> getPruneCount​(discord4j.core.spec.GuildPruneCountSpec spec)
        Requests to retrieve the number of users that will be pruned. Users are pruned if they have not been seen within the past specified amount of days, with roles optionally included in the prune count if specified through GuildPruneCountSpec.roles().
        Parameters:
        spec - an immutable object that specifies how to get prune count
        Returns:
        A 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.
      • prune

        public discord4j.core.spec.GuildPruneMono prune​(int days)
        Requests to prune users. Users are pruned if they have not been seen within the past specified amount of days. Included roles can be set via the GuildPruneMono.withRoles(Snowflake...) method of the returned GuildPruneMono.
        Parameters:
        days - The number of days since an user must have been seen to avoid being kicked.
        Returns:
        A Mono where, upon successful completion, may emit the number of users who were pruned if GuildPruneMono.withComputePruneCount(Boolean) is true (default), otherwise it would emit an empty Mono. If an error is received, it is emitted through the Mono.
      • prune

        public Mono<Integer> prune​(discord4j.core.spec.GuildPruneSpec spec)
        Requests to prune users while customizing parameters. Users are pruned if they have not been seen within the past specified amount of days, with roles optionally included in the prune request if specified through GuildPruneSpec.roles().
        Parameters:
        spec - an immutable object that specifies how to prune users of this guild
        Returns:
        A Mono where, upon successful completion, may emit the number of users who were pruned if GuildPruneSpec.computePruneCount() is true (default), otherwise it would emit an empty Mono. If an error is received, it is emitted through the Mono.
      • leave

        public Mono<Void> leave()
        Requests to leave this guild.
        Returns:
        A Mono where, upon successful completion, emits nothing; indicating this guild has been left. If an error is received, it is emitted through the Mono.
      • getAuditLog

        public discord4j.core.spec.AuditLogQueryFlux getAuditLog()
        Requests to retrieve the audit log for this guild. Properties specifying how to query audit log can be set via withXxx methods of the returned AuditLogQueryFlux.

        The audit log parts can be combined for easier querying. For example,

         
         guild.getAuditLog()
             .take(10)
             .reduce(AuditLogPart::combine)
         
         
        Returns:
        A AuditLogQueryFlux that continually emits parts of this guild's audit log. If an error is received, it is emitted through the Flux.
      • getAuditLog

        public Flux<AuditLogPart> getAuditLog​(discord4j.core.spec.AuditLogQuerySpec spec)
        Requests to retrieve the audit log for this guild.

        The audit log parts can be combined for easier querying. For example,

         
         guild.getAuditLog()
             .take(10)
             .reduce(AuditLogPart::combine)
         
         
        Parameters:
        spec - an immutable object that specifies how to query audit log
        Returns:
        A Flux that continually emits parts of this guild's audit log. If an error is received, it is emitted through the Flux.
      • getWebhooks

        public Flux<Webhook> getWebhooks()
        Requests to retrieve the webhooks of the guild. Requires the MANAGE_WEBHOOKS permission.
        Returns:
        A Flux that continually emits the webhooks of the guild. If an error is received, it is emitted through the Flux.
      • getInvites

        public Flux<ExtendedInvite> getInvites()
        Requests to retrieve the invites of the guild.
        Returns:
        A Flux that continually emits the invites of the guild. If an error is received, it is emitted through the Flux.
      • getTemplates

        public Flux<GuildTemplate> getTemplates()
        Requests to retrieve the templates of the guild.
        Returns:
        A Flux that continually emits the templates of the guild. If an error is received, it is emitted through the Flux.
      • changeSelfNickname

        public Mono<String> changeSelfNickname​(@Nullable
                                               String nickname)
        Requests to change the bot user's nickname in this guild.
        Parameters:
        nickname - The new nickname for the bot user in this guild, or null to remove it.
        Returns:
        A 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.
      • getVoiceConnection

        public Mono<VoiceConnection> getVoiceConnection()
        Returns the current voice connection registered for this guild.
        Returns:
        A Mono of VoiceConnection for this guild if present, or empty otherwise.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object