Interface IThreadContainer
- All Superinterfaces:
Channel
,Comparable<GuildChannel>
,Formattable
,GuildChannel
,IMentionable
,IPermissionContainer
,ISnowflake
- All Known Subinterfaces:
ForumChannel
,IPostContainer
,IThreadContainerUnion
,MediaChannel
,NewsChannel
,StandardGuildMessageChannel
,TextChannel
ThreadChannels
.- See Also:
-
Field Summary
Fields inherited from interface net.dv8tion.jda.api.entities.channel.Channel
MAX_NAME_LENGTH
Fields inherited from interface net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
JUMP_URL
-
Method Summary
Modifier and TypeMethodDescriptiondefault ThreadChannelAction
createThreadChannel
(String name) Creates a new publicThreadChannel
with the parent channel being thisIThreadContainer
.createThreadChannel
(String name, boolean isPrivate) Creates a newThreadChannel
with the parent channel being thisIThreadContainer
.createThreadChannel
(String name, long messageId) Creates a new, publicThreadChannel
with the parent channel being thisIThreadContainer
.default ThreadChannelAction
createThreadChannel
(String name, String messageId) Creates a new, publicThreadChannel
with the parent channel being thisIThreadContainer
.int
The defaultslowmode
for thread channels that is copied on thread creation.default @Unmodifiable List
<ThreadChannel> Finds allThreadChannels
whose parent is this channel.Retrieves the archived privateThreadChannels
for this channel, that the bot has previously joined or been added to.Retrieves the archived privateThreadChannels
for this channel.Retrieves the archived publicThreadChannels
for this channel.Methods inherited from interface net.dv8tion.jda.api.entities.channel.Channel
formatTo, getAsMention, getFlags, getJDA, getName, getType
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
delete, getGuild, getJumpUrl, getPermissionContainer
Methods inherited from interface net.dv8tion.jda.api.entities.channel.attribute.IPermissionContainer
getManager, getMemberPermissionOverrides, getPermissionOverride, getPermissionOverrides, getRolePermissionOverrides, upsertPermissionOverride
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Method Details
-
getDefaultThreadSlowmode
int getDefaultThreadSlowmode()The defaultslowmode
for thread channels that is copied on thread creation.
Users have to wait this amount of seconds before sending another message to the same thread.- Returns:
- The default slowmode seconds for new threads, or
0
if unset
-
getThreadChannels
Finds allThreadChannels
whose parent is this channel.These threads can also represent posts in
ForumChannels
.- Returns:
- Immutable list of all ThreadChannel children.
-
createThreadChannel
Creates a new publicThreadChannel
with the parent channel being thisIThreadContainer
.The resulting
ThreadChannel
may be either one of:Possible
ErrorResponses
caused by the returnedRestAction
include the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceededErrorResponse.MAX_ACTIVE_THREADS
The maximum number of active threads has been reached, and no more may be created.
- Parameters:
name
- The name of the new ThreadChannel (up to 100 characters)- Returns:
- A specific
ThreadChannelAction
that may be used to configure the new ThreadChannel before its creation. - Throws:
IllegalArgumentException
- If the provided name is null, blank, empty, or longer than 100 charactersUnsupportedOperationException
- If this is a forum channel. You must usecreateForumPost(...)
instead.InsufficientPermissionException
-- If the bot does not have
Permission.VIEW_CHANNEL
- If the bot does not have
Permission.CREATE_PUBLIC_THREADS
- If the bot does not have
-
createThreadChannel
@Nonnull @CheckReturnValue ThreadChannelAction createThreadChannel(@Nonnull String name, boolean isPrivate) Creates a newThreadChannel
with the parent channel being thisIThreadContainer
.The resulting
ThreadChannel
may be one of:Possible
ErrorResponses
caused by the returnedRestAction
include the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceededErrorResponse.MAX_ACTIVE_THREADS
The maximum number of active threads has been reached, and no more may be created.ErrorResponse.MISSING_PERMISSIONS
Due to missing private thread permissions.
- Parameters:
name
- The name of the new ThreadChannel (up to 100 characters).isPrivate
- The public/private status of the new ThreadChannel. If true, the new ThreadChannel will be private.- Returns:
- A specific
ThreadChannelAction
that may be used to configure the new ThreadChannel before its creation. - Throws:
IllegalArgumentException
- If the provided name is null, blank, empty, or longer than 100 characters.IllegalStateException
- If the guild does have the feature flag"PRIVATE_THREADS"
enabled.UnsupportedOperationException
- If this is a forum channel. You must usecreateForumPost(...)
instead.InsufficientPermissionException
-- If the bot does not have
Permission.VIEW_CHANNEL
- If the thread is
private
, and the bot does not havePermission.CREATE_PRIVATE_THREADS
- If the thread is not
private
, and the bot does not havePermission.CREATE_PUBLIC_THREADS
- If the bot does not have
-
createThreadChannel
@Nonnull @CheckReturnValue ThreadChannelAction createThreadChannel(@Nonnull String name, long messageId) Creates a new, publicThreadChannel
with the parent channel being thisIThreadContainer
.
The starting message will copy the message for the provided id, and will be of typeMessageType.THREAD_STARTER_MESSAGE
.The resulting
ThreadChannel
may be one of:Possible
ErrorResponses
caused by the returnedRestAction
include the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceededErrorResponse.THREAD_WITH_THIS_MESSAGE_ALREADY_EXISTS
This message has already been used to create a threadErrorResponse.MAX_ACTIVE_THREADS
The maximum number of active threads has been reached, and no more may be created.
- Parameters:
name
- The name of the new ThreadChannel (up to 100 characters)messageId
- The ID of the message from which this ThreadChannel will be spawned.- Returns:
- A specific
ThreadChannelAction
that may be used to configure the new ThreadChannel before its creation. - Throws:
IllegalArgumentException
- If the provided name is null, blank, empty, or longer than 100 charactersUnsupportedOperationException
- If this is a forum channel. You must usecreateForumPost(...)
instead.InsufficientPermissionException
- If the bot does not havePermission.CREATE_PUBLIC_THREADS
in this channel
-
createThreadChannel
@Nonnull @CheckReturnValue default ThreadChannelAction createThreadChannel(@Nonnull String name, @Nonnull String messageId) Creates a new, publicThreadChannel
with the parent channel being thisIThreadContainer
.
The starting message will copy the message for the provided id, and will be of typeMessageType.THREAD_STARTER_MESSAGE
.The resulting
ThreadChannel
may be one of:Possible
ErrorResponses
caused by the returnedRestAction
include the following:MISSING_PERMISSIONS
The channel could not be created due to a permission discrepancyMAX_CHANNELS
The maximum number of channels were exceededErrorResponse.THREAD_WITH_THIS_MESSAGE_ALREADY_EXISTS
This message has already been used to create a threadErrorResponse.MAX_ACTIVE_THREADS
The maximum number of active threads has been reached, and no more may be created.
- Parameters:
name
- The name of the new ThreadChannel (up to 100 characters)messageId
- The ID of the message from which this ThreadChannel will be spawned.- Returns:
- A specific
ThreadChannelAction
that may be used to configure the new ThreadChannel before its creation. - Throws:
IllegalArgumentException
- If the provided name is null, blank, empty, or longer than 100 characters. Or the message id is not a valid snowflake.UnsupportedOperationException
- If this is a forum channel. You must usecreateForumPost(...)
instead.InsufficientPermissionException
- If the bot does not havePermission.CREATE_PUBLIC_THREADS
in this channel
-
retrieveArchivedPublicThreadChannels
Retrieves the archived publicThreadChannels
for this channel.
This will iterate over all previously opened public threads, that have been archived.You can use
retrieveArchivedPrivateThreadChannels()
, to get all private archived threads.These threads can also represent posts in
ForumChannels
.- Returns:
ThreadChannelPaginationAction
to iterate over all public archived ThreadChannels- Throws:
InsufficientPermissionException
- If the bot does not havePermission.MESSAGE_HISTORY
in this channel
-
retrieveArchivedPrivateThreadChannels
Retrieves the archived privateThreadChannels
for this channel.
This will iterate over all previously opened private threads, that have been archived. This is a moderator restricted method, since private threads are only visible to members withPermission.MANAGE_THREADS
.You can use
retrieveArchivedPublicThreadChannels()
, to get all public archived threads.Note that
ForumChannels
cannot have private threads.- Returns:
ThreadChannelPaginationAction
to iterate over all private archived ThreadChannels- Throws:
InsufficientPermissionException
- If the bot does not havePermission.MESSAGE_HISTORY
orPermission.MANAGE_THREADS
in this channel
-
retrieveArchivedPrivateJoinedThreadChannels
@Nonnull @CheckReturnValue ThreadChannelPaginationAction retrieveArchivedPrivateJoinedThreadChannels()Retrieves the archived privateThreadChannels
for this channel, that the bot has previously joined or been added to.
UnlikeretrieveArchivedPrivateThreadChannels()
, this only checks for threads which the bot has joined, and thus does not require permissions to manage threads.You can use
retrieveArchivedPrivateThreadChannels()
, to get all private archived threads.Note that
ForumChannels
cannot have private threads.- Returns:
ThreadChannelPaginationAction
to iterate over all joined private archived ThreadChannels- Throws:
InsufficientPermissionException
- If the bot does not havePermission.MESSAGE_HISTORY
in this channel
-