@@ -16,24 +16,24 @@ public class LinkedMessages {
1616 private LinkedMessages () {
1717 }
1818
19- /**
19+ /**
2020 * Resolves a block of messages ending at {@code triggerMessage} and passes the
2121 * bot's own messages to {@code onResolved}, ordered from newest to oldest.
2222 * If {@code inclusive} is {@code true}, {@code triggerMessage} is included in
2323 * the resolved block; otherwise, only the preceding {@code total} messages are
24- * considered. Runs {@code onError} if the block can't be safely resolved.
24+ * considered. When {@code inclusive} is {@code true}, {@code total} must be at
25+ * least 2: {@code triggerMessage} counts as one of the {@code total} messages
26+ * and the remaining {@code total - 1} are fetched from the channel history, so
27+ * a single-message inclusive block is not supported. Runs {@code onError} if
28+ * the block can't be safely resolved.
2529 *
2630 * @param triggerMessage the message marking the end of the block
27- * @param total the number of messages to resolve
31+ * @param total the number of messages to resolve; must be at least 2 when {@code inclusive} is {@code true}
2832 * @param inclusive whether {@code triggerMessage} should be included in the resolved block
2933 * @param onResolved receives the bot's messages, ordered from newest to oldest
3034 * @param onError runs if the block can't be safely resolved
3135 */
3236 static void resolveBefore (Message triggerMessage , int total , boolean inclusive ,Consumer <List <Message >> onResolved , Runnable onError ) {
33- if (total <= 1 && inclusive ) {
34- verify (List .of (triggerMessage ), total , onResolved , onError );
35- return ;
36- }
3737 triggerMessage .getChannel ().getHistoryBefore (triggerMessage .getIdLong (), inclusive ?total -1 :total ).queue (history -> {
3838 List <Message > block = new ArrayList <>(history .getRetrievedHistory ());
3939 if (inclusive ){
0 commit comments