Interface IThreadContainer
- All Superinterfaces:
Channel,Comparable<GuildChannel>,Formattable,GuildChannel,IMentionable,IPermissionContainer,ISnowflake
- All Known Subinterfaces:
ForumChannel,IPostContainer,IThreadContainerUnion,MediaChannel,NewsChannel,StandardGuildMessageChannel,TextChannel
ThreadChannels.-
Field Summary
Fields inherited from interface net.dv8tion.jda.api.entities.channel.Channel
MAX_NAME_LENGTHFields inherited from interface net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
JUMP_URL -
Method Summary
Modifier and TypeMethodDescriptiondefault ThreadChannelActioncreateThreadChannel(String name) Creates a new publicThreadChannelwith the parent channel being thisIThreadContainer.createThreadChannel(String name, boolean isPrivate) Creates a newThreadChannelwith the parent channel being thisIThreadContainer.createThreadChannel(String name, long messageId) Creates a new, publicThreadChannelwith the parent channel being thisIThreadContainer.default ThreadChannelActioncreateThreadChannel(String name, String messageId) Creates a new, publicThreadChannelwith the parent channel being thisIThreadContainer.intThe defaultslowmodefor thread channels that is copied on thread creation.default @Unmodifiable List<ThreadChannel>Finds allThreadChannelswhose parent is this channel.Retrieves the archived privateThreadChannelsfor this channel, that the bot has previously joined or been added to.Retrieves the archived privateThreadChannelsfor this channel.Retrieves the archived publicThreadChannelsfor this channel.Methods inherited from interface net.dv8tion.jda.api.entities.channel.Channel
formatTo, getAsMention, getFlags, getJDA, getName, getTypeMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
delete, getGuild, getJumpUrl, getPermissionContainerMethods inherited from interface net.dv8tion.jda.api.entities.channel.attribute.IPermissionContainer
getManager, getMemberPermissionOverrides, getPermissionOverride, getPermissionOverrides, getRolePermissionOverrides, upsertPermissionOverrideMethods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Method Details
-
getDefaultThreadSlowmode
int getDefaultThreadSlowmode()The defaultslowmodefor 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
0if unset
-
getThreadChannels
Finds allThreadChannelswhose parent is this channel.These threads can also represent posts in
ForumChannels.- Returns:
- Immutable list of all ThreadChannel children.
-
createThreadChannel
Creates a new publicThreadChannelwith the parent channel being thisIThreadContainer.The resulting
ThreadChannelmay be either one of:Possible
ErrorResponsescaused by the returnedRestActioninclude 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
ThreadChannelActionthat 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 newThreadChannelwith the parent channel being thisIThreadContainer.The resulting
ThreadChannelmay be one of:Possible
ErrorResponsescaused by the returnedRestActioninclude 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
ThreadChannelActionthat 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, publicThreadChannelwith 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
ThreadChannelmay be one of:Possible
ErrorResponsescaused by the returnedRestActioninclude 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
ThreadChannelActionthat 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_THREADSin this channel
-
createThreadChannel
@Nonnull @CheckReturnValue default ThreadChannelAction createThreadChannel(@Nonnull String name, @Nonnull String messageId) Creates a new, publicThreadChannelwith 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
ThreadChannelmay be one of:Possible
ErrorResponsescaused by the returnedRestActioninclude 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
ThreadChannelActionthat 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_THREADSin this channel
-
retrieveArchivedPublicThreadChannels
Retrieves the archived publicThreadChannelsfor 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:
ThreadChannelPaginationActionto iterate over all public archived ThreadChannels- Throws:
InsufficientPermissionException- If the bot does not havePermission.MESSAGE_HISTORYin this channel
-
retrieveArchivedPrivateThreadChannels
Retrieves the archived privateThreadChannelsfor 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
ForumChannelscannot have private threads.- Returns:
ThreadChannelPaginationActionto iterate over all private archived ThreadChannels- Throws:
InsufficientPermissionException- If the bot does not havePermission.MESSAGE_HISTORYorPermission.MANAGE_THREADSin this channel
-
retrieveArchivedPrivateJoinedThreadChannels
@Nonnull @CheckReturnValue ThreadChannelPaginationAction retrieveArchivedPrivateJoinedThreadChannels()Retrieves the archived privateThreadChannelsfor 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
ForumChannelscannot have private threads.- Returns:
ThreadChannelPaginationActionto iterate over all joined private archived ThreadChannels- Throws:
InsufficientPermissionException- If the bot does not havePermission.MESSAGE_HISTORYin this channel
-