Class AbstractMessageBuilder<T,R extends AbstractMessageBuilder<T,R>>  
- Type Parameters:
- T- The result type used for- build()
- R- The return type used for method chaining
- All Implemented Interfaces:
- MessageData,- MessageRequest<R>
- Direct Known Subclasses:
- MessageCreateBuilder,- MessageEditBuilder
MessageRequest.
 This builder cannot be instantiated directly. You should use MessageCreateBuilder or MessageEditBuilder instead.
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionabstract Tbuild()Builds a validated instance of this builder's state, which can then be used for requests.clear()Clears this builder's state, resetting it to the initial state identical to creating a new instance.abstract RCloses and removes allFileUploadsadded to this builder.The mention types which are whitelisted.The configured message components, this is the opposite ofMessageRequest.setComponents(Collection)and only returns what was set using that setter.The configured message content, this is the opposite forMessageRequest.setContent(String)and only returns what was set using that setter.The configured message embeds, this is the opposite ofMessageRequest.setEmbeds(Collection)and only returns what was set using that setter.The IDs for roles which are allowed to be mentioned, or an empty list.The IDs for users which are allowed to be mentioned, or an empty list.longThe flags set on this message.abstract booleanisEmpty()Whether this builder is considered empty, this checks for all required fields of the request type.booleanWhether this message would mention a user, if it is sent as a reply.booleanWhether embeds will be suppressed on this message.abstract booleanisValid()Whether this builder has a valid state to build.mention(Collection<? extends IMentionable> mentions) mentionRepliedUser(boolean mention) Whether to mention the user, when replying to a message.mentionRoles(Collection<String> roleIds) Used to provide a whitelist ofRolesthat should be pinged, even when they would not be pinged otherwise according to the Set of allowed mention types.mentionUsers(Collection<String> userIds) Used to provide a whitelist ofUsersthat should be pinged, even when they would not be pinged otherwise according to the Set of allowed mention types.setAllowedMentions(Collection<Message.MentionType> allowedMentions) Sets theMentionTypesthat should be parsed.setComponents(Collection<? extends LayoutComponent> components) TheLayoutComponentsthat should be attached to the message.setContent(String content) The message content, which shows above embeds and attachments.setEmbeds(Collection<? extends MessageEmbed> embeds) TheMessageEmbedsthat should be attached to the message.setSuppressEmbeds(boolean suppress) Set whether embeds should be suppressed on this message.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.dv8tion.jda.api.utils.messages.MessageDatagetAttachmentsMethods inherited from interface net.dv8tion.jda.api.utils.messages.MessageRequestapplyMessage, mention, mentionRoles, mentionRoles, mentionUsers, mentionUsers, setActionRow, setActionRow, setComponents, setEmbeds, setFiles, setFiles
- 
Method Details- 
setContentDescription copied from interface:MessageRequestThe message content, which shows above embeds and attachments.- Specified by:
- setContentin interface- MessageRequest<T>
- Parameters:
- content- The content (up to 2000 characters)
- Returns:
- The same instance for chaining
 
- 
getContentDescription copied from interface:MessageDataThe configured message content, this is the opposite forMessageRequest.setContent(String)and only returns what was set using that setter.For message edit requests, this will not be the current content of the message. - Specified by:
- getContentin interface- MessageData
- Returns:
- The currently configured content, or an empty string if none was set yet
- See Also:
 
- 
mentionRepliedUserDescription copied from interface:MessageRequestWhether to mention the user, when replying to a message.
 This only matters in combination withMessageCreateAction.setMessageReference(...)!This is true by default but can be configured using MessageRequest.setDefaultMentionRepliedUser(boolean)!- Specified by:
- mentionRepliedUserin interface- MessageRequest<T>
- Parameters:
- mention- True, to mention the author in the referenced message
- Returns:
- The same instance for chaining
 
- 
setAllowedMentionsDescription copied from interface:MessageRequestSets theMentionTypesthat should be parsed.
 If a message is sent with an empty Set of MentionTypes, then it will not ping any User, Role or@everyone/@here, while still showing up as mention tag.If nullis provided to this method, then all Types will be mentionable (unless whitelisting via one of themention*methods is used).Note: A default for this can be set using AllowedMentions.setDefaultMentions(Collection).- Specified by:
- setAllowedMentionsin interface- MessageRequest<T>
- Parameters:
- allowedMentions- MentionTypes that are allowed to being parsed and mentioned. All other mention types will not be mentioned by this message. You can pass- nullor- EnumSet.allOf(MentionType.class)to allow all mentions.
- Returns:
- The same instance for chaining
 
- 
mentionDescription copied from interface:MessageRequestUsed to provide a whitelist forUsers,MembersandRolesthat should be pinged, even when they would not be pinged otherwise according to the Set of allowed mention types.
 On other types ofIMentionable, this does nothing.Note: When a User/Member is whitelisted this way, then parsing of User mentions is automatically disabled (same applies to Roles). 
 Also note that whitelisting users or roles implicitly disables parsing of other mentions, if not otherwise set viaMessageRequest.setDefaultMentions(Collection)orMessageRequest.setAllowedMentions(Collection).- Specified by:
- mentionin interface- MessageRequest<T>
- Parameters:
- mentions- Users, Members and Roles that should be explicitly whitelisted to be pingable.
- Returns:
- The same instance for chaining
- See Also:
 
- 
mentionUsersDescription copied from interface:MessageRequestUsed to provide a whitelist ofUsersthat should be pinged, even when they would not be pinged otherwise according to the Set of allowed mention types.Note: When a User is whitelisted this way, then parsing of User mentions is automatically disabled. 
 Also note that whitelisting users or roles implicitly disables parsing of other mentions, if not otherwise set viaMessageRequest.setDefaultMentions(Collection)orMessageRequest.setAllowedMentions(Collection).- Specified by:
- mentionUsersin interface- MessageRequest<T>
- Parameters:
- userIds- Ids of Users that should be explicitly whitelisted to be pingable.
- Returns:
- The same instance for chaining
- See Also:
 
- 
mentionRolesDescription copied from interface:MessageRequestUsed to provide a whitelist ofRolesthat should be pinged, even when they would not be pinged otherwise according to the Set of allowed mention types.Note: When a Role is whitelisted this way, then parsing of Role mentions is automatically disabled. 
 Also note that whitelisting users or roles implicitly disables parsing of other mentions, if not otherwise set viaMessageRequest.setDefaultMentions(Collection)orMessageRequest.setAllowedMentions(Collection).- Specified by:
- mentionRolesin interface- MessageRequest<T>
- Parameters:
- roleIds- Ids of Roles that should be explicitly whitelisted to be pingable.
- Returns:
- The same instance for chaining
- See Also:
 
- 
getMentionedUsersDescription copied from interface:MessageDataThe IDs for users which are allowed to be mentioned, or an empty list.- Specified by:
- getMentionedUsersin interface- MessageData
- Returns:
- The user IDs which are mention whitelisted
 
- 
getMentionedRolesDescription copied from interface:MessageDataThe IDs for roles which are allowed to be mentioned, or an empty list.- Specified by:
- getMentionedRolesin interface- MessageData
- Returns:
- The role IDs which are mention whitelisted
 
- 
getAllowedMentionsDescription copied from interface:MessageDataThe mention types which are whitelisted.- Specified by:
- getAllowedMentionsin interface- MessageData
- Returns:
- The mention types which can be mentioned by this message
 
- 
isMentionRepliedUserpublic boolean isMentionRepliedUser()Description copied from interface:MessageDataWhether this message would mention a user, if it is sent as a reply.- Specified by:
- isMentionRepliedUserin interface- MessageData
- Returns:
- True, if this would mention with the reply
 
- 
setEmbedsDescription copied from interface:MessageRequestTheMessageEmbedsthat should be attached to the message.
 You can useCollections.emptyList()to remove all embeds from the message.This requires Permission.MESSAGE_EMBED_LINKSin the channel.- Specified by:
- setEmbedsin interface- MessageRequest<T>
- Parameters:
- embeds- The embeds to attach to the message (up to 10)
- Returns:
- The same instance for chaining
- See Also:
 
- 
getEmbedsDescription copied from interface:MessageDataThe configured message embeds, this is the opposite ofMessageRequest.setEmbeds(Collection)and only returns what was set using that setter.For message edit requests, this will not be the current embeds of the message. - Specified by:
- getEmbedsin interface- MessageData
- Returns:
- The currently configured embeds, or an empty list if none were set yet
- See Also:
 
- 
setComponentsDescription copied from interface:MessageRequestTheLayoutComponentsthat should be attached to the message.
 You can useCollections.emptyList()to remove all components from the message.The most commonly used layout is ActionRow.Example: Set action rows 
 final List<LayoutComponent> list = new ArrayList<>(); list.add(ActionRow.of(selectMenu); // first row list.add(ActionRow.of(button1, button2)); // second row (shows below the first) channel.sendMessage("Content is still required") .setComponents(list) .queue();Example: Remove action rows 
 channel.sendMessage("Content is still required") .setComponents(Collections.emptyList()) .queue();- Specified by:
- setComponentsin interface- MessageRequest<T>
- Parameters:
- components- The components for the message (up to 5)
- Returns:
- The same instance for chaining
 
- 
getComponentsDescription copied from interface:MessageDataThe configured message components, this is the opposite ofMessageRequest.setComponents(Collection)and only returns what was set using that setter.For message edit requests, this will not be the current components of the message. - Specified by:
- getComponentsin interface- MessageData
- Returns:
- The currently configured components, or an empty list if none were set yet
- See Also:
 
- 
setSuppressEmbedsDescription copied from interface:MessageRequestSet whether embeds should be suppressed on this message.
 This also includes rich embeds added viaMessageRequest.setEmbeds(MessageEmbed...).Default: false - Specified by:
- setSuppressEmbedsin interface- MessageRequest<T>
- Parameters:
- suppress- True, if all embeds should be suppressed
- Returns:
- The same instance for chaining
 
- 
isSuppressEmbedspublic boolean isSuppressEmbeds()Description copied from interface:MessageDataWhether embeds will be suppressed on this message.- Specified by:
- isSuppressEmbedsin interface- MessageData
- Returns:
- True, if embeds are suppressed
 
- 
getMessageFlagsRawpublic long getMessageFlagsRaw()The flags set on this message.- Returns:
- The currently set message flags
 
- 
isEmptypublic abstract boolean isEmpty()Whether this builder is considered empty, this checks for all required fields of the request type.
 On a create request, this checks forcontent,embeds,components, andfiles.
 An edit request is only considered empty if no setters were called. And never empty, if the builder is areplace request.- Returns:
- True, if the builder state is empty
 
- 
isValidpublic abstract boolean isValid()Whether this builder has a valid state to build.
 If this isfalse, thenbuild()throws anIllegalStateException. You can check the exception docs onbuild()for specifics.- Returns:
- True, if the builder is in a valid state
 
- 
buildBuilds a validated instance of this builder's state, which can then be used for requests.- Returns:
- The validated data instance
- Throws:
- IllegalStateException- For- MessageCreateBuilder- If the builder is empty
- If the content set is longer than 2000
- If more than 10 embeds are set
- If more than 5 component layouts are set
 - MessageEditBuilder
- If the builder is 
 
- 
clearClears this builder's state, resetting it to the initial state identical to creating a new instance.WARNING: This will remove all the files added to the builder, but will not close them. You can use closeFiles()before callingclear()to close the files explicitly.- Returns:
- The same builder instance for chaining
 
- 
closeFilesCloses and removes allFileUploadsadded to this builder.This will keep any AttachmentUpdatesadded to this builder, as those do not require closing. You can useMessageEditRequest.setAttachments(AttachedFile...)to remove them as well.- Returns:
- The same builder instance for chaining
 
 
-