code: public static Stream<Message> getMessagesBetweenAsStream(TextChannel channel, long from, long to) {
          long before = Math.max(from, to);
          long after = Math.min(from, to);
          Stream<Message> messages = getMessagesAsStream(channel, -1, after).filter(message -> message.getId() < before);
          return (from == after) ? messages : messages.sorted(Comparator.reverseOrder());
      }
docs: Gets all messages in the given channel between the first given message in any channel and the second given
  message in any channel, excluding the boundaries, sorted from first given message to the second given message.
  
  <p>The messages are retrieved in batches synchronously from Discord,
  so consider not using this method from a listener directly.
  
  @param channel The channel of the messages.
  @param from The id of the start boundary messages.
  @param to The id of the other boundary messages.
  @return The stream.
  @see #getMessagesBetween(TextChannel, long, long)