Class Category

    • Constructor Detail

      • Category

        public Category​(GatewayDiscordClient gateway,
                        discord4j.discordjson.json.ChannelData data)
        Constructs an Category 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

      • getChannels

        public Flux<CategorizableChannel> getChannels()
        Requests to retrieve the channels residing in this category.
        Returns:
        A Flux that continually emits the channels residing in this category. If an error is received, it is emitted through the Flux.
      • getChannels

        public Flux<CategorizableChannel> getChannels​(EntityRetrievalStrategy retrievalStrategy)
        Requests to retrieve the channels residing in this category, using the given retrieval strategy.
        Parameters:
        retrievalStrategy - the strategy to use to get the channels
        Returns:
        A Flux that continually emits the channels residing in this category. If an error is received, it is emitted through the Flux.
      • edit

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

        public Mono<Category> edit​(discord4j.core.spec.CategoryEditSpec spec)
        Requests to edit this category.
        Parameters:
        spec - an immutable object specifying how to edit this category
        Returns:
        A Mono where, upon successful completion, emits the edited Category. If an error is received, it is emitted through the Mono.
      • toString

        public String toString()
      • getGuildId

        public final Snowflake getGuildId()
        Description copied from interface: GuildChannel
        Gets the ID of the guild this channel is associated to.
        Specified by:
        getGuildId in interface GuildChannel
        Returns:
        The ID of the guild this channel is associated to.
      • getGuild

        public final Mono<Guild> getGuild()
        Description copied from interface: GuildChannel
        Requests to retrieve the guild this channel is associated to.
        Specified by:
        getGuild in interface GuildChannel
        Returns:
        A Mono where, upon successful completion, emits the guild this channel is associated to. If an error is received, it is emitted through the Mono.
      • getGuild

        public Mono<Guild> getGuild​(EntityRetrievalStrategy retrievalStrategy)
        Description copied from interface: GuildChannel
        Requests to retrieve the guild this channel is associated to, using the given retrieval strategy.
        Specified by:
        getGuild in interface GuildChannel
        Parameters:
        retrievalStrategy - the strategy to use to get the guild
        Returns:
        A Mono where, upon successful completion, emits the guild this channel is associated to. If an error is received, it is emitted through the Mono.
      • getEffectivePermissions

        public Mono<PermissionSet> getEffectivePermissions​(Snowflake memberId)
        Description copied from interface: GuildChannel
        Gets the permissions for the given member, taking into account permission overwrites in this channel.
        Specified by:
        getEffectivePermissions in interface GuildChannel
        Parameters:
        memberId - The ID of the member to get permissions for.
        Returns:
        The permissions for the given member.
      • getEffectivePermissions

        public Mono<PermissionSet> getEffectivePermissions​(Member member)
        Description copied from interface: GuildChannel
        Gets the permissions for the given member, taking into account permission overwrites in this channel.
        Specified by:
        getEffectivePermissions in interface GuildChannel
        Parameters:
        member - The member to get permissions for.
        Returns:
        The permissions for the given member.
      • getName

        public final String getName()
        Description copied from interface: GuildChannel
        Gets the name of the channel.
        Specified by:
        getName in interface GuildChannel
        Returns:
        The name of the channel.
      • getRawPosition

        public int getRawPosition()
        Description copied from interface: GuildChannel
        Gets the raw position of the channel as exposed by Discord. This may or may not be accurate with relativity to other channels in the guild.
        Specified by:
        getRawPosition in interface GuildChannel
        Returns:
        The raw position of the channel.
      • getPosition

        public final Mono<Integer> getPosition()
        Description copied from interface: GuildChannel
        Requests to retrieve the position of the channel relative to other channels in the guild.

        This is determined by the index of this channel in the sorted list of channels of the guild.

        Warning: Because this method must sort the guild channels, it is inefficient to make repeated invocations for the same set of channels (meaning that channels haven't been added or removed). For example, instead of writing:

         
         guild.getChannels()
           .flatMap(c -> c.getPosition().map(pos -> c.getName() + " : " + pos))
         
         
        It would be much more efficient to write:
         
         guild.getChannels()
           .transform(OrderUtil::orderGuildChannels)
           .index((pos, c) -> c.getName() + " : " + pos)
         
         
        Specified by:
        getPosition in interface GuildChannel
        Returns:
        A Mono where, upon successful completion, emits the position of the channel. If an error is received, it is emitted through the Mono.
      • addMemberOverwrite

        public Mono<Void> addMemberOverwrite​(Snowflake memberId,
                                             PermissionOverwrite overwrite,
                                             @Nullable
                                             String reason)
        Description copied from interface: GuildChannel
        Requests to add a permission overwrite for the given member while optionally specifying a reason.
        Specified by:
        addMemberOverwrite in interface GuildChannel
        Parameters:
        memberId - The ID of the member to add the overwrite for.
        overwrite - The overwrite to add.
        reason - The reason, if present.
        Returns:
        A Mono where, upon successful completion, emits nothing; If an error is received, it is emitted through the Mono.
      • addRoleOverwrite

        public Mono<Void> addRoleOverwrite​(Snowflake roleId,
                                           PermissionOverwrite overwrite,
                                           @Nullable
                                           String reason)
        Description copied from interface: GuildChannel
        Requests to add a permission overwrite for the given role while optionally specifying a reason.
        Specified by:
        addRoleOverwrite in interface GuildChannel
        Parameters:
        roleId - The ID of the role to add the overwrite for.
        overwrite - The overwrite to add.
        reason - The reason, if present.
        Returns:
        A Mono where, upon successful completion, emits nothing; If an error is received, it is emitted through the Mono.
      • getId

        public final 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.
      • getType

        public final Channel.Type getType()
        Description copied from interface: Channel
        Gets the type of channel.
        Specified by:
        getType in interface Channel
        Returns:
        The type of channel.
      • delete

        public final Mono<Void> delete​(@Nullable
                                       String reason)
        Description copied from interface: Channel
        Requests to delete this channel while optionally specifying a reason.
        Specified by:
        delete in interface Channel
        Parameters:
        reason - The reason, if present.
        Returns:
        A Mono where, upon successful completion, emits nothing; indicating the channel has been deleted. If an error is received, it is emitted through the Mono.
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object