Interface ServerTextChannel

    • Method Detail

      • getType

        default ChannelType getType​()
        Description copied from interface: Channel
        Gets the type of the channel.
        Specified by:
        getType in interface Channel
        Returns:
        The type of the 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

        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 CompletableFuture<Void> updateTopic​(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 CompletableFuture<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.
      • 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 CompletableFuture<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 CompletableFuture<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 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 ServerChannel
        Specified by:
        getCurrentCachedInstance in interface TextChannel
        Specified by:
        getCurrentCachedInstance in interface UpdatableFromCache
        Returns:
        The current cached instance.
      • getLatestInstance

        default 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 ServerChannel
        Specified by:
        getLatestInstance in interface TextChannel
        Specified by:
        getLatestInstance in interface Updatable<T extends DiscordEntity>
        Specified by:
        getLatestInstance in interface UpdatableFromCache
        Returns:
        The current cached instance.