Interface ServerTextChannel

    • Method Detail

      • getMentionTag

        default java.lang.String getMentionTag()
        Description copied from interface: Mentionable
        Gets the tag used to mention the entity.
        Specified by:
        getMentionTag in interface Mentionable
        Returns:
        The tag used to mention the entity.
      • getDefaultAutoArchiveDuration

        int getDefaultAutoArchiveDuration()
        Gets the default auto archive duration for threads that will be created in this channel.
        Returns:
        The default auto archive duration for this channel.
      • isNsfw

        boolean isNsfw()
        Checks is the channel is "not safe for work".
        Returns:
        Whether the channel is "not safe for work" or not.
      • getTopic

        java.lang.String getTopic()
        Gets the topic of the channel.
        Returns:
        The topic of the channel.
      • createWebhookBuilder

        default WebhookBuilder createWebhookBuilder()
        Creates a webhook builder for this channel.
        Returns:
        A webhook builder.
      • updateTopic

        default java.util.concurrent.CompletableFuture<java.lang.Void> updateTopic​(java.lang.String topic)
        Updates the topic of the channel.

        If you want to update several settings at once, it's recommended to use the ServerTextChannelUpdater from createUpdater() which provides a better performance!

        Parameters:
        topic - The new topic of the channel.
        Returns:
        A future to check if the update was successful.
      • updateNsfwFlag

        default java.util.concurrent.CompletableFuture<java.lang.Void> updateNsfwFlag​(boolean nsfw)
        Updates the nsfw flag of the channel.

        If you want to update several settings at once, it's recommended to use the ServerTextChannelUpdater from createUpdater() which provides a better performance!

        Parameters:
        nsfw - The new nsfw flag of the channel.
        Returns:
        A future to check if the update was successful.
      • updateCategory

        default java.util.concurrent.CompletableFuture<java.lang.Void> updateCategory​(ChannelCategory category)
        Updates the category of the channel.

        If you want to update several settings at once, it's recommended to use the ServerTextChannelUpdater from createUpdater() which provides a better performance!

        Specified by:
        updateCategory in interface Categorizable
        Parameters:
        category - The new category of the channel.
        Returns:
        A future to check if the update was successful.
      • removeCategory

        default java.util.concurrent.CompletableFuture<java.lang.Void> removeCategory()
        Removes the category of the channel.

        If you want to update several settings at once, it's recommended to use the ServerTextChannelUpdater from createUpdater() which provides a better performance!

        Specified by:
        removeCategory in interface Categorizable
        Returns:
        A future to check if the update was successful.
      • getSlowmodeDelayInSeconds

        int getSlowmodeDelayInSeconds()
        Gets the delay for slowmode.
        Returns:
        The delay in seconds.
      • hasSlowmode

        default boolean hasSlowmode()
        Check whether slowmode is activated for this channel.
        Returns:
        Whether this channel enforces a slowmode.
      • updateSlowmodeDelayInSeconds

        default java.util.concurrent.CompletableFuture<java.lang.Void> updateSlowmodeDelayInSeconds​(int delay)
        Set a slowmode for this channel.

        If you want to update several settings at once, it's recommended to use the ServerTextChannelUpdater from createUpdater() which provides a better performance!

        Parameters:
        delay - The slowmode delay in seconds.
        Returns:
        A future to check if the update was successful.
      • unsetSlowmode

        default java.util.concurrent.CompletableFuture<java.lang.Void> unsetSlowmode()
        Deactivate slowmode for this channel.

        If you want to update several settings at once, it's recommended to use the ServerTextChannelUpdater from createUpdater() which provides a better performance!

        Returns:
        A future to check if the update was successful.
      • getCurrentCachedInstance

        default java.util.Optional<ServerTextChannel> 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 RegularServerChannel
        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<ServerTextChannel> 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 RegularServerChannel
        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.
      • createThreadForMessage

        default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThreadForMessage​(Message message,
                                                                                                   java.lang.String name,
                                                                                                   AutoArchiveDuration autoArchiveDuration)
        Creates a thread for a message in this ServerTextChannel.
        Parameters:
        message - The message to create the thread for.
        name - The Thread name.
        autoArchiveDuration - Duration in minutes to automatically archive the thread after recent activity.
        Returns:
        The created ServerThreadChannel.
      • createThreadForMessage

        default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThreadForMessage​(Message message,
                                                                                                   java.lang.String name,
                                                                                                   java.lang.Integer autoArchiveDuration)
        Creates a thread for a message in this ServerTextChannel.
        Parameters:
        message - The message to create the thread for.
        name - The Thread name.
        autoArchiveDuration - Duration in minutes to automatically archive the thread after recent activity.
        Returns:
        The created ServerThreadChannel.
      • createThread

        default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThread​(ChannelType channelType,
                                                                                         java.lang.String name,
                                                                                         java.lang.Integer autoArchiveDuration)
        Creates a thread which is not related to a message.

        Creating a private thread requires the server to be boosted. The 3 day and 7 day archive durations require the server to be boosted. The server features will indicate if that is possible for the server.

        Parameters:
        channelType - A ChannelType for a thread.
        name - The thread name.
        autoArchiveDuration - Duration in minutes to automatically archive the thread after recent activity.
        Returns:
        The created ServerThreadChannel.
      • createThread

        default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThread​(ChannelType channelType,
                                                                                         java.lang.String name,
                                                                                         AutoArchiveDuration autoArchiveDuration)
        Creates a thread which is not related to a message.

        Creating a private thread requires the server to be boosted. The 3 day and 7 day archive durations require the server to be boosted. The server features will indicate if that is possible for the server.

        Parameters:
        channelType - A ChannelType for a thread.
        name - The thread name.
        autoArchiveDuration - Duration in minutes to automatically archive the thread after recent activity.
        Returns:
        The created ServerThreadChannel.
      • createThread

        default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThread​(ChannelType channelType,
                                                                                         java.lang.String name,
                                                                                         java.lang.Integer autoArchiveDuration,
                                                                                         java.lang.Boolean inviteable)
        Creates a thread which is not related to a message.

        Creating a private thread requires the server to be boosted. The 3 day and 7 day archive durations require the server to be boosted. The server features will indicate if that is possible for the server.

        Parameters:
        channelType - A ChannelType for a thread.
        name - The thread name.
        autoArchiveDuration - Duration in minutes to automatically archive the thread after recent activity.
        inviteable - Whether non-moderators can add other non-moderators to a thread; only available when creating a private thread.
        Returns:
        The created ServerThreadChannel.
      • createThread

        default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThread​(ChannelType channelType,
                                                                                         java.lang.String name,
                                                                                         AutoArchiveDuration autoArchiveDuration,
                                                                                         java.lang.Boolean inviteable)
        Creates a thread which is not related to a message.

        Creating a private thread requires the server to be boosted. The 3 day and 7 day archive durations require the server to be boosted. The server features will indicate if that is possible for the server.

        Parameters:
        channelType - A ChannelType for a thread.
        name - The thread name.
        autoArchiveDuration - Duration in minutes to automatically archive the thread after recent activity.
        inviteable - Whether non-moderators can add other non-moderators to a thread; only available when creating a private thread.
        Returns:
        The created ServerThreadChannel.
      • getPublicArchivedThreads

        default java.util.concurrent.CompletableFuture<ArchivedThreads> getPublicArchivedThreads()
        Gets the public archived threads.

        Returns archived threads in the channel that are public. When called on a SERVER_TEXT_CHANNEL, returns threads of type SERVER_PUBLIC_THREAD. When called on a SERVER_NEWS_CHANNEL returns threads of type SERVER_NEWS_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires the READ_MESSAGE_HISTORY permission.

        Returns:
        The ArchivedThreads.
      • getPublicArchivedThreads

        default java.util.concurrent.CompletableFuture<ArchivedThreads> getPublicArchivedThreads​(long before)
        Gets the public archived threads.

        Returns archived threads in the channel that are public. When called on a SERVER_TEXT_CHANNEL, returns threads of type SERVER_PUBLIC_THREAD. When called on a SERVER_NEWS_CHANNEL returns threads of type SERVER_NEWS_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires the READ_MESSAGE_HISTORY permission.

        Parameters:
        before - Get public archived threads before the thread with this id.
        Returns:
        The ArchivedThreads.
      • getPublicArchivedThreads

        default java.util.concurrent.CompletableFuture<ArchivedThreads> getPublicArchivedThreads​(int limit)
        Gets the public archived threads.

        Returns archived threads in the channel that are public. When called on a SERVER_TEXT_CHANNEL, returns threads of type SERVER_PUBLIC_THREAD. When called on a SERVER_NEWS_CHANNEL returns threads of type SERVER_NEWS_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires the READ_MESSAGE_HISTORY permission.

        Parameters:
        limit - The maximum amount of public archived threads.
        Returns:
        The ArchivedThreads.
      • getPublicArchivedThreads

        java.util.concurrent.CompletableFuture<ArchivedThreads> getPublicArchivedThreads​(java.lang.Long before,
                                                                                         java.lang.Integer limit)
        Gets the public archived threads.

        Returns archived threads in the channel that are public. When called on a SERVER_TEXT_CHANNEL, returns threads of type SERVER_PUBLIC_THREAD. When called on a SERVER_NEWS_CHANNEL returns threads of type SERVER_NEWS_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires the READ_MESSAGE_HISTORY permission.

        Parameters:
        before - Get public archived threads before the thread with this id.
        limit - The maximum amount of public archived threads.
        Returns:
        The ArchivedThreads.
      • getPrivateArchivedThreads

        default java.util.concurrent.CompletableFuture<ArchivedThreads> getPrivateArchivedThreads()
        Gets the private archived threads.

        Returns archived threads in the channel that are of type SERVER_PRIVATE_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.

        Returns:
        The ArchivedThreads.
      • getPrivateArchivedThreads

        default java.util.concurrent.CompletableFuture<ArchivedThreads> getPrivateArchivedThreads​(long before)
        Gets the private archived threads.

        Returns archived threads in the channel that are of type SERVER_PRIVATE_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.

        Parameters:
        before - Get private archived threads before the thread with this id.
        Returns:
        The ArchivedThreads.
      • getPrivateArchivedThreads

        default java.util.concurrent.CompletableFuture<ArchivedThreads> getPrivateArchivedThreads​(int limit)
        Gets the private archived threads.

        Returns archived threads in the channel that are of type SERVER_PRIVATE_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.

        Parameters:
        limit - The maximum amount of private archived threads.
        Returns:
        The ArchivedThreads.
      • getPrivateArchivedThreads

        java.util.concurrent.CompletableFuture<ArchivedThreads> getPrivateArchivedThreads​(java.lang.Long before,
                                                                                          java.lang.Integer limit)
        Gets the private archived threads.

        Returns archived threads in the channel that are of type SERVER_PRIVATE_THREAD. Threads are ordered by archive_timestamp, in descending order. Requires both the READ_MESSAGE_HISTORY and MANAGE_THREADS permissions.

        Parameters:
        before - Get private archived threads before the thread with this id.
        limit - The maximum amount of private archived threads.
        Returns:
        The ArchivedThreads.
      • getJoinedPrivateArchivedThreads

        default java.util.concurrent.CompletableFuture<ArchivedThreads> getJoinedPrivateArchivedThreads()
        Gets the joined private archived threads.

        Returns archived threads in the channel that are of type SERVER_PRIVATE_THREAD, and the user has joined.

        Returns:
        The ArchivedThreads.
      • getJoinedPrivateArchivedThreads

        default java.util.concurrent.CompletableFuture<ArchivedThreads> getJoinedPrivateArchivedThreads​(long before)
        Gets the joined private archived threads.

        Returns archived threads in the channel that are of type SERVER_PRIVATE_THREAD, and the user has joined.

        Parameters:
        before - Get the joined private archived threads before the thread with this id.
        Returns:
        The ArchivedThreads.
      • getJoinedPrivateArchivedThreads

        default java.util.concurrent.CompletableFuture<ArchivedThreads> getJoinedPrivateArchivedThreads​(int limit)
        Gets the joined private archived threads.

        Returns archived threads in the channel that are of type SERVER_PRIVATE_THREAD, and the user has joined.

        Parameters:
        limit - The maximum amount of private archived threads.
        Returns:
        The ArchivedThreads.
      • getJoinedPrivateArchivedThreads

        java.util.concurrent.CompletableFuture<ArchivedThreads> getJoinedPrivateArchivedThreads​(java.lang.Long before,
                                                                                                java.lang.Integer limit)
        Gets the joined private archived threads.

        Returns archived threads in the channel that are of type SERVER_PRIVATE_THREAD, and the user has joined.

        Parameters:
        before - Get the joined private archived threads before the thread with this id.
        limit - The maximum amount of private archived threads.
        Returns:
        The ArchivedThreads.