[!WARNING]
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
Release Notes
discord-jda/JDA (net.dv8tion:JDA)
### [`v5.1.2`](https://redirect.github.com/discord-jda/JDA/releases/tag/v5.1.2): | Message Forwarding and Voice Messages
### Overview
This release adds support for new message features.
##### Forwarding messages ([#2744](https://redirect.github.com/discord-jda/JDA/issues/2744))
You can now handle forwarded messages using the new [message snapshots](https://docs.jda.wiki/net/dv8tion/jda/api/entities/Message.html#getMessageSnapshots\(\)).
```java
@Override
public void onMessageReceived(MessageReceivedEvent event) {
MessageReference messageReference = event.getMessage().getMessageReference();
// Forwarded messages have a reference of type FORWARD
if (messageReference != null && messageReference.getType() == MessageReference.MessageReferenceType.FORWARD) {
// The content of the forwarded message is provided as a snapshot
MessageSnapshot snapshot = event.getMessage().getMessageSnapshots().getFirst();
System.out.println("Received forwarded message with content: " + snapshot.getContentRaw());
}
}
```
A bot can also forward a message using [`Message#fowardTo`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/Message.html#forwardTo\(net.dv8tion.jda.api.entities.channel.middleman.MessageChannel\)). Note that a forwarded message cannot contain any additional content.
##### Voice messages ([#2738](https://redirect.github.com/discord-jda/JDA/issues/2738))
You can now send voice messages with JDA, by utilizing the new [`FileUpload#asVoiceMessage`](https://docs.jda.wiki/net/dv8tion/jda/api/utils/FileUpload.html#asVoiceMessage\(okhttp3.MediaType,byte%5B%5D,double\)) method on your audio attachments.
```java
channel.sendFiles(
FileUpload.fromData(audioFile)
.asVoiceMessage(MediaType.parse("audio/ogg"), waveform, 10.5) // 10.5 seconds audio/ogg message
).queue();
```
To create a voice message, you must first determine the audio media type of your voice message and sample a waveform up to 256 bytes. Voice messages require a valid `audio/*` media type like `audio/ogg`.
The waveform is used to render the voice message shape in the preview. It must not be an accurate sampling of the actual audio.
#### New Features
- Add support for message forwarding by [@MinnDevelopment](https://redirect.github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2744](https://redirect.github.com/discord-jda/JDA/pull/2744)
- Support sending voice messages by [@MinnDevelopment](https://redirect.github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2738](https://redirect.github.com/discord-jda/JDA/pull/2738)
#### Bug Fixes
- Fix ScheduledEventManagerImpl::setStatus by [@raul1ro](https://redirect.github.com/raul1ro) in [https://github.com/discord-jda/JDA/pull/2743](https://redirect.github.com/discord-jda/JDA/pull/2743)
**Full Changelog**: https://github.com/discord-jda/JDA/compare/v5.1.1...v5.1.2
### Installation
#### Gradle
```gradle
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.1.2")
}
```
#### Maven
```xml
net.dv8tionJDA5.1.2
```
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR contains the following updates:
5.1.1
->5.1.2
Release Notes
discord-jda/JDA (net.dv8tion:JDA)
### [`v5.1.2`](https://redirect.github.com/discord-jda/JDA/releases/tag/v5.1.2): | Message Forwarding and Voice Messages ### Overview This release adds support for new message features. ##### Forwarding messages ([#2744](https://redirect.github.com/discord-jda/JDA/issues/2744)) You can now handle forwarded messages using the new [message snapshots](https://docs.jda.wiki/net/dv8tion/jda/api/entities/Message.html#getMessageSnapshots\(\)). ```java @Override public void onMessageReceived(MessageReceivedEvent event) { MessageReference messageReference = event.getMessage().getMessageReference(); // Forwarded messages have a reference of type FORWARD if (messageReference != null && messageReference.getType() == MessageReference.MessageReferenceType.FORWARD) { // The content of the forwarded message is provided as a snapshot MessageSnapshot snapshot = event.getMessage().getMessageSnapshots().getFirst(); System.out.println("Received forwarded message with content: " + snapshot.getContentRaw()); } } ``` A bot can also forward a message using [`Message#fowardTo`](https://docs.jda.wiki/net/dv8tion/jda/api/entities/Message.html#forwardTo\(net.dv8tion.jda.api.entities.channel.middleman.MessageChannel\)). Note that a forwarded message cannot contain any additional content. ##### Voice messages ([#2738](https://redirect.github.com/discord-jda/JDA/issues/2738)) You can now send voice messages with JDA, by utilizing the new [`FileUpload#asVoiceMessage`](https://docs.jda.wiki/net/dv8tion/jda/api/utils/FileUpload.html#asVoiceMessage\(okhttp3.MediaType,byte%5B%5D,double\)) method on your audio attachments. ```java channel.sendFiles( FileUpload.fromData(audioFile) .asVoiceMessage(MediaType.parse("audio/ogg"), waveform, 10.5) // 10.5 seconds audio/ogg message ).queue(); ``` To create a voice message, you must first determine the audio media type of your voice message and sample a waveform up to 256 bytes. Voice messages require a valid `audio/*` media type like `audio/ogg`. The waveform is used to render the voice message shape in the preview. It must not be an accurate sampling of the actual audio. #### New Features - Add support for message forwarding by [@MinnDevelopment](https://redirect.github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2744](https://redirect.github.com/discord-jda/JDA/pull/2744) - Support sending voice messages by [@MinnDevelopment](https://redirect.github.com/MinnDevelopment) in [https://github.com/discord-jda/JDA/pull/2738](https://redirect.github.com/discord-jda/JDA/pull/2738) #### Bug Fixes - Fix ScheduledEventManagerImpl::setStatus by [@raul1ro](https://redirect.github.com/raul1ro) in [https://github.com/discord-jda/JDA/pull/2743](https://redirect.github.com/discord-jda/JDA/pull/2743) **Full Changelog**: https://github.com/discord-jda/JDA/compare/v5.1.1...v5.1.2 ### Installation #### Gradle ```gradle repositories { mavenCentral() } dependencies { implementation("net.dv8tion:JDA:5.1.2") } ``` #### Maven ```xmlConfiguration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.