Class ThreadChannel

java.lang.Object
discord4j.core.object.entity.channel.ThreadChannel
All Implemented Interfaces:
DiscordObject, Channel, GuildChannel, GuildMessageChannel, MessageChannel, Entity

@Experimental public final class ThreadChannel extends Object implements GuildMessageChannel
  • Constructor Details

    • ThreadChannel

      public ThreadChannel(GatewayDiscordClient gateway, discord4j.discordjson.json.ChannelData data)
  • Method Details

    • getStarterId

      public Snowflake getStarterId()
    • getRateLimitPerUser

      public int getRateLimitPerUser()
      Gets the amount of seconds a user has to wait before sending another message (0-21600).

      Bots, as well as users with the permission manage_messages or manage_channel, are unaffected.

      Returns:
      The amount of seconds a user has to wait before sending another message (0-21600).
    • getStarter

      public Mono<User> getStarter()
    • getStarter

      public Mono<User> getStarter(EntityRetrievalStrategy retrievalStrategy)
    • getParentId

      public Optional<Snowflake> getParentId()
    • getParent

      public Mono<TopLevelGuildMessageChannel> getParent()
    • getParent

      public Mono<TopLevelGuildMessageChannel> getParent(EntityRetrievalStrategy retrievalStrategy)
    • getMember

      public Mono<ThreadMember> getMember(Snowflake userId)
      Requests to retrieve the member of this thread.
      Parameters:
      userId - The ID of the user.
      Returns:
      A Mono where, upon successful completion, emits the member of this thread. If an error is received, it is emitted through the Mono.
    • getMember

      public Mono<ThreadMember> getMember(Snowflake userId, EntityRetrievalStrategy retrievalStrategy)
      Requests to retrieve the member of this thread, using the given retrieval strategy.
      Parameters:
      userId - The ID of the user.
      retrievalStrategy - the strategy to use to get the thread member
      Returns:
      A Mono where, upon successful completion, emits the member of this thread. If an error is received, it is emitted through the Mono.
    • getThreadMembers

      public Flux<ThreadMember> getThreadMembers()
      Returns all members of this thread.
      Returns:
      A Flux that continually emits all members of this thread.
    • getThreadMembers

      public Flux<ThreadMember> getThreadMembers(EntityRetrievalStrategy retrievalStrategy)
      Returns all members of this thread, using the given retrieval strategy.
      Parameters:
      retrievalStrategy - the strategy to use to get the thread members
      Returns:
      A Flux that continually emits all members of this thread.
    • getApproximateMessageCount

      public int getApproximateMessageCount()
    • getApproximateMemberCount

      public int getApproximateMemberCount()
    • isArchived

      public boolean isArchived()
    • getArchiveTimestamp

      public Instant getArchiveTimestamp()
    • getAutoArchiveDuration

      public ThreadChannel.AutoArchiveDuration getAutoArchiveDuration()
    • isLocked

      public boolean isLocked()
    • isPrivate

      public boolean isPrivate()
    • 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.
    • join

      public Mono<Void> join()
      Adds the bot to this thread. Requires that the thread is not archived.
      Returns:
      A Mono where, upon successful completion, emits an empty Mono. If an error is received, it is emitted through the Mono.
    • leave

      public Mono<Void> leave()
      Removes the bot from this thread. Requires that the thread is not archived.
      Returns:
      A Mono where, upon successful completion, emits an empty Mono. If an error is received, it is emitted through the Mono.
    • addMember

      public Mono<Void> addMember(User user)
      Adds a given user to this thread. Requires the ability to send messages in the thread. Also requires the thread is not archived. Returns successfully if the user is already a member of this thread.
      Parameters:
      user - the member to add
      Returns:
      A Mono where, upon successful completion, emits an empty Mono. If an error is received, it is emitted through the Mono.
    • removeMember

      public Mono<Void> removeMember(User user)
      Removes a given user from this thread. Requires permission to manage threads, or the creator of the thread if it is a guild private thread. Also requires the thread is not archived.
      Parameters:
      user - the member to remove
      Returns:
      A Mono where, upon successful completion, emits an empty Mono. If an error is received, it is emitted through the Mono.
    • edit

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

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

      public String toString()
    • getClient

      public final GatewayDiscordClient getClient()
      Description copied from interface: DiscordObject
      Returns the GatewayDiscordClient that created this object. Methods in it are exclusively based on the entity cache or Store in use. Refer to calling getClient().rest() to access a DiscordClient that is capable of requesting entities directly from the REST API.
      Specified by:
      getClient in interface DiscordObject
      Returns:
      The GatewayDiscordClient associated to this object.
    • getRestChannel

      public final RestChannel getRestChannel()
      Description copied from interface: Channel
      Return a RestChannel handle to execute REST API operations on this entity.
      Specified by:
      getRestChannel in interface Channel
    • getData

      public final discord4j.discordjson.json.ChannelData getData()
      Description copied from interface: Channel
      Gets the raw data as represented by Discord.
      Specified by:
      getData in interface Channel
      Returns:
      The raw data as represented by Discord.
    • equals

      public final boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

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