Package org.javacord.api.entity.channel
Interface PrivateChannel
-
- All Superinterfaces:
Channel,ChannelAttachableListenerManager,ChannelSpecialization,DiscordEntity,Messageable,PrivateChannelAttachableListenerManager,ServerThreadChannelAttachableListenerManager,Specializable<ChannelSpecialization>,TextChannel,TextChannelAttachableListenerManager,Updatable,UpdatableFromCache,VoiceChannel,VoiceChannelAttachableListenerManager
public interface PrivateChannel extends TextChannel, VoiceChannel, PrivateChannelAttachableListenerManager
This class represents a private channel. Every conversation between two users takes place in a private channel.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancanAddNewReactions(User user)Checks if the given user is allowed to add new reactions to messages in this channel.default booleancanAttachFiles(User user)Checks if the given user can attach files in this channel.default booleancanEmbedLinks(User user)Checks if the given user can use embed links in this channel.default booleancanManageMessages(User user)Checks if the given user can manage messages (delete or pin them or remove reactions of others) in this channel.default booleancanMentionEveryone(User user)Checks if the given user can mention everyone (@everyone) in this channel.default booleancanReadMessageHistory(User user)Checks if the given user can read the message history of this channel.default booleancanUseExternalEmojis(User user)Checks if the given user can use external emojis in this channel.default booleancanUseTts(User user)Checks if the given user can use tts (text to speech) in this channel.default booleancanWrite(User user)Checks if the given user can send messages in this channel.default java.util.Optional<PrivateChannel>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.default java.util.concurrent.CompletableFuture<PrivateChannel>getLatestInstance()Gets an updated instance of this entity from the cache or from Discord directly.java.util.Optional<User>getRecipient()Gets the recipient of the private channel.java.util.Optional<java.lang.Long>getRecipientId()Gets the id of the recipient of the private channel.default ChannelTypegetType()Gets the type of the channel.-
Methods inherited from interface org.javacord.api.entity.channel.Channel
asCategorizable, asChannelCategory, asPrivateChannel, asRegularServerChannel, asServerChannel, asServerForumChannel, asServerStageVoiceChannel, asServerTextChannel, asServerThreadChannel, asServerVoiceChannel, asTextableRegularServerChannel, asTextChannel, asVoiceChannel, canSee, canYouSee
-
Methods inherited from interface org.javacord.api.listener.channel.ChannelAttachableListenerManager
addChannelAttachableListener, getChannelAttachableListeners, removeChannelAttachableListener, removeListener
-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getApi, getCreationTimestamp, getId, getIdAsString
-
Methods inherited from interface org.javacord.api.entity.message.Messageable
sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage
-
Methods inherited from interface org.javacord.api.listener.channel.user.PrivateChannelAttachableListenerManager
addPrivateChannelAttachableListener, addPrivateChannelDeleteListener, getPrivateChannelAttachableListeners, getPrivateChannelDeleteListeners, removeListener, removePrivateChannelAttachableListener
-
Methods inherited from interface org.javacord.api.listener.channel.ServerThreadChannelAttachableListenerManager
addServerPrivateThreadJoinListener, addServerThreadChannelAttachableListener, addServerThreadChannelChangeArchivedListener, addServerThreadChannelChangeArchiveTimestampListener, addServerThreadChannelChangeAutoArchiveDurationListener, addServerThreadChannelChangeInvitableListener, addServerThreadChannelChangeLastMessageIdListener, addServerThreadChannelChangeLockedListener, addServerThreadChannelChangeMemberCountListener, addServerThreadChannelChangeMessageCountListener, addServerThreadChannelChangeRateLimitPerUserListener, addServerThreadChannelChangeTotalMessageSentListener, addServerThreadChannelCreateListener, addServerThreadChannelDeleteListener, addServerThreadChannelMembersUpdateListener, addServerThreadChannelUpdateListener, getServerPrivateThreadJoinListeners, getServerThreadChannelAttachableListeners, getServerThreadChannelChangeArchivedListeners, getServerThreadChannelChangeArchiveTimestampListeners, getServerThreadChannelChangeAutoArchiveDurationListeners, getServerThreadChannelChangeInvitableListeners, getServerThreadChannelChangeLastMessageIdListeners, getServerThreadChannelChangeLockedListeners, getServerThreadChannelChangeMemberCountListeners, getServerThreadChannelChangeMessageCountListeners, getServerThreadChannelChangeRateLimitPerUserListeners, getServerThreadChannelChangeTotalMessageSentListeners, getServerThreadChannelCreateListeners, getServerThreadChannelDeleteListeners, getServerThreadChannelMembersUpdateListeners, getServerThreadChannelUpdateListeners, removeListener, removeServerThreadChannelAttachableListener
-
Methods inherited from interface org.javacord.api.util.Specializable
as
-
Methods inherited from interface org.javacord.api.entity.channel.TextChannel
bulkDelete, bulkDelete, bulkDelete, bulkDelete, canRemoveReactionsOfOthers, canYouAddNewReactions, canYouAttachFiles, canYouEmbedLinks, canYouManageMessages, canYouMentionEveryone, canYouReadMessageHistory, canYouRemoveReactionsOfOthers, canYouUseExternalEmojis, canYouUseTts, canYouWrite, deleteMessages, deleteMessages, deleteMessages, deleteMessages, getAllIncomingWebhooks, getIncomingWebhooks, getMessageById, getMessageById, getMessageCache, getMessages, getMessagesAfter, getMessagesAfter, getMessagesAfterAsStream, getMessagesAfterAsStream, getMessagesAfterUntil, getMessagesAfterUntil, getMessagesAfterWhile, getMessagesAfterWhile, getMessagesAround, getMessagesAround, getMessagesAroundAsStream, getMessagesAroundAsStream, getMessagesAroundUntil, getMessagesAroundUntil, getMessagesAroundWhile, getMessagesAroundWhile, getMessagesAsStream, getMessagesBefore, getMessagesBefore, getMessagesBeforeAsStream, getMessagesBeforeAsStream, getMessagesBeforeUntil, getMessagesBeforeUntil, getMessagesBeforeWhile, getMessagesBeforeWhile, getMessagesBetween, getMessagesBetween, getMessagesBetweenAsStream, getMessagesBetweenAsStream, getMessagesBetweenUntil, getMessagesBetweenUntil, getMessagesBetweenWhile, getMessagesBetweenWhile, getMessagesUntil, getMessagesWhile, getPins, getWebhooks, type, typeContinuously, typeContinuously, typeContinuouslyAfter, typeContinuouslyAfter
-
Methods inherited from interface org.javacord.api.listener.channel.TextChannelAttachableListenerManager
addAutocompleteCreateListener, addButtonClickListener, addCachedMessagePinListener, addCachedMessageUnpinListener, addChannelPinsUpdateListener, addInteractionCreateListener, addMessageComponentCreateListener, addMessageContextMenuCommandListener, addMessageCreateListener, addMessageDeleteListener, addMessageEditListener, addMessageReplyListener, addModalSubmitListener, addReactionAddListener, addReactionRemoveAllListener, addReactionRemoveListener, addSelectMenuChooseListener, addSlashCommandCreateListener, addTextChannelAttachableListener, addUserContextMenuCommandListener, addUserStartTypingListener, getAutocompleteCreateListeners, getButtonClickListeners, getCachedMessagePinListeners, getCachedMessageUnpinListeners, getChannelPinsUpdateListeners, getInteractionCreateListeners, getMessageComponentCreateListeners, getMessageContextMenuCommandListeners, getMessageCreateListeners, getMessageDeleteListeners, getMessageEditListeners, getMessageReplyListeners, getModalSubmitListeners, getReactionAddListeners, getReactionRemoveAllListeners, getReactionRemoveListeners, getSelectMenuChooseListeners, getSlashCommandCreateListeners, getTextChannelAttachableListeners, getUserContextMenuCommandListeners, getUserStartTypingListeners, removeListener, removeTextChannelAttachableListener
-
Methods inherited from interface org.javacord.api.listener.channel.VoiceChannelAttachableListenerManager
addVoiceChannelAttachableListener, getVoiceChannelAttachableListeners, removeListener, removeVoiceChannelAttachableListener
-
-
-
-
Method Detail
-
canWrite
default boolean canWrite(User user)
Description copied from interface:TextChannelChecks if the given user can send messages in this channel. In private channels this always returnstrueif the user is part of the chat. Please notice, this does not check if a user has blocked private messages!- Specified by:
canWritein interfaceTextChannel- 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:TextChannelChecks if the given user can use external emojis in this channel. In private channels this always returnstrueif 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:
canUseExternalEmojisin interfaceTextChannel- 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:TextChannelChecks if the given user can use embed links in this channel. In private channels this always returnstrueif the user is part of the chat. Please notice, this does not check if a user has blocked private messages!- Specified by:
canEmbedLinksin interfaceTextChannel- 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:TextChannelChecks if the given user can read the message history of this channel. In private channels this always returnstrueif the user is part of the chat.- Specified by:
canReadMessageHistoryin interfaceTextChannel- 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:TextChannelChecks if the given user can use tts (text to speech) in this channel. In private channels this always returnstrueif the user is part of the chat. Please notice, this does not check if a user has blocked private messages!- Specified by:
canUseTtsin interfaceTextChannel- 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:TextChannelChecks if the given user can attach files in this channel.- Specified by:
canAttachFilesin interfaceTextChannel- 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:TextChannelChecks if the given user is allowed to add new reactions to messages in this channel.- Specified by:
canAddNewReactionsin interfaceTextChannel- 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:TextChannelChecks if the given user can manage messages (delete or pin them or remove reactions of others) in this channel. In private channels this always returnstrueif the user is part of the chat.- Specified by:
canManageMessagesin interfaceTextChannel- 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:TextChannelChecks if the given user can mention everyone (@everyone) in this channel. In private channels this always returnstrueif the user is part of the chat.- Specified by:
canMentionEveryonein interfaceTextChannel- 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:ChannelGets 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:UpdatableFromCacheGets 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
Optionalif the entity is not cached any longer, for example because it was deleted or the message was thrown out of the cache.- Specified by:
getCurrentCachedInstancein interfaceChannel- Specified by:
getCurrentCachedInstancein interfaceTextChannel- Specified by:
getCurrentCachedInstancein interfaceUpdatableFromCache- Specified by:
getCurrentCachedInstancein interfaceVoiceChannel- Returns:
- The current cached instance.
-
getLatestInstance
default java.util.concurrent.CompletableFuture<PrivateChannel> getLatestInstance()
Description copied from interface:UpdatableGets 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
CompletableFuturecompletes exceptionally with aNoSuchElementException. If a request to Discord is made, the according remote call exception will be used to complete theCompletableFutureexceptionally.- Specified by:
getLatestInstancein interfaceChannel- Specified by:
getLatestInstancein interfaceTextChannel- Specified by:
getLatestInstancein interfaceUpdatable- Specified by:
getLatestInstancein interfaceUpdatableFromCache- Specified by:
getLatestInstancein interfaceVoiceChannel- Returns:
- The current cached instance.
-
-