Discord has recently released a new feature on their platform to start and vote in polls. These polls can now be sent in messages:
channel.sendMessage("Hello guys! Check my poll:")
.setPoll(
MessagePollData.builder("Which programming language is better?")
.addAnswer("Java", Emoji.fromFormatted("<:java:1006323566314274856>"))
.addAnswer("Kotlin", Emoji.fromFormatted("<:kotlin:295940257797636096>"))
.build())
.queue()
The poll automatically expires after a set duration, configurable in the MessagePollBuilder using setDuration. A poll can also be ended manually using endPoll or endPollById.
You can check the poll votes on a message using the new Message#getPoll:
MessagePoll poll = message.getPoll();
for (MessagePoll.Answer answer : poll.getAnswers()) {
System.out.printf("Poll Answer %s has %d votes\n", answer.getText(), answer.getVotes());
}
[!NOTE]
The votes for polls are eventually consistent and need to be recounted after the poll ends. You can check whether the votes are validated using MessagePoll#isFinalizedVotes.
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 show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@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 net.dv8tion:JDA from 5.0.0-beta.21 to 5.0.0-beta.23.
Release notes
Sourced from net.dv8tion:JDA's releases.
... (truncated)
Commits
fe12aac
Move MessagePollImpl to internal package7fa5984
Bump version to 5.0.0-beta.23d65b0ff
Refactor nexus publishing logic (#2653)e4860b4
Poll support (#2649)0ce30fd
FixCommandInteractionPayload#getCommandString
in autocomplete interactions...48a4111
Rewrite JDA readme (#2639)cf795c9
Update permission enum (#2654)827f29b
Update dependencies and use version catalog (#2652)6062ea4
added USER_MUST_BE_VERIFIED ErrorResponse (#2651)31419c0
Use typed assertions for RestActions (#2643)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 show