Interface ServerThreadChannel
-
- All Superinterfaces:
Channel,ChannelAttachableListenerManager,ChannelSpecialization,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 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 ServerThreadChannelUpdatercreateUpdater()Creates an updater for this thread.java.time.InstantgetArchiveTimestamp()Gets the timestamp when the thread's archive status was last changed, used for calculating recent activity.intgetAutoArchiveDuration()Gets the duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080.default java.util.Optional<ServerThreadChannel>getCurrentCachedInstance()Gets an updated instance of this entity from the cache.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.List<ThreadMember>getMembers()List of the members of the thread.intgetMessageCount()Gets an approximate count of messages in this thread that stops counting at 50.longgetOwnerId()Gets the id of the creator of the tread.RegularServerChannelgetParent()The parent regular server channel of this thread.java.util.concurrent.CompletableFuture<java.util.List<ThreadMember>>getThreadMembers()Gets a list of all members in this thread.booleanisArchived()Whether this thread is archived.booleanisLocked()Whether this thread is locked.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.-
Methods inherited from interface org.javacord.api.entity.channel.Channel
asCategorizable, asChannelCategory, asPrivateChannel, asRegularServerChannel, asServerChannel, asServerForumChannel, asServerStageVoiceChannel, asServerTextChannel, asServerThreadChannel, asServerVoiceChannel, asTextChannel, asVoiceChannel, canSee, canYouSee, getType
-
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.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
-
Methods inherited from interface org.javacord.api.entity.channel.ServerChannel
createInviteBuilder, delete, delete, 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
addServerThreadChannelAttachableListener, addServerThreadChannelCreateListener, addServerThreadChannelDeleteListener, addServerThreadChannelMembersUpdateListener, addServerThreadChannelUpdateListener, getServerThreadChannelAttachableListeners, 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, canAddNewReactions, canAttachFiles, canEmbedLinks, canManageMessages, canMentionEveryone, canReadMessageHistory, canRemoveReactionsOfOthers, canUseExternalEmojis, canUseTts, canWrite, 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, addModalSubmitListener, addReactionAddListener, addReactionRemoveAllListener, addReactionRemoveListener, addSelectMenuChooseListener, addSlashCommandCreateListener, addTextChannelAttachableListener, addUserContextMenuCommandListener, addUserStartTypingListener, getAutocompleteCreateListeners, getButtonClickListeners, getCachedMessagePinListeners, getCachedMessageUnpinListeners, getChannelPinsUpdateListeners, getInteractionCreateListeners, getMessageComponentCreateListeners, getMessageContextMenuCommandListeners, getMessageCreateListeners, getMessageDeleteListeners, getMessageEditListeners, getModalSubmitListeners, getReactionAddListeners, getReactionRemoveAllListeners, getReactionRemoveListeners, getSelectMenuChooseListeners, getSlashCommandCreateListeners, getTextChannelAttachableListeners, getUserContextMenuCommandListeners, getUserStartTypingListeners, removeListener, removeTextChannelAttachableListener
-
-
-
-
Method Detail
-
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.
-
getAutoArchiveDuration
int getAutoArchiveDuration()
Gets the duration for newly created threads, in minutes, to automatically archive the thread after recent activity, can be set to: 60, 1440, 4320, 10080.- Returns:
- The duration for newly created threads.
-
isArchived
boolean isArchived()
Whether this thread is archived.- Returns:
- Whether this thread is archived.
-
isLocked
boolean isLocked()
Whether this thread is locked. When a thread is locked, only users with MANAGE_THREADS can unarchive it.- Returns:
- Whether this thread is locked.
-
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.
-
getArchiveTimestamp
java.time.Instant getArchiveTimestamp()
Gets the timestamp when the thread's archive status was last changed, used for calculating recent activity.- Returns:
- The timestamp when the thread's archive status was last changed.
-
getMembers
java.util.List<ThreadMember> getMembers()
List of the 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.
-
getThreadMembers
java.util.concurrent.CompletableFuture<java.util.List<ThreadMember>> getThreadMembers()
Gets a list of all members in this thread. Requires theIntent.GUILD_MEMBERSintent.- Returns:
- a list of 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.
-
-