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
Modifier and TypeInterfaceDescriptionstatic class
DefaultMessageBuilder.SplitPolicy
implementation. -
Field Summary
Modifier and TypeFieldDescriptionstatic final MessageBuilder.SplitPolicy
Splits exactly after 2000 chars.static final MessageBuilder.SplitPolicy
Splits on newline chars`\n`
.static final MessageBuilder.SplitPolicy
Splits on space chars` `
. -
Method Summary
Modifier and TypeMethodDescriptionint
nextMessage
(int currentBeginIndex, MessageBuilder builder) Calculates the endIndex for the nextMessage
.static MessageBuilder.SplitPolicy
onChars
(CharSequence chars, boolean remove) Creates a newMessageBuilder.SplitPolicy
splitting 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.SplitPolicy
splitting 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 nextMessage
should start frombuilder
- theMessageBuilder
- Returns:
- the end Index of the next
Message
- Throws:
IllegalStateException
- when splitting fails
-