DiscordLua
discorddiscord
v1.2.4
Install

Poll

Class
On 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.

class Module 1.2.4 REST Source

Properties

Poll.allowMultiselect

# readonly
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.

Poll.answers

# readonly
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.

Poll.channelId

# readonly
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.

Poll.client

# readonly
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.

Poll.expiresAt

# readonly
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.

Poll.expiresTimestamp

# readonly
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.

Poll.expiry

# readonly
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.

Poll.layoutType

# readonly
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.

Poll.message

# readonly
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.

Poll.messageId

# readonly
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.

Poll.partial

# readonly
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.

Poll.question

# readonly
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.

Poll.raw

# readonly
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.

Poll.results

# readonly
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.

Poll.resultsFinalized

# readonly
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

lua
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

NameTypeRequiredBehavior
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Poll — the same instance, for chaining.

Example

lua
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

NameTypeRequiredBehavior
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

Poll — the same instance, for chaining.

Example

lua
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.

ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc