Class GenericMessagePollVoteEvent
java.lang.Object
net.dv8tion.jda.api.events.Event
net.dv8tion.jda.api.events.message.GenericMessageEvent
net.dv8tion.jda.api.events.message.poll.GenericMessagePollVoteEvent
- All Implemented Interfaces:
GenericEvent
- Direct Known Subclasses:
MessagePollVoteAddEvent
,MessagePollVoteRemoveEvent
Indicates that a poll vote was added/removed.
Every MessagePollVoteEvent is derived from this event and can be casted.
Every MessagePollVoteEvent is derived from this event and can be casted.
Can be used to detect both remove and add events.
Requirements
These events require at least one of the following intents (Will not fire at all if neither is enabled):
GUILD_MESSAGE_POLLS
to work in guild text channelsDIRECT_MESSAGE_POLLS
to work in private channels
-
Constructor Summary
ConstructorDescriptionGenericMessagePollVoteEvent
(MessageChannel channel, long responseNumber, long messageId, long userId, long answerId) -
Method Summary
Methods inherited from class net.dv8tion.jda.api.events.message.GenericMessageEvent
getChannel, getChannelType, getGuild, getGuildChannel, getJumpUrl, getMessageId, getMessageIdLong, isFromGuild, isFromThread, isFromType
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getRawData, getResponseNumber, toString
-
Constructor Details
-
GenericMessagePollVoteEvent
public GenericMessagePollVoteEvent(@Nonnull MessageChannel channel, long responseNumber, long messageId, long userId, long answerId)
-
-
Method Details
-
getUserId
The id of the voting user.- Returns:
- The user id
-
getUserIdLong
public long getUserIdLong()The id for the voting user.- Returns:
- The user id
-
getAnswerId
public long getAnswerId()The id of the answer, usually the ordinal position.
The first answer options is usually 1.- Returns:
- The answer id
-
retrieveUser
Retrieves the votingUser
.- Returns:
RestAction
- Type:User
-
retrieveMember
Retrieves the votingMember
.Note that banning a member will also fire
MessagePollVoteRemoveEvent
and no member will be available in those cases. AnUNKNOWN_MEMBER
error response should be the failure result.- Returns:
RestAction
- Type:Member
- Throws:
IllegalStateException
- If this event is not from a guild
-
retrieveMessage
Retrieves the message for this event.
Simple shortcut forgetChannel().retrieveMessageById(getMessageId())
.The
Message.getMember()
method will always return null for the resulting message. To retrieve the member you can usegetGuild().retrieveMember(message.getAuthor())
.- Returns:
RestAction
- Type:Message
-