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 ServerThreadChannelUpdater
createUpdater()
Creates an updater for this thread.default java.util.Optional<ServerThreadChannel>
getCurrentCachedInstance()
Gets an updated instance of this entity from the cache.long
getLastMessageId()
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.int
getMemberCount()
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.int
getMessageCount()
Gets an approximate count of messages in this thread that stops counting at 50.ThreadMetadata
getMetadata()
Gets the extra data about this thread.long
getOwnerId()
Gets the id of the creator of the tread.RegularServerChannel
getParent()
The parent regular server channel of this thread.int
getRateLimitPerUser()
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.int
getTotalNumberOfMessagesSent()
Gets the total number of messages ever sent in this thread.default boolean
isPrivate()
Whether this thread is private.default boolean
isPublic()
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, 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.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, 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, 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
-
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: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 interfaceChannel
- Specified by:
getCurrentCachedInstance
in interfaceServerChannel
- Specified by:
getCurrentCachedInstance
in interfaceTextChannel
- Specified by:
getCurrentCachedInstance
in interfaceUpdatableFromCache
- Returns:
- The current cached instance.
-
getLatestInstance
default java.util.concurrent.CompletableFuture<ServerThreadChannel> 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 aNoSuchElementException
. If a request to Discord is made, the according remote call exception will be used to complete theCompletableFuture
exceptionally.- Specified by:
getLatestInstance
in interfaceChannel
- Specified by:
getLatestInstance
in interfaceServerChannel
- Specified by:
getLatestInstance
in interfaceTextChannel
- Specified by:
getLatestInstance
in interfaceUpdatable
- Specified by:
getLatestInstance
in 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_MEMBERS
intent.- 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_MEMBERS
intent.- Returns:
- All members in this thread.
-
createUpdater
default ServerThreadChannelUpdater createUpdater()
Creates an updater for this thread.- Specified by:
createUpdater
in interfaceServerChannel
- Returns:
- An updater for this thread.
-
-