Package net.dv8tion.jda.api
Interface MessageBuilder.SplitPolicy
- All Known Implementing Classes:
MessageBuilder.SplitPolicy.CharSequenceSplitPolicy
- Enclosing class:
- MessageBuilder
public static interface MessageBuilder.SplitPolicy
Interface to allow custom implementation of Splitting rules for
MessageBuilder.buildAll(SplitPolicy...).-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classDefaultMessageBuilder.SplitPolicyimplementation. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MessageBuilder.SplitPolicySplits exactly after 2000 chars.static final MessageBuilder.SplitPolicySplits on newline chars`\n`.static final MessageBuilder.SplitPolicySplits on space chars` `. -
Method Summary
Modifier and TypeMethodDescriptionintnextMessage(int currentBeginIndex, MessageBuilder builder) Calculates the endIndex for the nextMessage.static MessageBuilder.SplitPolicyonChars(CharSequence chars, boolean remove) Creates a newMessageBuilder.SplitPolicysplitting on the specified chars.
-
Field Details
-
NEWLINE
Splits on newline chars`\n`. -
SPACE
Splits on space chars` `. -
ANYWHERE
Splits exactly after 2000 chars.
-
-
Method Details
-
onChars
Creates a newMessageBuilder.SplitPolicysplitting on the specified chars.- Parameters:
chars- the chars to split onremove- whether to remove the chars when splitting on them- Returns:
- a new
MessageBuilder.SplitPolicy
-
nextMessage
Calculates the endIndex for the nextMessage.- Parameters:
currentBeginIndex- the index the nextMessageshould start frombuilder- theMessageBuilder- Returns:
- the end Index of the next
Message - Throws:
IllegalStateException- when splitting fails
-