Interface ServerThreadChannel

    • Method Detail

      • getParent

        RegularServerChannel getParent()
        The parent regular server channel of this thread.
        Returns:
        The parent of this thread.
      • getMessageCount

        int getMessageCount()
        Gets an approximate count of messages in this thread that stops counting at 50.
        Returns:
        The count of messages in this thread.
      • getMemberCount

        int getMemberCount()
        Gets an approximate count of users in this thread that stops counting at 50.
        Returns:
        The count of users in this thread.
      • getLastMessageId

        long getLastMessageId()
        Gets the id of the last message sent in this thread.
        Returns:
        The id of the last message sent in this thread.
      • getTotalNumberOfMessagesSent

        int getTotalNumberOfMessagesSent()
        Gets the total number of messages ever sent in this thread. Similar to getMessageCount() but will not decrease when messages are deleted.
        Returns:
        The total number of messages sent in this thread.
      • getRateLimitPerUser

        int getRateLimitPerUser()
        Gets the amount of seconds a user has to wait before sending another message (0-21600).
        Returns:
        The amount of seconds a user has to wait before sending another message.
      • getMetadata

        ThreadMetadata getMetadata()
        Gets the extra data about this thread.
        Returns:
        The extra data about this thread.
      • isPrivate

        default boolean isPrivate()
        Whether this thread is private. When a thread is private, it is only viewable by those invited and those with the MANAGE_THREADS permission.
        Returns:
        Whether this thread is private.
      • isPublic

        default boolean isPublic()
        Whether this thread is private. When a thread is private, it is only viewable by those invited and those with the MANAGE_THREADS permission.
        Returns:
        Whether this thread is private.
      • getOwnerId

        long getOwnerId()
        Gets the id of the creator of the tread.
        Returns:
        The id of the owner.
      • requestOwner

        default java.util.concurrent.CompletableFuture<User> requestOwner()
        Gets the creator of the thread.

        If the creator is in the cache, the creator is served from the cache.

        Returns:
        The creator of the thread.
      • getMembers

        java.util.Set<ThreadMember> getMembers()
        Gets all members of the thread.
        Returns:
        The members of the current thread.
      • getCurrentCachedInstance

        default java.util.Optional<ServerThreadChannel> getCurrentCachedInstance()
        Description copied from interface: UpdatableFromCache
        Gets an updated instance of this entity from the cache. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache, that gets updates from Discord, in case this one was invalidated.

        This method returns the currently cached entity, or an empty Optional if the entity is not cached any longer, for example because it was deleted or the message was thrown out of the cache.

        Specified by:
        getCurrentCachedInstance in interface Channel
        Specified by:
        getCurrentCachedInstance in interface ServerChannel
        Specified by:
        getCurrentCachedInstance in interface TextChannel
        Specified by:
        getCurrentCachedInstance in interface UpdatableFromCache
        Returns:
        The current cached instance.
      • getLatestInstance

        default java.util.concurrent.CompletableFuture<ServerThreadChannel> getLatestInstance()
        Description copied from interface: Updatable
        Gets an updated instance of this entity from the cache or from Discord directly. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache if present or from Discord directly.

        This method returns the currently cached entity if present, or request the entity from Discord if it is not cached or not permanently cached. If the entity is a fully cached entity and is not in the cache any longer, for example because it was deleted or the message was thrown out of the cache, the CompletableFuture completes exceptionally with a NoSuchElementException. If a request to Discord is made, the according remote call exception will be used to complete the CompletableFuture exceptionally.

        Specified by:
        getLatestInstance in interface Channel
        Specified by:
        getLatestInstance in interface ServerChannel
        Specified by:
        getLatestInstance in interface TextChannel
        Specified by:
        getLatestInstance in interface Updatable
        Specified by:
        getLatestInstance in interface UpdatableFromCache
        Returns:
        The current cached instance.
      • addThreadMember

        default java.util.concurrent.CompletableFuture<java.lang.Void> addThreadMember​(User user)
        Adds a member to this thread.
        Parameters:
        user - The user which should be added.
        Returns:
        A future to check if the update was successful.
      • addThreadMember

        java.util.concurrent.CompletableFuture<java.lang.Void> addThreadMember​(long userId)
        Adds a member to this thread.
        Parameters:
        userId - The user ID which should be added.
        Returns:
        A future to check if the update was successful.
      • removeThreadMember

        default java.util.concurrent.CompletableFuture<java.lang.Void> removeThreadMember​(User user)
        Removes a member to this thread.
        Parameters:
        user - The user which should be removed.
        Returns:
        A future to check if the update was successful.
      • removeThreadMember

        java.util.concurrent.CompletableFuture<java.lang.Void> removeThreadMember​(long userId)
        Removes a member to this thread.
        Parameters:
        userId - The user ID which should be removed.
        Returns:
        A future to check if the update was successful.
      • joinThread

        default java.util.concurrent.CompletableFuture<java.lang.Void> joinThread()
        Joins this ServerThreadChannel.
        Returns:
        A future to check if the update was successful.
      • leaveThread

        default java.util.concurrent.CompletableFuture<java.lang.Void> leaveThread()
        Leaves this ServerThreadChannel.
        Returns:
        A future to check if the update was successful.
      • requestThreadMemberById

        java.util.concurrent.CompletableFuture<ThreadMember> requestThreadMemberById​(long userId)
        Gets a thread member by their id.
        Parameters:
        userId - The id of the user.
        Returns:
        The thread member.
      • requestThreadMemberById

        default java.util.concurrent.CompletableFuture<ThreadMember> requestThreadMemberById​(java.lang.String userId)
        Gets a thread member by their id.
        Parameters:
        userId - The id of the user.
        Returns:
        The thread member.
      • getThreadMembers

        @Deprecated
        default java.util.concurrent.CompletableFuture<java.util.Set<ThreadMember>> getThreadMembers()
        Deprecated.
        Gets all members in this thread. Requires the Intent.GUILD_MEMBERS intent.
        Returns:
        All members in this thread.
      • requestThreadMembers

        java.util.concurrent.CompletableFuture<java.util.Set<ThreadMember>> requestThreadMembers()
        Gets all members in this thread. Requires the Intent.GUILD_MEMBERS intent.
        Returns:
        All members in this thread.