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 ; }
Requests the messages from Discord sorted by their id .