Poll
Implementation of discords Poll object as a Luau builder.
https://discord.com/developers/docs/resources/poll#poll-object
Summary
Properties
Poll.question :: Builders.MediaPoll.answers :: {Builders.Answer}Poll.duration :: numberPoll.allowMultiselect :: booleanPoll.layoutType :: api_types.PollLayoutTypeProperties
Section titled “Properties”question
Section titled “question”The question to be displayed in the poll.
answers
Section titled “answers”The array of possible answers for the poll.
duration
Section titled “duration”Duration in hours for the poll. Discord converts this to an expiry timestamp internally.
allowMultiselect
Section titled “allowMultiselect”Whether users can select multiple answers.
layoutType
Section titled “layoutType”The layout type of the poll display.
Methods
Section titled “Methods”addAnswer
Section titled “addAnswer”Poll : addAnswer ( answer ) -> Poll
Adds an answer to the poll.
Parameters
| answer: JSON |
Returns
| Poll |
setQuestion
Section titled “setQuestion”Poll : setQuestion ( question ) -> Poll
Sets the question for the poll.
Parameters
| question: JSON |
Returns
| Poll |
setDuration
Section titled “setDuration”Poll : setDuration ( hours ) -> Poll
Sets the duration of the poll in hours. Must be a positive integer. Discord uses this to calculate the expiry timestamp internally.
Parameters
| hours: number |
Returns
| Poll |
setMultiselect
Section titled “setMultiselect”Poll : setMultiselect ( multiselect ) -> Poll
Sets whether the poll allows multiple selections.
Parameters
| multiselect: boolean |
Returns
| Poll |
setLayoutType
Section titled “setLayoutType”Poll : setLayoutType ( layoutType ) -> Poll
Sets the layout type for the poll.
Parameters
| layoutType: PollLayoutType |
Returns
| Poll |
Poll : build ( ) -> JSON
Builds and returns the Poll JSON that can be parsed by the Discord API.
Returns
| JSON |
Functions
Section titled “Functions”Poll . new ( resource ) -> Poll
Responsible for creating a new Poll.
Parameters
| resource: { question: mediaBuilder.JSON?, answers: { answerBuilder.JSON, } |
Returns
| Poll |