Skip to content

How to retrieve the first message of a forum post #2424

Discussion options

You must be logged in to vote

You can use getIterableHistory:

channel.getIterableHistory()
  .reverse() // iterate from the beginning of the channel history
  .limit(1) // only take first message
  .queue(messages -> {
    Message message = messages.get(0); // get first from list (might throw if channel is empty)
  });

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by AlexCai2019
Comment options

You must be logged in to vote
1 reply
@MinnDevelopment
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants