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

public class GenericMessagePollVoteEvent extends GenericMessageEvent
Indicates that a poll vote was added/removed.
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):

  • Constructor Details

    • GenericMessagePollVoteEvent

      public GenericMessagePollVoteEvent(@Nonnull MessageChannel channel, long responseNumber, long messageId, long userId, long answerId)
  • Method Details

    • getUserId

      @Nonnull public String 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

      @Nonnull @CheckReturnValue public RestAction<User> retrieveUser()
      Retrieves the voting User.
      Returns:
      RestAction - Type: User
    • retrieveMember

      @Nonnull @CheckReturnValue public RestAction<Member> retrieveMember()
      Retrieves the voting Member.

      Note that banning a member will also fire MessagePollVoteRemoveEvent and no member will be available in those cases. An UNKNOWN_MEMBER error response should be the failure result.

      Returns:
      RestAction - Type: Member
      Throws:
      IllegalStateException - If this event is not from a guild
    • retrieveMessage

      @Nonnull @CheckReturnValue public RestAction<Message> retrieveMessage()
      Retrieves the message for this event.
      Simple shortcut for getChannel().retrieveMessageById(getMessageId()).

      The Message.getMember() method will always return null for the resulting message. To retrieve the member you can use getGuild().retrieveMember(message.getAuthor()).

      Returns:
      RestAction - Type: Message