Skip to content

GramIO API Reference / @gramio/contexts/dist / PollContext

Class: PollContext<Bot>

Defined in: contexts/index.d.ts:6257

This object contains information about a poll.

Documentation

Extends

Type Parameters

Type Parameter
Bot extends BotLike

Constructors

Constructor

new PollContext<Bot>(options): PollContext<Bot>

Defined in: contexts/index.d.ts:6260

Parameters

ParameterType
optionsPollContextOptions<Bot>

Returns

PollContext<Bot>

Overrides

Context.constructor


Constructor

new PollContext(...args): PollContext

Defined in: contexts/index.d.ts:6257

Parameters

ParameterType
...argsany[]

Returns

PollContext

Overrides

Context<Bot>.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
botpublicBot-Context.botcontexts/index.d.ts:4726
payloadpublicTelegramPollThe raw data that is used for this ContextPoll.payloadcontexts/index.d.ts:6259
update?publicTelegramUpdate-Context.updatecontexts/index.d.ts:4728
updateId?publicnumber-Context.updateIdcontexts/index.d.ts:4727
updateTypeprotectedUpdateName-Context.updateTypecontexts/index.d.ts:4729

Accessors

[toStringTag]

Get Signature

get [toStringTag](): string

Defined in: contexts/index.d.ts:4732

MDN

Returns

string

Inherited from

Context.[toStringTag]


allowsMultipleAnswers

Get Signature

get allowsMultipleAnswers(): boolean

Defined in: contexts/index.d.ts:627

true, if the poll allows multiple answers

Returns

boolean

Inherited from

Poll.allowsMultipleAnswers


closeDate

Get Signature

get closeDate(): number

Defined in: contexts/index.d.ts:649

Point in time (Unix timestamp) when the poll will be automatically closed

Returns

number

Inherited from

Poll.closeDate


correctOptionId

Get Signature

get correctOptionId(): number

Defined in: contexts/index.d.ts:633

0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.

Returns

number

Inherited from

Poll.correctOptionId


explanation

Get Signature

get explanation(): string

Defined in: contexts/index.d.ts:638

Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters

Returns

string

Inherited from

Poll.explanation


explanationEntities

Get Signature

get explanationEntities(): MessageEntity[]

Defined in: contexts/index.d.ts:643

Special entities like usernames, URLs, bot commands, etc. that appear in the explanation

Returns

MessageEntity[]

Inherited from

Poll.explanationEntities


id

Get Signature

get id(): string

Defined in: contexts/index.d.ts:609

Unique poll identifier

Returns

string

Inherited from

Poll.id


openPeriod

Get Signature

get openPeriod(): number

Defined in: contexts/index.d.ts:645

Amount of time in seconds the poll will be active after creation

Returns

number

Inherited from

Poll.openPeriod


options

Get Signature

get options(): PollOption[]

Defined in: contexts/index.d.ts:617

List of poll options

Returns

PollOption[]

Inherited from

Poll.options


question

Get Signature

get question(): string

Defined in: contexts/index.d.ts:611

Poll question, 1-300 characters

Returns

string

Inherited from

Poll.question


questionEntities

Get Signature

get questionEntities(): MessageEntity[]

Defined in: contexts/index.d.ts:615

Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions

Returns

MessageEntity[]

Inherited from

Poll.questionEntities


totalVoterCount

Get Signature

get totalVoterCount(): number

Defined in: contexts/index.d.ts:619

Total number of users that voted in the poll

Returns

number

Inherited from

Poll.totalVoterCount


type

Get Signature

get type(): TelegramPollType

Defined in: contexts/index.d.ts:625

Poll type, currently can be regular or quiz

Returns

TelegramPollType

Inherited from

Poll.type

Methods

clone()

clone(options?): PollContext

Defined in: contexts/index.d.ts:5273

Parameters

ParameterType
options?PollContextOptions

Returns

PollContext

Inherited from

CloneMixin.clone


hasCloseDate()

hasCloseDate(): this is Require<PollContext<Bot>, "closeDate">

Defined in: contexts/index.d.ts:6274

Checks if poll has closeDate property

Returns

this is Require<PollContext<Bot>, "closeDate">


hasCorrectOptionId()

hasCorrectOptionId(): this is Require<PollContext<Bot>, "correctOptionId">

Defined in: contexts/index.d.ts:6266

Checks if poll has correctOptionId property

Returns

this is Require<PollContext<Bot>, "correctOptionId">


hasExplanation()

hasExplanation(): this is Require<PollContext<Bot>, "explanation">

Defined in: contexts/index.d.ts:6268

Checks if poll has explanation property

Returns

this is Require<PollContext<Bot>, "explanation">


hasExplanationEntities()

hasExplanationEntities(): this is Require<PollContext<Bot>, "explanationEntities">

Defined in: contexts/index.d.ts:6270

Checks if poll has explanationEntities property

Returns

this is Require<PollContext<Bot>, "explanationEntities">


hasOpenPeriod()

hasOpenPeriod(): this is Require<PollContext<Bot>, "openPeriod">

Defined in: contexts/index.d.ts:6272

Checks if poll has openPeriod property

Returns

this is Require<PollContext<Bot>, "openPeriod">


is()

is<T>(rawTypes): this is InstanceType<ContextsMapping<Bot>[T]> & Bot["__Derives"]["global"] & Bot["__Derives"][T] & (Bot["__Derives"] extends {} ? Bot["__Derives"]["global"] & Bot["__Derives"][T] : {})

Defined in: contexts/index.d.ts:4735

Type Parameters

Type Parameter
T extends UpdateName

Parameters

ParameterType
rawTypesMaybeArray<SoftString<T>>

Returns

this is InstanceType<ContextsMapping<Bot>[T]> & Bot["__Derives"]["global"] & Bot["__Derives"][T] & (Bot["__Derives"] extends {} ? Bot["__Derives"]["global"] & Bot["__Derives"][T] : {})

Inherited from

Context.is


isAnonymous()

isAnonymous(): boolean

Defined in: contexts/index.d.ts:623

true, if the poll is anonymous

Returns

boolean

Inherited from

Poll.isAnonymous


isClosed()

isClosed(): boolean

Defined in: contexts/index.d.ts:621

true, if the poll is closed

Returns

boolean

Inherited from

Poll.isClosed


isQuiz()

isQuiz(): this is RequireValue<PollContext<Bot>, "type", Quiz>

Defined in: contexts/index.d.ts:6264

Returns true if current poll is a quiz

Returns

this is RequireValue<PollContext<Bot>, "type", Quiz>


isRegular()

isRegular(): this is RequireValue<PollContext<Bot>, "type", Regular>

Defined in: contexts/index.d.ts:6262

Returns true if current poll is a regular one

Returns

this is RequireValue<PollContext<Bot>, "type", Regular>