Class ForumTagData

java.lang.Object
net.dv8tion.jda.api.entities.channel.forums.ForumTagData
All Implemented Interfaces:
BaseForumTag, SerializableData

public class ForumTagData extends Object implements BaseForumTag
Data class used to create or update existing forum tags.
See Also:
  • Constructor Details

    • ForumTagData

      public ForumTagData(@Nonnull String name)
      Create a new ForumTagData instance.
      Parameters:
      name - The tag name (1-20 characters)
      Throws:
      IllegalArgumentException - If the provided name is null or not between 1 and 20 characters long
  • Method Details

    • from

      @Nonnull public static ForumTagData from(@Nonnull BaseForumTag tag)
      Creates a new ForumTagData instance based on the provided BaseForumTag.
      This also binds to the id of the provided tag, if available.
      Parameters:
      tag - The base tag to use
      Returns:
      The new ForumTagData instance
      Throws:
      IllegalArgumentException - If null is provided or the tag has an invalid name
    • setName

      @Nonnull public ForumTagData setName(@Nonnull String name)
      Set the new tag name to use.
      Parameters:
      name - The new tag name (1-20 characters)
      Returns:
      The updated ForumTagData instance
      Throws:
      IllegalArgumentException - If the provided name is null or not between 1 and 20 characters long
    • setModerated

      @Nonnull public ForumTagData setModerated(boolean moderated)
      Set whether the tag can only be applied by forum moderators.
      Parameters:
      moderated - True, if the tag is restricted to moderators
      Returns:
      The updated ForumTagData instance
      See Also:
    • setEmoji

      @Nonnull public ForumTagData setEmoji(@Nullable Emoji emoji)
      Set the emoji to use for this tag.
      This emoji is displayed as an icon attached to the tag.
      Parameters:
      emoji - The emoji icon of the tag
      Returns:
      The updated ForumTagData instance
    • getName

      @Nonnull public String getName()
      Description copied from interface: BaseForumTag
      The name of the tag.
      Specified by:
      getName in interface BaseForumTag
      Returns:
      The name
    • isModerated

      public boolean isModerated()
      Description copied from interface: BaseForumTag
      Whether this tag can only be applied by moderators with the MANAGE_THREADS permission (aka Manage Posts).
      Specified by:
      isModerated in interface BaseForumTag
      Returns:
      True, if this tag can only be applied by moderators with the required permission
    • getEmoji

      @Nullable public EmojiUnion getEmoji()
      Description copied from interface: BaseForumTag
      The emoji used as the tag icon.
      For custom emoji, this will have an empty name and CustomEmoji.isAnimated() is always false, due to discord chicanery.
      Specified by:
      getEmoji in interface BaseForumTag
      Returns:
      EmojiUnion representing the tag emoji, or null if no emoji is applied.
    • toData

      @Nonnull public DataObject toData()
      Description copied from interface: SerializableData
      Serialized DataObject for this object.
      Specified by:
      toData in interface BaseForumTag
      Specified by:
      toData in interface SerializableData
      Returns:
      DataObject
    • toString

      public String toString()
      Overrides:
      toString in class Object