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 ( ) ) ; }
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 .