Discord4J Versions Save

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

3.2.6

8 months ago

Discord4J v3.2.6

Closed issues: Milestone Commits: https://github.com/Discord4J/Discord4J/compare/3.2.5...3.2.6

⭐️ New features

  • Add support for setting custom activities https://github.com/Discord4J/Discord4J/commit/7613e3a4d7c6b58c6fb8d4c7c6668d430128ae17
    • ClientActivity#custom to set a bot custom status
    • ClientActivity#withState to include extra information to other activity types
    • Activity#getName will return the custom status if present
  • Add getDurationSeconds, getWaveform and getFlags to Attachment #1156
  • Add ReactionAddEvent#getMessageAuthorId method #1157
  • Implement Flags in Role #1160

🐞 Bug fixes

💜 Contributors

Thanks to our contributors and collaborators involved in this release: @Azn9 @Doc94

3.3.0-M2

10 months ago

Discord4J v3.3.0-M2 is the 2nd pre-release version supporting most if not all latest Discord features. It is available on Maven Central. We also expect this to be the last one before v3.3.0.

Milestone: 3.3.0-M2

Includes all changes from v3.2.5:

  • OAuth2 module
  • New username system
  • Scheduled events
  • Combined or partial store backends
  • and more bug fixes and improvements

🚀⭐️ New features in this branch

  • Implement forum channels (#1126)
  • Stage channels and instances (#1021)
  • Allow populating EmbedCreateSpec.Builder from existing EmbedData (#1137)

⚠️ API or behavior changes

  • Migrate to reactor.util.retry.Retry to be compatible with future Reactor versions (#1128)
    • If you used ResponseFunction.retryWhen(retryFactory), switch to ResponseFunction.retryWhen(Retry.withThrowable(retryFactory))

If you've been using 3.2.x branch, feel free to try it as migration should be quite simple.

But if you hit any problem or discover something that could be added here, please create a GitHub issue, discussion or join our support server and let us know:

Support Server Invite

3.2.5

10 months ago

Discord4J v3.2.5 is now available on Maven Central. Includes many bugfixes, improvements, new API and Discord features supported as well as one behavior change.

Stable branch: 3.2.x Closed issues: Milestone Full Changelog: https://github.com/Discord4J/Discord4J/compare/3.2.4...3.2.5

⚠️ Behavior change

  • Exclude message content intent from IntentSet.nonPrivileged()
    • Relevant for verified bots only, if your bot is unverified and under 100 guilds this change doesn't affect you
    • Since this is our default setting, if you didn't previously set intents, make sure to switch to the following set and keep previous behavior:
GatewayDiscordClient client = DiscordClient.create(System.getenv("token"))
        .gateway()
        .setEnabledIntents(IntentSet.nonPrivileged().or(IntentSet.of(MESSAGE_CONTENT)))
        .login()
        .block();

⭐️ New features

  • Add support for the new username system (#1147)
  • Add OAuth2 module (#1083)
    • Allowing you to support new command permissions system
    • Fetching user connections
    • Advanced bot authorization and webhooks
    • Use it by adding discord4j-oauth2 to your dependencies and check out our examples
  • Implement guild scheduled events (#1134)
    • New event payloads, ScheduledEvent
  • Support partial or multiple store backends (#1152)
    • Filling the role of our legacy MappingStoreService to the new API
    • SelectiveStoreLayout and StoreFlag abstractions
    • Can disable parts of the caching system or combine backends
  • Add GuildCommandRegistrar and GlobalCommandRegistrar (Example)
  • Add ActionRow#withAddedComponent and withRemovedComponent
  • Support deleteMessageSeconds in BanQuerySpec (#1146)
  • Implement fields for raid mention and safety alerts (#1148)
  • Add rateLimitPerUser to all supported channels
  • Implement Application Flags (#1131)

⚠️ Deprecations

  • BanQuerySpec#deleteMessageDays: check #1146
  • RestGuild#modifyOwnNickname: switch to modifyCurrentMember
  • Message#suppressEmbeds: to be removed (#1138)
  • Permission.MANAGE_EMOJIS_AND_STICKERS: for MANAGE_GUILD_EXPRESSIONS (#1141)

🚀 Enhancements

  • Update available permissions (#1141) (#1151)
  • Update message flags and types (#1142)
  • Update system channel flags
  • Ignore event type GUILD_JOIN_REQUEST_UPDATE and stop spamming log.warn on future unsupported events

🐞 Bug fixes

  • Propagate request cancellation to HttpClient (#1153)
    • Fix potential leaks due to unprocessed responses after a cancellation
  • Return proper values in AutoModActionExecutedEvent accessors (#1145)
  • Throw proper exception from AuditLogEntry.getResponsibleUser if it originated from a gateway event (#1136)
  • Fix wrong variable name in GetAutoModRuleByIdAction (#1127)

🔨 Dependency upgrades

  • discord-json 1.6.17
  • Reactor 2020.0.33
  • Gradle Wrapper to 7.6.1 (#1132)
  • Improve github workflow (#1102)

💜 Contributors

Thanks to all contributors and collaborators involved in this release! @indyteo @Doc94 @kashike @Gregory-Widmer @j0rdanit0 @Azn9

3.3.0-M1

1 year ago

Discord4J v3.3.0-M1 is a pre-release version that aims to support the latest Discord features. It is available on Maven Central and if you've been using 3.3 snapshots until now, it means a point of stability within the branch, before all remaining features are added.

Milestone: 3.3.0-M1

Includes forward-merged changes from: v3.2.1 v3.2.2 v3.2.3 v3.2.4

As well as changes between https://github.com/Discord4J/Discord4J/compare/b058afee1ac9397cf0d0a65009949c5fe91eceb0...62b2abf9ee82c9a314299b4e501408545e04445f (14 commits)

Branch diff up to this point (3.2.x vs 3.3.x): https://github.com/Discord4J/Discord4J/compare/1cbcf4190c05b20e54389307018471e95393f421...62b2abf9ee82c9a314299b4e501408545e04445f (107 commits)

🚀⭐️ Notable features

  • A new channel hierarchy #960 is required to support threads #958
  • Better spec methods to support type hierarchies like working with PermissionOverwrites Discord4J/discord-json#128
  • Text methods in voice channels

⚠️ API or behavior changes

  • If you used some methods in GuildMessageChannel like getCategoryId, you might need to migrate types
    • Some methods are now in CategorizableChannel and others in GuildChannel, check #960 for details
  • After #1021 if you use custom Stores, you need to implement these when migrating to 3.3.0
    • Added to GatewayDataUpdater: onStageInstanceCreate, onStageInstanceUpdate, onStageInstanceDelete
    • Added to DataAccessor: getStageInstanceByChannelId
  • Replace TextChannel with MessageChannel in MessageBulkDeleteEvent #1089

If you've been using 3.2.x branch, feel free to try it as migration should be quite simple.

and if you hit any problem or discover something that could be added here, please create a GitHub issue, discussion or join our support server and let us know:

Support Server Invite

3.2.4

1 year ago

Discord4J v3.2.4 is now available on Maven Central with bugfixes, new features and improvements. This is a recommended upgrade to all v3.2 users.

Voice module users must use this version or newer to properly connect to voice servers.

Stable branch: 3.2.x Closed issues: Milestone Full Changelog: https://github.com/Discord4J/Discord4J/compare/3.2.3...3.2.4

⭐️ New features

  • Add asAttachment() method to option value #1092
  • Add support for remaining select menu components #1101
  • Add support for AuditLogEntryCreateEvent #1113
  • Add ACTIVE_DEVELOPER User Flag #1105
  • Add missing Intents #1107
  • Add Flags to Member #1115
  • Add support for the AutoMod Feature #1074
  • Add support for command permission update event #1124
  • Add support for invite query params #1043
  • Add support to replace attachments when editing messages and replies 2d4093f01f91c297a6b4fe47c6cd9f70c63d3736 example usage

🚀 Enhancements

  • Change implementations of getX(id/name) methods in application commands objects #1097
  • Update Permission enum according to official discord docs #1100
  • Update voice IP discovery to the 74-byte UDP packet protocol 7057bfc05462dfeba24bd4853b18243fe79bfc5d

🐞 Bug fixes

  • Fix User flags not supporting long values #1087
  • Fix audit log messageId option using an incorrect key #1094
  • Fix invite getExpiration return depending on temporary membership value #1099
  • Fix workflow status badge #1114
  • Fix deadlock affecting Router because of ParkEmissionStrategy #1053

🔨 Dependency upgrades

💜 Contributors

Thanks to all contributors and collaborators involved in this release @Doc94 @dominoxp @j0rdanit0 @NovaFox161 @skykatik @superbob

3.2.3

1 year ago

Discord4J v3.2.3 is now available on Maven Central. We recommend this upgrade to all 3.2.x users as it includes multiple fixes and new features.

Stable branch: 3.2.x Closed issues: Milestone Commits: https://github.com/Discord4J/Discord4J/compare/3.2.2...3.2.3

⭐️ New features and enhancements

  • Add attachment support to createInteractionResponse f344ef2bfc1bfe4926d134a7a2e4b2767a3bd2d2
  • Add missing methods to GuildMemberUpdate #1066
  • Add guild sticker support #1055
    • For custom store support, check the new default methods here
  • Add support for UnicodeEmoji and Icon for Role #1061
    • New methods: Role#getIconUrl and Role#getUnicodeEmoji
  • Add missing Embed.Type for article and GIFV #1075
  • Handle unimplemented channel types using UnknownChannel entity, allowing access to underlying ChannelData structure 454d9c126167e4b5d7a6c98ce6008de8fd257786
    • However, these channels will be excluded from methods like Guild#getChannels
  • Add localization fields to application command objects #1080
  • Handle gateway resumeUrl, allowing less frequent reconnects in the future

🐞 Bug fixes

  • Move TweelNaclFast class to common module: fix issues due to duplicate class
  • Fix regex issue in RouteUtils under Android platform #1067
  • Fix incorrect return for Member#getEffectiveAvatarUrl #1065
  • Fix incorrectly caching VoiceStates for moved users under new stores #1070
  • Fix User#getBannerUrl calling an incorrect method #1069
  • Update Integration#isEnabled as Discord now treats this field as optional #1072
  • Fix WebhookService#executeWebhook response type if wait = false
  • Use then operator over cast in Webhook#execute
    • In the future this method may return Mono<Message>

🔨 Dependency upgrades

💜 Contributors

Thanks to all contributors and collaborators involved in this release @skykatik @NovaFox161 @Doc94 @dominoxp

3.2.2

2 years ago

Discord4J 3.2.2 is now available on Maven Central, adding support for modal interactions, multiple new features and some bug fixes.

Stable branch: 3.2.x Closed issues: Milestone Commits: https://github.com/Discord4J/Discord4J/compare/3.2.1...3.2.2

⭐️ New features

  • Modal interactions #1059
    • New method: presentModal, takes one or more ActionRow containing TextInput components
    • New event type: ModalSubmitInteractionEvent
    • Example code here
    • Docs to be added soon
  • User timeouts #1051
    • New method in Member#edit: communicationDisabledUntil
  • Add support for locale fields on interaction
    • New methods: Interaction#getUserLocale and Interaction#getGuildLocale
  • Add support for attachment option type on interactions
    • New method: getAttachments in the resolved interaction object
    • New value: ApplicationCommandOption.Type#ATTACHMENT (type 11)
    • See this example for usage details
  • Add missing message flags and types #1042
  • Add equals/hashCode to rest entities #1052
  • Add missing ChangeKey fields in audit logs #1054
  • Add endpoint interactions validator using TweetNaclFast #1058

🐞 Bug fixes

  • Fix channel deletions removing parent guild voice states from cache #1044
  • Fix allowed mentions behavior with new specs #1014
  • Fix incorrect type of USE_SLASH_COMMANDS permission value
  • Prevent NPE from using deprecated method Guild#getRegionId

📔 Documentation

  • Fix javadoc issue where using the search bar gave an invalid url

🔨 Dependency upgrades

💜 Contributors

Thanks to all contributors and collaborators involved in this release @Doc94 @brielmayer @NovaFox161 @AnthonySkoury

3.2.1

2 years ago

Discord4J 3.2.1 is now available on Maven Central, including bug fixes and new features like autocomplete interactions and support for text in voice channels, among others.

⚠️ Upgrade considerations

  • Experimental API change: if you directly imported InteractionCreateEvent class to use methods like deferReply, reply, etc. You'll need to migrate the type to DeferrableInteractionEvent due to the implementation of autocomplete interactions in #1033. Check the linked issue for details.

⭐️ New features

  • Autocomplete application commands #1033 #1029
  • Get, edit and delete helper methods to Webhook #1026
  • Support text in voice channels 3c1cd1a9c554ce90bf4d28bb9d64c88af053c0f3
  • Member guild avatars #1013
  • Add resolve methods to context menu interactions #1019 #1007
    • getResolvedMessage and getResolvedUser
  • New channel_types in command options: getAllowedChannelTypes
  • Add PermissionOverwrite#getData #1024
  • Add min/max value support in app command options 8990d51c3ae2f3fd864cff31a314c5c8207347ae
  • New SessionInvalidatedEvent to be notified of that gateway lifecycle event #1036
  • New activity flags fe819179f7b47a28e7adc03407fd9ca46993300e
  • New user flag e85a2579417f47ab9ac176ac982e51a42b36b0be
  • New channel flag 8c49a847dafcf84f4b41f41926249abb2fcb9a82

🐞 Bug fixes

  • Fix global allowed mentions not taking precedence with new specs #1015 #1014
  • Fix cast exception on Guild#createCategory 8bd22e5117c496b43c105ef3455f07f8a7cce737 #1030
  • Fix issue in AuditLogEntry#getChange #1037
  • Fix performance issue when adding list elements to cached guilds #1039
  • Fix incorrect user id in GatewayDataUpdater#onMessageCreate #1041
  • Return proper mention for the everyone role

📔 Documentation

  • Include generated Spec sources in sources jar #1022
  • Update embeds example in README #1040

🔨 Dependency upgrades

💜 Contributors

Thanks to all contributors and collaborators involved in this release @skykatik @Alex1304 @j0rdanit0 @napstr @Doc94 @NovaFox161 @darichey @danthonywalker

3.2.0

2 years ago

A new major release of Discord4J is now available for general usage, built from months of feedback, ideas and contributions from small and large bot owners alike. We'd like to thank all collaborators, contributors, GitHub sponsors and users working with us towards this release.

Major releases allow us to reshape some architectural concepts required to either match Discord evolution as a platform, or new features we want to implement, so they come with migration steps that are detailed in our docs page for Migration Notes and API changes.

What's new in v3.2

Discord features

  • Discord API v8, providing richer error messages and mandatory gateway intents
  • Changes needed in preparation for threads, to be available in 3.3.0 snapshots
  • Reduced queries to Store as user data is provided by Discord in some payloads
  • Improved API over recent Discord additions, such as Slash commands initial response handling and resolved objects

Entity cache

Our entity cache (named Store in D4J) has been reworked and abstracted to enable more flexible implementations that can go beyond a fixed 9-Store scheme. A new default in-memory Store is provided and previous implementations are still compatible. Thanks a lot to @Alex1304 for designing and contributing this key feature for future performance improvements.

Deeper org.immutables library usage, improving our deserialization process to reduce memory usage.

New specs API

Immutable Specs are now available in Discord4J, enabling more ways of working with API requests through Core module: easier templating, builders and Mono so you can organize your bot code to your liking. This is a very new feature so we expect to get feedback from you to make it better. Older Spec API (based on Consumer) is still available for gradual migration.

Check our docs page for Specs for more details.

Better audit log API

A major release let us fix how to work better with audit logs in D4J, requiring some API changes.

Reactor changes

We can get the most of Reactor v2020.x changes:

  • Processor usage is deprecated and replaced with Sinks/EmitResult API for sending signals programmatically
  • Improvements to retry configurations with RetrySpec
  • Non-blocking DNS resolver in Reactor Netty 1.0.x

What's next

Threads support

Discord4J v3.3 will soon start development to support threads and improve support on stage channels, features that require additional API changes.

OAuth2

We have a great contribution to support OAuth2 as a module in D4J from @cottoncammy, unfortunately we couldn't add it to v3.2.0 on time without affecting the planned scope. Our goal is to merge it to v3.3.x branch after threads are settled in the D4J API.

Documentation

Deeper involvement in our Documentation project is planned, providing more how-to guides and sections to quickly implement most common patterns. We'll make use of the Diataxis framework to organize our articles.

Reactor

We detected places where improvements can be made after a better understanding of Reactor as a runtime, like a more compact gateway implementation that can work better with back-pressure, mainly for standalone use cases. We would like to explore these in the upcoming releases.

Distributed architectures

As we remove roadblocks like improving the performance of D4J handling an initial storm of payloads in a distributed bot, we want to spend some time building Store/Connect project implementations that can work more efficiently at large scale.

Changelog

3.2.0

  • #1005 New methods to work with interactions
    • getReply, editReply, deleteReply, createFollowup, editFollowup, deleteFollowup
    • Prefer deferReply and deferEdit over acknowledge
  • #1001 Add support for context menu commands
    • Check the release notes from 3.1.8 for upgrade considerations
  • #966 Fix nullability annotations in new specs API
  • Add MultipartRequest support to message edit and interaction edit route
  • Upgrade to Reactor 2020.0.11
  • Fix ephemeral messages filtering
  • Fix missing guildId in stored VoiceStates
  • More details: Milestone

RC3

  • #982 Add PartialMember implementation for message mentions
  • #980 Add ApplicationCommandInteraction::getResolved
  • #977 Add support for user banner and bannerAccentColor
  • #975 Add InteractionValidator for webhook-mode interactions
  • deac3ac3 Allow editing interaction messages with a MultipartRequest
  • More details: Milestone

RC2

  • #959 Modify channel hierarchy in preparation for threads
  • #964 Deserialize interaction message on demand
  • More details: Milestone

RC1

  • #799 New default JDK store, under the new entity cache system
  • #927 Immutable Specs, a new way of working with API requests
  • More details: Milestone

M4

  • #924 Evict stale RequestStreams to reduce memory usage over time
  • #898 Make use of UserData when possible
  • #902 Custom baseUrl for DiscordWebClient
  • #899 Change log improvements #428 #851
  • More details: Milestone

Early milestones

  • #874 Improve API for setting a client's status and activity
  • #873 Allow passing in member for calculating effective permissions
  • #871 Add methods to EntityRetriever and RestClient to make getting self Member easier
  • #796 Migrate to Reactor 2020
  • #788 New entity cache abstraction
  • #785 #787 Upgrade to Discord API v8
  • #742 Implement Webhook Execute #547
  • More details: M2 and M3

💜 Contributors

@TheNumberOne @qwbarch @Shadorc @Alex1304 @j0rdanit0 @napstr @NovaFox161 @skykatik @HunHage @darichey @YelsewB @Krakenied @Masterzach32 @Azn9 @keltrycroft @quanticc and everyone from the 3.1.x series changes that were included in this release:

3.1.8

2 years ago

Discord4J 3.1.8 is now available on Maven Central. We recommend this upgrade to all 3.1.x users, adds support for context menus, includes many bugfixes along with an interactions API change.

⚠️ Upgrade considerations

  • Experimental API change: after implementing context menus in #1001, we have renamed some classes to align them with Discord and a new event hierarchy
  • This change is also applied to our 3.2.x branch
Previous Current
SlashCommandEvent ChatInputInteractionEvent
ComponentInteractEvent ComponentInteractionEvent
ButtonInteractEvent ButtonInteractionEvent
SelectMenuInteractEvent SelectMenuInteractionEvent

📔 Documentation

  • A huge effort has been done to restructure our official docs while also adding many new articles, improving tutorials and examples, detailing new how-to guides about interactions, and migration details for the upcoming v3.2.0
  • Feel free to suggest changes through our support server or directly submit a PR to our docs repo: https://github.com/Discord4J/documentation

⭐️ New features

  • Add support for context menu commands #1001 #1004
  • Add SelectMenu#disabled
  • Add NUMBER command option type and asDouble option value/choice #971
  • Add "Get Original Interaction Response" endpoint #986
  • Allow MENTIONABLE to be parsed as a snowflake
  • Remove filter from ephemeral messages #996 #995

🐞 Bug fixes

  • Fix ReactiveEventAdapter calling only the first hook when multiple ones are compatible #978
  • Fix SelectMenu#getPlaceholder returning customId #985
  • Fix error when retrieving the region name of a guild #999
  • Fix response type for command permissions edit routes
  • Fix Interactions API matching (backport of #981)

🔨 Dependency upgrades

💜 Contributors

Thanks to our contributors, collaborators and sponsors who helped in this release! @Lukellmann @Alex1304 @darichey @skykatik @Sophon96 @NovaFox161 @WeeskyBDW