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).
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps JDA from 5.0.0-alpha.5 to 5.0.0-alpha.6.
Release notes
Sourced from JDA's releases.
... (truncated)
Commits
094f41a
Release 5.0.0-alpha.62d758de
Fix misspelled ErrorResponse enum value (#2031)512bd82
Fix javadoc warnings (#1976)6d1b400
Change some voice Regions and remove VOICE_CHANNEL_REGIONS set (#1962)450d2a0
Remove StoreChannel (#2011)33244b6
Change PrivateChannel#getUser to handle API nullability (#2012)09f75ff
Add PaginationAction#order (#1945)ce9b22d
Make getDefaultChannel return BaseGuildMessageChannel (#2016)bcb71aa
Dont override latest message id on deletion event (#2013)e328d17
Add missing cache cleanup for news/stage/thread channels (#2029)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)