Poll
ClassOn this page
Poll is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.
Properties
- Name
allowMultiselect- Type
any- Access
- readonly
- Description
- Instance field
Poll.allowMultiselect. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
answers- Type
any- Access
- readonly
- Description
- Instance field
Poll.answers. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
channelId- Type
any- Access
- readonly
- Description
- Instance field
Poll.channelId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
client- Type
any- Access
- readonly
- Description
- Owning Client instance used for REST, cache, and event dispatch.
- Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
expiresAt- Type
any- Access
- readonly
- Description
- Instance field
Poll.expiresAt. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
expiresTimestamp- Type
any- Access
- readonly
- Description
- Instance field
Poll.expiresTimestamp. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
expiry- Type
any- Access
- readonly
- Description
- Instance field
Poll.expiry. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
layoutType- Type
any- Access
- readonly
- Description
- Instance field
Poll.layoutType. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
message- Type
any- Access
- readonly
- Description
- Instance field
Poll.message. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
messageId- Type
any- Access
- readonly
- Description
- Instance field
Poll.messageId. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
partial- Type
any- Access
- readonly
- Description
- Instance field
Poll.partial. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
question- Type
any- Access
- readonly
- Description
- Instance field
Poll.question. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
raw- Type
any- Access
- readonly
- Description
- Instance field
Poll.raw. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
results- Type
any- Access
- readonly
- Description
- Instance field
Poll.results. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
- Name
resultsFinalized- Type
any- Access
- readonly
- Description
- Instance field
Poll.resultsFinalized. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Poll.
Methods
Poll:channel()
#Performs channel on this Poll. Call it from bot code when you need that operation on the current object.
Signature
Poll:channel() Parameters
No parameters.
Returns
Poll — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Poll
object:channel()Poll:endPoll()
#Performs end poll on this Poll. Call it from bot code when you need that operation on the current object.
Signature
Poll:endPoll(callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
Poll — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Poll
object:endPoll(function(err, result)
if err then error(err) end
end)Poll:fetch()
#Request a fresh copy of this resource from REST and update the cache.
Signature
Poll:fetch(callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
Poll — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Poll
object:fetch(function(err, result)
if err then error(err) end
end)Static members
-
Poll.FetchPollAnswerVotersOptions -
Poll.PollAnswer -
Poll.PollAnswerData -
Poll.PollData -
Poll.PollQuestionMedia
Examples
Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.
Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment
Version: discord 1.2.4 · runtime 1.0.0