Interface ServerThreadChannel

    • Method Detail

      • canSee

        default boolean canSee​(User user)
        Description copied from interface: Channel
        Checks if the given user can see this channel. In private channels this always returns true if the user is part of the chat.
        Specified by:
        canSee in interface Channel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can see this channel or not.
      • canWrite

        default boolean canWrite​(User user)
        Description copied from interface: TextChannel
        Checks if the given user can send messages in this channel. In private channels this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages!
        Specified by:
        canWrite in interface TextChannel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can write messages or not.
      • canUseExternalEmojis

        default boolean canUseExternalEmojis​(User user)
        Description copied from interface: TextChannel
        Checks if the given user can use external emojis in this channel. In private channels this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages! It also doesn't check if the user is even able to send any external emojis (twitch subscription or nitro).
        Specified by:
        canUseExternalEmojis in interface TextChannel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can use external emojis or not.
      • canEmbedLinks

        default boolean canEmbedLinks​(User user)
        Description copied from interface: TextChannel
        Checks if the given user can use embed links in this channel. In private channels this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages!
        Specified by:
        canEmbedLinks in interface TextChannel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can embed links or not.
      • canReadMessageHistory

        default boolean canReadMessageHistory​(User user)
        Description copied from interface: TextChannel
        Checks if the given user can read the message history of this channel. In private channels this always returns true if the user is part of the chat.
        Specified by:
        canReadMessageHistory in interface TextChannel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can read the message history or not.
      • canUseTts

        default boolean canUseTts​(User user)
        Description copied from interface: TextChannel
        Checks if the given user can use tts (text to speech) in this channel. In private channels this always returns true if the user is part of the chat. Please notice, this does not check if a user has blocked private messages!
        Specified by:
        canUseTts in interface TextChannel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can use tts or not.
      • canAttachFiles

        default boolean canAttachFiles​(User user)
        Description copied from interface: TextChannel
        Checks if the given user can attach files in this channel.
        Specified by:
        canAttachFiles in interface TextChannel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can attach files or not.
      • canAddNewReactions

        default boolean canAddNewReactions​(User user)
        Description copied from interface: TextChannel
        Checks if the given user is allowed to add new reactions to messages in this channel.
        Specified by:
        canAddNewReactions in interface TextChannel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user is allowed to add new reactions to messages in this channel or not.
      • canManageMessages

        default boolean canManageMessages​(User user)
        Description copied from interface: TextChannel
        Checks if the given user can manage messages (delete or pin them or remove reactions of others) in this channel. In private channels this always returns true if the user is part of the chat.
        Specified by:
        canManageMessages in interface TextChannel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can manage messages or not.
      • canMentionEveryone

        default boolean canMentionEveryone​(User user)
        Description copied from interface: TextChannel
        Checks if the given user can mention everyone (@everyone) in this channel. In private channels this always returns true if the user is part of the chat.
        Specified by:
        canMentionEveryone in interface TextChannel
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can mention everyone (@everyone) or not.
      • 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.