getMessagesAfter

open fun getMessagesAfter(messageId: Snowflake, limit: Int? = null): Flow<Message>(source)

Requests to get all messages in this channel that were created after messageId.

Messages retrieved by this function will be emitted in chronological older (oldest -> newest).

The flow may use paginated requests to supply messages, limit will limit the maximum number of messages supplied and may optimize the batch size accordingly. null means no limit.

Unrestricted consumption of the returned Flow is a potentially performance-intensive operation, it is thus recommended limiting the amount of messages requested by using Flow.take, Flow.takeWhile or other functions that limit the amount of messages requested.

channel.getMessagesAfter(older.id).takeWhile { it.id < newer.id }

The returned flow is lazily executed, any RequestException will be thrown on terminal operators instead.

Throws

if a limit< 1 was supplied.