Interface IPostContainer
- All Superinterfaces:
Channel
,Comparable<GuildChannel>
,Formattable
,GuildChannel
,IMentionable
,IPermissionContainer
,ISnowflake
,IThreadContainer
- All Known Subinterfaces:
ForumChannel
,MediaChannel
Forum Posts
.
Forum posts are simply
ThreadChannels
of type ChannelType.GUILD_PUBLIC_THREAD
.
The CREATE POSTS
permission that is shown in the official Discord Client, is an alias for Permission.MESSAGE_SEND
.
Permission.CREATE_PUBLIC_THREADS
is ignored for creating forum posts.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
The order used to sort forum posts. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum length of a forum / media channel topic (4096)static final int
The maximum number oftags
that can be applied to a forum post.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 TypeMethodDescriptioncreateForumPost
(String name, MessageCreateData message) Creates a new forum/media post (thread) in this channel.default ForumTag
getAvailableTagById
(long id) Retrieves the tag for the provided id.default ForumTag
Retrieves the tag for the provided id.The availableForumTags
for this forum channel.The availableForumTags
for this channel.getAvailableTagsByName
(String name, boolean ignoreCase) The availableForumTags
for this channel.The emoji which will show up on new forum posts as default reaction.The default order used to show threads.Returns theChannelManager
for this GuildChannel.getTopic()
The topic set for this channel, this is referred to as Guidelines in the official Discord client.default boolean
Whether all new forum posts must have a tag.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
getMemberPermissionOverrides, getPermissionOverride, getPermissionOverrides, getRolePermissionOverrides, upsertPermissionOverride
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
Methods inherited from interface net.dv8tion.jda.api.entities.channel.attribute.IThreadContainer
createThreadChannel, createThreadChannel, createThreadChannel, createThreadChannel, getDefaultThreadSlowmode, getThreadChannels, retrieveArchivedPrivateJoinedThreadChannels, retrieveArchivedPrivateThreadChannels, retrieveArchivedPublicThreadChannels
-
Field Details
-
MAX_POST_CONTAINER_TOPIC_LENGTH
static final int MAX_POST_CONTAINER_TOPIC_LENGTHThe maximum length of a forum / media channel topic (4096)- See Also:
-
MAX_POST_TAGS
static final int MAX_POST_TAGSThe maximum number oftags
that can be applied to a forum post. (5)- See Also:
-
-
Method Details
-
getManager
Description copied from interface:GuildChannel
Returns theChannelManager
for this GuildChannel.
In the ChannelManager, you can modify the name, topic and position of this GuildChannel. You modify multiple fields in one request by chaining setters before callingRestAction.queue()
.- Specified by:
getManager
in interfaceGuildChannel
- Specified by:
getManager
in interfaceIPermissionContainer
- Returns:
- The ChannelManager of this GuildChannel
-
getAvailableTagCache
The availableForumTags
for this forum channel.
Tags are sorted by theirposition
ascending.This requires
CacheFlag.FORUM_TAGS
to be enabled.- Returns:
SortedSnowflakeCacheView
ofForumTag
-
getAvailableTags
The availableForumTags
for this channel.
Tags are sorted by theirposition
ascending.This is a shortcut for
getAvailableTagCache().asList()
. This method will copy the underlying cache into the list, running inO(n)
time.This requires
CacheFlag.FORUM_TAGS
to be enabled. -
getAvailableTagsByName
@Nonnull default @Unmodifiable List<ForumTag> getAvailableTagsByName(@Nonnull String name, boolean ignoreCase) The availableForumTags
for this channel.
Tags are sorted by theirposition
ascending.This is a shortcut for
getAvailableTagCache().getElementsByName(name, ignoreCase)
. This method will copy the underlying cache into the list, running inO(n)
time.This requires
CacheFlag.FORUM_TAGS
to be enabled.- Parameters:
name
- The name of the tagignoreCase
- Whether to useString.equalsIgnoreCase(String)
- Returns:
- Immutable
List
ofForumTag
with the given name - Throws:
IllegalArgumentException
- If the name isnull
-
getAvailableTagById
Retrieves the tag for the provided id.This requires
CacheFlag.FORUM_TAGS
to be enabled.- Parameters:
id
- The tag id- Returns:
- The tag for the provided id, or
null
if no tag with that id exists - See Also:
-
getAvailableTagById
Retrieves the tag for the provided id.This requires
CacheFlag.FORUM_TAGS
to be enabled.- Parameters:
id
- The tag id- Returns:
- The tag for the provided id, or
null
if no tag with that id exists - Throws:
IllegalArgumentException
- If the provided id is nullNumberFormatException
- If the provided id is not a valid snowflake- See Also:
-
getTopic
The topic set for this channel, this is referred to as Guidelines in the official Discord client.
If no topic has been set, this returns null.- Returns:
- Possibly-null String containing the topic of this channel.
-
isTagRequired
default boolean isTagRequired()Whether all new forum posts must have a tag.- Returns:
- True, if all new posts must have a tag.
-
getDefaultReaction
The emoji which will show up on new forum posts as default reaction.- Returns:
- The default reaction for new forum posts.
-
getDefaultSortOrder
The default order used to show threads.- Returns:
- The default order used to show threads.
-
createForumPost
@Nonnull @Incubating @CheckReturnValue ForumPostAction createForumPost(@Nonnull String name, @Nonnull MessageCreateData message) Creates a new forum/media post (thread) in this channel.Possible
ErrorResponses
include:UNKNOWN_CHANNEL
If the channel was deletedMESSAGE_BLOCKED_BY_AUTOMOD
If this message was blocked by anAutoModRule
MESSAGE_BLOCKED_BY_HARMFUL_LINK_FILTER
If this message was blocked by the harmful link filterREQUEST_ENTITY_TOO_LARGE
If the total sum of uploaded bytes exceeds the guild'supload limit
TITLE_BLOCKED_BY_AUTOMOD
If the forum post name was blocked by anAutoModRule
- Parameters:
name
- The name of the post (up to 100 characters)message
- The starting message of the post (seeMessageCreateBuilder
)- Returns:
ForumPostAction
- Throws:
InsufficientPermissionException
- If the bot does not havePermission.MESSAGE_SEND
in the channelIllegalArgumentException
-- If null is provided
- If the name is empty or longer than 100 characters
-