Skip to content

Releases: discord-jda/JDA

v5.0.0-alpha.14 | Text in Voice and Upgrade to API v10

17 Jul 15:13
bc8c2c7
Compare
Choose a tag to compare

Overview

Breaking changes and text messages in voice channels!

Text in Voice (#2072)

This release introduces the long awaited Text in Voice feature. Now you can use all your message related features in voice channels as well! Automatically works with interactions, messages, reactions, and all other features you could want!

Command Localization (#2090)

Using command localization, you can provide customized translations for all your commands. Check the example: LocalizationExample

API v10 (#2165)

Since the v9 API will be discontinued at the end of 2022, we have upgraded to the newer version 10. This comes with a few breaking changes:

  • All edit requests with addFile calls (such as message.editMessage(...).addFile(...)), will now remove all current attachments on the message. To retain existing attachments, you are now required to also use retainFiles(...) with the existing attachments on the message.
  • The introduction of GatewayIntent.MESSAGE_CONTENT. In order to use certain user-generated content in messages, you will now be required to explicitly enable this privileged intent. This includes:
    • getContentRaw, getContentDisplay, getContentStripped, and getMentions().getCustomEmojis()
    • getActionRows, and getButtons
    • getAttachments
    • getEmbeds

You will be presented with a warning, if you try using any of those methods without having the required intent enabled.

Attempting to access message content without GatewayIntent.MESSAGE_CONTENT.
Discord now requires to explicitly enable access to this using the MESSAGE_CONTENT intent.
Useful resources to learn more:
	- https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-FAQ
	- https://jda.wiki/using-jda/gateway-intents-and-member-cache-policy/
	- https://jda.wiki/using-jda/troubleshooting/#im-getting-closecode4014-disallowed-intents
Or suppress this warning if this is intentional with Message.suppressContentIntentWarning()

Channel Unions (#2138)

We had a lot of repeated concrete type specializations, such as getTextChannel(), all over library. To address this duplication and to make the interface more consitent, we are introducing the concept of channel unions.

These channel unions, are abstracted types, which provide the same features as their respective name would suggest, while also allowing simple specialization using conversion methods.

An example union would be MessageChannelUnion, which is used by Message.getChannel(). This type provides all the methods a normal MessageChannel would, but also allows you to convert it to a more concrete type:

public void onMessageReceived(MessageReceivedEvent event) {
  MessageChannelUnion channel = event.getChannel();
  // Use normal message channel features
  channel.sendMessage("Hello, I received your message!").queue();
  // Specialized handling on concrete types
  if (channel.getType() == ChannelType.VOICE) {
    VoiceChannel vc = channel.asVoiceChannel(); // easy type conversion, just like casting, but with clear type information
    vc.getGuild().getAudioManager().openAudioConnection(vc);
  }
}

New Features

Changes

Bug Fixes

Full Changelog: v5.0.0-alpha.13...v5.0.0-alpha.14

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.14")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.14</version> 
</dependency>

v5.0.0-alpha.13

28 Jun 15:28
244199d
Compare
Choose a tag to compare

Overview

In this release, we have taken some time to rework the handling of Emoji and Stickers! This comes with a lot of breaking changes.

Guild Emote Renamed (#2117)

Previously, all custom emoji were called Emote in JDA. This has been changed to be more consistent with the API naming convention of Custom Emoji. In that sense, we renamed Emote to RichCustomEmoji and made various changes all over the API to rename all occurrences of Emote with Emoji.

This also comes with some compatibility improvements! With this change, we now have a uniform representation of all emoji in the library. Every emoji now implements the Emoji interface and can be used interchangeably as such. For instance, the reactions used to have a specific type called ReactionEmote, which is now just replaced with Emoji allowing you to use them in buttons!

public void onMessageReactionAdd(MessageReactionAddEvent event) {
  event.getChannel().sendMessage("User reacted")
    .setActionRow(Button.primary("buttonid", event.getEmoji())) // <- replacement for getReactionEmote()
    .queue();
}

Stickers (#2104)

In addition to the changes for emoji, we now have a full support for stickers! Bots can send up to 3 guild stickers in a message (but not in interactions). However, this is limited to only stickers from the same guild, so likely not useful to most bots.

This comes with support for:

  • Creating/Updating/Deleting guild stickers
  • Getting and sending stickers with messages
  • Access to nitro sticker packs (not sending though)
  • Full sticker event support

ChunkingFilter Breaking Change (#2053)

Previously, when you did setChunkingFilter(ChunkingFilter.ALL), we would always cache every member of the guild for the full runtime. This has been changed now, allowing you to further configure the member cache policy in addition to chunking. Now, to chunk and cache all members of a guild, you can use setChunkingFilter(ChunkingFilter.ALL).setMemberCachePolicy(MemberCachePolicy.ALL).

This is a breaking change and affects anyone using ChunkingFilter.

Command Permissions (#2113)

Discord made breaking changes to command permissions (aka Privileges). This means you can no longer configure the privileges of a command on a guild, without using oauth. Consequently, we updated our interface with breaking changes to address this.

Instead of using setDefaultEnabled(..) on your command and configuring a whitelist/blacklist of roles and users, you now have the ability to configure allowed permissions using setDefaultPermissions(...) and you can tell discord that a command is guild only with setGuildOnly(true).

However, you cannot configure this for individual subcommands, due to the way discord designed them.

Check out the SlashBotExample for some useful examples on how this works!

New Features

Changes

Bug Fixes

Full Changelog: v5.0.0-alpha.12...v5.0.0-alpha.13

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.13")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.13</version> 
</dependency>

v5.0.0-alpha.12

18 May 14:56
edbc423
Compare
Choose a tag to compare

Overview

This release contains a few tiny changes to improve the codebase, such as:

  • FileProxy for downloading images and files from discord (replacing Message.Attachments#download)
  • FileUpload for uploading images and files to discord (will be used for Message and Sticker creation)
  • Message#getMentions to replace all the mention handling in message and interactions. (Such as Message#getMentionedUsers)

Example Mentions Changes

Old:

List<TextChannel> channels = message.getMentionedChannels(); // only handles TextChannel mentions
List<User> users = message.getMentionedUsers();

New:

List<GuildChannel> channels = message.getMentions().getChannels(); // handles all channel mentions
List<MessageChannel> messageChannels = message.getMentions().getChannels(MessageChannel.class); // filter by class type
List<User> users = message.getMentions().getUsers();

New Features

Changes

Bug Fixes

Full Changelog: v5.0.0-alpha.11...v5.0.0-alpha.12

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.12")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.12</version> 
</dependency>

v5.0.0-alpha.11 | Modals

25 Apr 19:46
e8dc87f
Compare
Choose a tag to compare

Overview

This release finally brings out modals! This includes a variety of constructs, but the key ones to be immediately aware of are:

  • Modal
  • TextInput
  • ModalInteraction
  • ModalInteractionEvent
  • IModalCallback (replyModal(modal))

Modal Example

@Override
public void onSlashCommandInteraction(@Nonnull SlashCommandInteractionEvent event) {
    if (event.getName().equals("support")) {
        TextInput email = TextInput.create("email", "Email", TextInputStyle.SHORT)
                .setPlaceholder("Enter your E-mail")
                .setMinLength(10)
                .setMaxLength(100) // or setRequiredRange(10, 100)
                .build();

        TextInput body = TextInput.create("body", "Body", TextInputStyle.PARAGRAPH)
                .setPlaceholder("Your concerns go here")
                .setMinLength(30)
                .setMaxLength(1000)
                .build();

        Modal modal = Modal.create("support", "Support")
                .addActionRows(ActionRow.of(email), ActionRow.of(body))
                .build();

        event.replyModal(modal).queue();
    }
}
@Override
public void onModalInteraction(@Nonnull ModalInteractionEvent event) {
    if (event.getModalId().equals("support")) {
        String email = event.getValue("email").getAsString();
        String body = event.getValue("body").getAsString();

        createSupportTicket(email, body);

        event.reply("Thanks for your request!").setEphemeral(true).queue();
    }
}

New Features

Changes

  • Fix typos in GatewayIntent Javadoc and contributing guidelines by @CheesyGamer77 in #2098
  • prevent creating OptionData with OptionType#UNKNOWN by @caneleex in #2101

Bug Fixes

Removed

Full Changelog: v5.0.0-alpha.10...v5.0.0-alpha.11

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.11")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.11</version> 
</dependency>

v5.0.0-alpha.10

18 Apr 19:26
24b0553
Compare
Choose a tag to compare

Overview

UserSnowflake

We changed User.fromId to now return UserSnowflake instead of User. This is done to prevent users from attempting code such as User.fromId(123).openPrivateChannel() which would never work.

With this we also changed some methods to no longer accept raw IDs as long and String. Instead you can now use method(User.fromId(long/String)), ie. ban(User.fromId(1234)).

Removed Methods:

  • Guild#ban(long/String), Guild#ban(long/String, int), Guild#ban(long/String, int, String)
  • Guild#kick(long/String), Guild#kick(long/String, String)
  • Guild#unban(long/String)
  • Guild#retrieveBanById(long/String)
  • Guild#addMember(String, long/String)
  • Guild#timeoutForById(long/String, Duration)
  • Guild#timeoutUntilById(long/String, TemporalAccessor)
  • Guild#removeTimeoutById(long/String)
  • Guild#addRoleToMember(long/String, Role)
  • Guild#removeRoleFromMember(long/String, Role)
  • AuditLogPaginationAction#user(long/String)

New Features

Changes

Bug Fixes

  • Fix NPE when cloning guild role with null icon (v5) by @Tais993 in #2063
  • Build the User from data in the Interaction if the User was not cached. by @oliver276 in #2060
  • Fix possible ClassCastException when removing reactions in threads by @RoanH in #2069
  • Fix rate limiter not shutting down if there is an empty bucket at shutdown by @Vankka in #2080

Removed

  • Remove mentioning members with ! by @Tais993 in #2081
  • A variety of overloads that accepted string/long/User/Member. Refer to UserSnowflake details above.

Full Changelog: v5.0.0-alpha.9...v5.0.0-alpha.10

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.10")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.10</version> 
</dependency>

v5.0.0-alpha.9

25 Feb 03:20
8cbc267
Compare
Choose a tag to compare

Changelog

This release is a follow up hotfix release for 5.0.0-alpha.6 that fixes issues caused by a bug in Discord (discord/discord-api-docs#4557). We felt it was faster to put out a baindaid than to wait for the fix from Discord's side.

Check out the patch notes on 5.0.0-alpha.6 for the cool new stuff.

New Features

N/A

Changes

Removed

  • Technically receiving ephemeral messages via MESSAGE_CREATE (Thus MessageReceivedEvent) is now no longer supported.
    • To be clear, this would be receiving a MessageReceivedEvent for an ephemeral message that the bot itself sent.

Full Changelog: v5.0.0-alpha.8...v5.0.0-alpha.9

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.9")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.9</version> 
</dependency>

v5.0.0-alpha.8 | alpha.6 Hotfix 2: Electric Boogaloo

23 Feb 02:57
1b1db83
Compare
Choose a tag to compare

Changelog

This release is a follow up hotfix release for 5.0.0-alpha.6 that wasn't completely mitigated by the 5.0.0-alpha.7 hotfix.

Check out the patch notes on 5.0.0-alpha.6 for the cool new stuff.

New Features

N/A

Changes

Removed

N/A

Full Changelog: v5.0.0-alpha.7...v5.0.0-alpha.8

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.8")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.8</version> 
</dependency>

v5.0.0-alpha.7 | Hotfix for alpha.6

22 Feb 01:45
c0742f9
Compare
Choose a tag to compare

Changelog

This release is a hotfix release for 5.0.0-alpha.6. Check out the patch notes on that version for the cool stuff.

New Features

N/A

Changes

  • Make javadocs fail on error by @Sanduhr32 in #2033
  • Fixes NPE from uncached users by @oliver276 in #2035
  • Make Messages for Interactions properly reference their channels instead of PrivateChannel by @oliver276 in #2038

Removed

N/A

Full Changelog: v5.0.0-alpha.6...v5.0.0-alpha.7

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.7")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.7</version> 
</dependency>

v5.0.0-alpha.6 | Attachment Options & Breaking Cleanup

20 Feb 21:41
094f41a
Compare
Choose a tag to compare

Changelog

This release includes a variety of breaking changes that were needed to either correctly model how Discord models things in their API or to better set us up for future development.

In this version, we added a new pattern for options on commands. You can now use getOption(name[, fallback], resolver) to easily get any optional arguments for your commands:

public void onSlashCommandInteraction(SlashCommandInteractionEvent event)
{
    //                              name      fallback          resolver
    
    // null if user is not a member of the guild (fallback not used, since option is mapped to a User instance)
    Member member = event.getOption("target", event::getMember, OptionMapping::getAsMember);
    // null if fallback is used (getAsUser cannot be null)
    User user =     event.getOption("target", null            , OptionMapping::getAsUser);
    // null fallback implied
    User nullable = event.getOption("target",                   OptionMapping::getAsUser); // <- implicit fallback null

    // real use-cases:
    int days = event.getOption("days", 7, OptionMapping::getAsInt); // optional ban days
    String reason = event.getOption("reason", "banned by mod", OptionMapping::getAsString); // optional ban reason
}

You can also now flip the iteration direction for MessageChannel.getIterableHistory. A common request as of late, was to get the first messages of a channel, which can now be accomplished by doing channel.getIterableHistory().reverse().takeAsync(1000).

New Features

Changes

  • [Breaking] Change PrivateChannel#getUser to handle API nullability by @oliver276 in #2012
  • [Breaking] Make getDefaultChannel return BaseGuildMessageChannel by @MinnDevelopment in #2016
  • [Semi-Breaking] Dont override latest message id on deletion event by @ishwi in #2013
  • [Breaking] Change some voice Regions and remove VOICE_CHANNEL_REGIONS set by @caneleex in #1962
  • Fix OptionData#setAutoComplete logic. by @portlek in #2003
  • Fix max file size limit in MessageAction by @Xirado in #2017
  • Fix javadoc warnings by @Chew in #1976
  • Fix misspelled ErrorResponse enum value by @Xirado in #2031
  • Fix missing cache cleanup for news/stage/thread channels by @Mitmocc in #2029

Removed

Full Changelog: v5.0.0-alpha.5...v5.0.0-alpha.6

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.6")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.6</version> 
</dependency>

v5.0.0-alpha.5 | Interactions Rework

29 Jan 18:26
374c061
Compare
Choose a tag to compare

Changelog

New Features

Interactions Rework

In this release we completely reworked how interactions work in JDA. The changes are significant, but they also bring with them a lot of improvements and new features. I would highly suggest that users take a look at the migration guide provided in the PR to better understand the changes.

Summary:

  • Reworks of:
    • Slash Commands
    • Select Menus
    • Buttons
  • Introduction of new functionality:
    • User Context Commands
    • Message Context Commands
    • Slash Command Auto Complete
    • An improved hierarchy for Interactions
    • An improved hierarchy for Components

Changes

  • Lots of documentation around threads by @oliver276 in #1838
  • Move requestToSpeak to StageChannel by @MinnDevelopment in #1978
  • ThreadChannel#getTimeCreated is now accurate for Threads created after 2022/01/22 by @caneleex in #1996
  • Limit new thread message count to 50 by @freya022 in #1980
  • ICategorizableChannel#getParentCategoryId now correctly returns null if not in a category by @Sanduhr32 in #1993
  • Change MessageEmbed#getUrl docs to mention representing the title url by @caneleex in #1975
  • Fixes setInvitable in ThreadChannelManager by @oliver276 in #2000

Removed

  • N/A

Full Changelog: v5.0.0-alpha.4...v5.0.0-alpha.5

Installation

Gradle

repositories {
    mavenCentral()
}
dependencies {
    implementation("net.dv8tion:JDA:5.0.0-alpha.5")
}

Maven

<dependency>
    <groupId>net.dv8tion</groupId>
    <artifactId>JDA</artifactId>
    <version>5.0.0-alpha.5</version> 
</dependency>