Interface ServerThreadChannel
-
- All Superinterfaces:
Channel,ChannelAttachableListenerManager,ChannelSpecialization,Deletable,DiscordEntity,java.util.Formattable,Mentionable,Messageable,Nameable,ServerChannel,ServerChannelAttachableListenerManager,ServerThreadChannelAttachableListenerManager,Specializable<ChannelSpecialization>,TextChannel,TextChannelAttachableListenerManager,Updatable,UpdatableFromCache
public interface ServerThreadChannel extends ServerChannel, TextChannel, Mentionable, ServerThreadChannelAttachableListenerManager
This class represents a channel thread.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>addThreadMember(long userId)Adds a member to this thread.default java.util.concurrent.CompletableFuture<java.lang.Void>addThreadMember(User user)Adds a member to this thread.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 booleancanSee(User user)Checks if the given user can see 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 ServerThreadChannelUpdatercreateUpdater()Creates an updater for this thread.default java.util.Optional<ServerThreadChannel>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.longgetLastMessageId()Gets the id of the last message sent in this thread.default java.util.concurrent.CompletableFuture<ServerThreadChannel>getLatestInstance()Gets an updated instance of this entity from the cache or from Discord directly.intgetMemberCount()Gets an approximate count of users in this thread that stops counting at 50.java.util.Set<ThreadMember>getMembers()Gets all members of the thread.intgetMessageCount()Gets an approximate count of messages in this thread that stops counting at 50.ThreadMetadatagetMetadata()Gets the extra data about this thread.longgetOwnerId()Gets the id of the creator of the tread.RegularServerChannelgetParent()The parent regular server channel of this thread.intgetRateLimitPerUser()Gets the amount of seconds a user has to wait before sending another message (0-21600).default java.util.concurrent.CompletableFuture<java.util.Set<ThreadMember>>getThreadMembers()Deprecated.UserequestThreadMembers()instead.intgetTotalNumberOfMessagesSent()Gets the total number of messages ever sent in this thread.default booleanisPrivate()Whether this thread is private.default booleanisPublic()Whether this thread is private.default java.util.concurrent.CompletableFuture<java.lang.Void>joinThread()Joins this ServerThreadChannel.default java.util.concurrent.CompletableFuture<java.lang.Void>leaveThread()Leaves this ServerThreadChannel.java.util.concurrent.CompletableFuture<java.lang.Void>removeThreadMember(long userId)Removes a member to this thread.default java.util.concurrent.CompletableFuture<java.lang.Void>removeThreadMember(User user)Removes a member to this thread.default java.util.concurrent.CompletableFuture<User>requestOwner()Gets the creator of the thread.java.util.concurrent.CompletableFuture<ThreadMember>requestThreadMemberById(long userId)Gets a thread member by their id.default java.util.concurrent.CompletableFuture<ThreadMember>requestThreadMemberById(java.lang.String userId)Gets a thread member by their id.java.util.concurrent.CompletableFuture<java.util.Set<ThreadMember>>requestThreadMembers()Gets all members in this thread.-
Methods inherited from interface org.javacord.api.entity.channel.Channel
asCategorizable, asChannelCategory, asPrivateChannel, asRegularServerChannel, asServerChannel, asServerForumChannel, asServerStageVoiceChannel, asServerTextChannel, asServerThreadChannel, asServerVoiceChannel, asTextableRegularServerChannel, asTextChannel, asVoiceChannel, canYouSee, getType
-
Methods inherited from interface org.javacord.api.listener.channel.ChannelAttachableListenerManager
addChannelAttachableListener, getChannelAttachableListeners, removeChannelAttachableListener, removeListener
-
Methods inherited from interface org.javacord.api.entity.Deletable
delete, delete, deleteAfter, deleteAfter, deleteAfter, deleteAfter, getApi
-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getApi, getCreationTimestamp, getId, getIdAsString
-
Methods inherited from interface org.javacord.api.entity.Mentionable
getMentionTag
-
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.entity.channel.ServerChannel
createInviteBuilder, getInvites, getServer, updateName
-
Methods inherited from interface org.javacord.api.listener.channel.server.ServerChannelAttachableListenerManager
addServerChannelAttachableListener, addServerChannelChangeNameListener, addServerChannelChangeOverwrittenPermissionsListener, addServerChannelChangePositionListener, addServerChannelDeleteListener, addVoiceStateUpdateListener, getServerChannelAttachableListeners, getServerChannelChangeNameListeners, getServerChannelChangeOverwrittenPermissionsListeners, getServerChannelChangePositionListeners, getServerChannelDeleteListeners, getVoiceStateUpdateListeners, removeListener, removeServerChannelAttachableListener
-
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
-
-
-
-
Method Detail
-
canSee
default boolean canSee(User user)
Description copied from interface:ChannelChecks if the given user can see this channel. In private channels this always returnstrueif the user is part of the chat.
-
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.
-
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 togetMessageCount()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: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 interfaceServerChannel- Specified by:
getCurrentCachedInstancein interfaceTextChannel- Specified by:
getCurrentCachedInstancein interfaceUpdatableFromCache- Returns:
- The current cached instance.
-
getLatestInstance
default java.util.concurrent.CompletableFuture<ServerThreadChannel> 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 interfaceServerChannel- Specified by:
getLatestInstancein interfaceTextChannel- Specified by:
getLatestInstancein interfaceUpdatable- Specified by:
getLatestInstancein interfaceUpdatableFromCache- 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.UserequestThreadMembers()instead.Gets all members in this thread. Requires theIntent.GUILD_MEMBERSintent.- Returns:
- All members in this thread.
-
requestThreadMembers
java.util.concurrent.CompletableFuture<java.util.Set<ThreadMember>> requestThreadMembers()
Gets all members in this thread. Requires theIntent.GUILD_MEMBERSintent.- Returns:
- All members in this thread.
-
createUpdater
default ServerThreadChannelUpdater createUpdater()
Creates an updater for this thread.- Specified by:
createUpdaterin interfaceServerChannel- Returns:
- An updater for this thread.
-
-