Interface MessagePoll
public interface MessagePoll
Poll sent with messages.
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
One of the answers for a poll.static enum
The poll layout.static class
The question for a poll. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Maximum length of aMessagePollBuilder.addAnswer(String)
poll answer title} (55)static final int
Maximum amount ofpoll answers
(10)static final long
Maximumduration
of poll (168L)static final int
Maximum length of apoll question title
(300) -
Method Summary
Modifier and TypeMethodDescription@Unmodifiable List
<MessagePoll.Answer> The poll answers.The layout of the poll.The poll question, representing the title.The time when this poll will automatically expire.default boolean
Whether this poll has passed itsexpiration time
.boolean
Whether this poll is finalized and recounted.boolean
Whether this poll allows multiple answers to be selected.
-
Field Details
-
MAX_QUESTION_TEXT_LENGTH
static final int MAX_QUESTION_TEXT_LENGTHMaximum length of apoll question title
(300)- See Also:
-
MAX_ANSWER_TEXT_LENGTH
static final int MAX_ANSWER_TEXT_LENGTHMaximum length of aMessagePollBuilder.addAnswer(String)
poll answer title} (55)- See Also:
-
MAX_ANSWERS
static final int MAX_ANSWERSMaximum amount ofpoll answers
(10)- See Also:
-
MAX_DURATION_HOURS
static final long MAX_DURATION_HOURSMaximumduration
of poll (168L)- See Also:
-
-
Method Details
-
getLayout
The layout of the poll.- Returns:
- The poll layout, or
MessagePoll.LayoutType.UNKNOWN
if unknown
-
getQuestion
The poll question, representing the title.- Returns:
MessagePoll.Question
-
getAnswers
The poll answers.Each answer also has the current
votes
. The votes might not be finalized and might be incorrect before the poll has expired, seeisFinalizedVotes()
.- Returns:
- Immutable
List
ofMessagePoll.Answer
-
getTimeExpiresAt
The time when this poll will automatically expire.The author of the poll can always expire the poll manually, using
Message.endPoll()
.- Returns:
OffsetDateTime
representing the time when the poll expires automatically, or null if it never expires
-
isMultiAnswer
boolean isMultiAnswer()Whether this poll allows multiple answers to be selected.- Returns:
- True, if this poll allows multi selection
-
isFinalizedVotes
boolean isFinalizedVotes()Whether this poll is finalized and recounted.The votes for answers might be inaccurate due to eventual consistency, until this is true. Finalization does not mean the votes cannot change anymore, use
isExpired()
to check if a poll has ended.- Returns:
- True, if the votes have been precisely counted
-
isExpired
default boolean isExpired()Whether this poll has passed itsexpiration time
.- Returns:
- True, if this poll is expired.
-