Skip to content

v6.0.0-rc.2 | New Pin Pagination API

Pre-release
Pre-release
Compare
Choose a tag to compare
@MinnDevelopment MinnDevelopment released this 27 Jul 19:35
· 29 commits to master since this release
3f04b55

Overview

This release includes a minor breaking change to the retrievePinnedMessages method.

Originally, this method could only fetch up to 50 pinned messages. However, the underlying endpoint has been deprecated and replaced with a new paginated endpoint, as detailed in the Discord Changelog.

We have updated our API to utilize a PaginationAction. The callback response is now a list of PinnedMessage objects instead of a list of messages. Each PinnedMessage instance contains the timestamp when the message was pinned and the pinned message object. With this pagination action, the retrieval of pinned messages is no longer limited to 50 messages and can now fetch more, for instance by using takeAsync(200).

To replicate the previous behavior (retrieving only up to 50 pinned messages), you can use queue() as before, but you will need to map the list to a List<Message> as follows:

channel.retrievePinnedMessages()
  .map(list -> list.stream().map(PinnedMessage::getMessage).toList())
  .queue(list -> ...);

Changes

Full Changelog: v6.0.0-rc.1...v6.0.0-rc.2

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:6.0.0-rc.2")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>6.0.0-rc.2</version> 
</dependency>