code: private static List<JsonNode> requestAsSortedJsonNodes(
              TextChannel channel, int limit, long before, long after, boolean reversed) {
          List<JsonNode> messageJsonNodes = requestAsJsonNodes(channel, limit, before, after);
          Comparator<JsonNode> idComparator = Comparator.comparingLong(jsonNode -> jsonNode.get("id").asLong());
          messageJsonNodes.sort(reversed ? idComparator.reversed() : idComparator);
          return messageJsonNodes;
      }
docs: Requests the messages from Discord, sorted by their id.
  
  @param channel The channel of which to get messages from.
  @param limit The limit of messages to get.
  @param before Get messages before the message with this id.
  @param after Get messages after the message with this id.
  @param reversed If {@code true}, get from oldest to newest, otherwise from newest to oldest.
  @return The JSON nodes.