Interface PrivateChannel

    • Method Detail

      • 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.
      • 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.
      • getRecipient

        java.util.Optional<User> getRecipient()
        Gets the recipient of the private channel. A private channel always consists of yourself and one other user. The user may be missing as discord doesn't always send the required information.
        Returns:
        The recipient of the private channel.
      • getRecipientId

        java.util.Optional<java.lang.Long> getRecipientId()
        Gets the id of the recipient of the private channel. A private channel always consists of yourself and one other user. The id may be missing as discord doesn't always send the required information.
        Returns:
        The id of the recipient of the private channel.
      • getCurrentCachedInstance

        default java.util.Optional<PrivateChannel> 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 TextChannel
        Specified by:
        getCurrentCachedInstance in interface UpdatableFromCache
        Specified by:
        getCurrentCachedInstance in interface VoiceChannel
        Returns:
        The current cached instance.
      • getLatestInstance

        default java.util.concurrent.CompletableFuture<PrivateChannel> 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 TextChannel
        Specified by:
        getLatestInstance in interface Updatable
        Specified by:
        getLatestInstance in interface UpdatableFromCache
        Specified by:
        getLatestInstance in interface VoiceChannel
        Returns:
        The current cached instance.