v5.0.0-alpha.18 | Message Rework #2221
MinnDevelopment
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Overview
With this release, we are getting very close to the beta release. The big and long awaited message rework introduces a high consistency between all message create and edit endpoints, which means you no longer have to decide between
setActionRow
andaddActionRow
depending on the specific flavor of endpoint you are using!Message Rework (#2187)
The message rework introduces a consistent interface for message requests. We are splitting message edit requests and message create requests into 2 interfaces with different functionality. The new type hierarchy can be seen in this figure:
This results in a few breaking changes.
Renames
setActionRows
/addActionRows
->setComponents
/addComponents
MessageAction
->MessageCreateAction
MessageAction#tts
->MessageCreateAction#setTTS
allowedMentions(...)
->setAllowedMentions(...)
addFile
->setFiles
/addFiles
/setAttachments
sendFile
/replyFile
->sendFiles
/replyFiles
override(true)
->setReplace(true)
Code Migration
You will likely only have to adjust code if you used
MessageBuilder
. In this rework, we split this intoMessageCreateBuilder
andMessageEditBuilder
, which produce eitherMessageCreateData
orMessageEditData
. And you will have to provide these data instances instead ofMessage
instances from now on.The old approach of having a
MessageBuilder
which returns aMessage
instance was flawed, in that it would offer a lot of methods which are unusable. Instead, we now separate this by making data classes for each request. Now the types are consistently representing a specific feature set:Message
MessageCreateData
MessageEditData
This allows for a higher level of consistency and clarity. The edit builder by default will only update the fields which are explicitly set. For example, doing
new MessageEditBuilder().setContent("hello").build()
will only update the content and leave any embeds or files untouched.More details are provided in #2187. You can also ask questions in the release discussion.
Gateway Resume URL Handling (#2203)
In an upcoming change to the gateway logic (which is used to receive events), Discord is introducing a new gateway resume url. This new resume URL will be used to move your bot connection to a new zone, allowing for less reconnects and potentially lower ping.
Bots on older version of JDA may run into more reconnects due to the missing handling of this new resume url. Anyone using some kind of proxy gateway, should make sure to also handle this accordingly.
New Features
GuildChannel#getJumpUrl
by @DynxstyGIT in ImplementGuildChannel#getJumpUrl
#2204Changes
Bug Fixes
Full Changelog: v5.0.0-alpha.17...v5.0.0-alpha.18
Installation
Gradle
Maven
This discussion was created from the release v5.0.0-alpha.18 | Message Rework.
Beta Was this translation helpful? Give feedback.
All reactions