GramIO API Reference / @gramio/contexts/dist / PollContext
Class: PollContext<Bot>
Defined in: contexts/index.d.ts:6413
This object contains information about a poll.
Extends
Context<Bot>.Constructor<PollContext<Bot>>.Poll.CloneMixin<Bot,PollContext<Bot>,PollContextOptions<Bot>>
Type Parameters
| Type Parameter |
|---|
Bot extends BotLike |
Constructors
Constructor
new PollContext<
Bot>(options):PollContext<Bot>
Defined in: contexts/index.d.ts:6416
Parameters
| Parameter | Type |
|---|---|
options | PollContextOptions<Bot> |
Returns
PollContext<Bot>
Overrides
Constructor
new PollContext(...
args):PollContext
Defined in: contexts/index.d.ts:6413
Parameters
| Parameter | Type |
|---|---|
...args | any[] |
Returns
PollContext
Overrides
Context<Bot>.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
bot | public | Bot | - | Context.bot | contexts/index.d.ts:4856 |
payload | public | TelegramPoll | The raw data that is used for this Context | Poll.payload | contexts/index.d.ts:6415 |
update? | public | TelegramUpdate | - | Context.update | contexts/index.d.ts:4858 |
updateId? | public | number | - | Context.updateId | contexts/index.d.ts:4857 |
updateType | protected | UpdateName | - | Context.updateType | contexts/index.d.ts:4859 |
Accessors
[toStringTag]
Get Signature
get [toStringTag]():
string
Defined in: contexts/index.d.ts:4862
Returns
string
Inherited from
allowsMultipleAnswers
Get Signature
get allowsMultipleAnswers():
boolean
Defined in: contexts/index.d.ts:699
true, if the poll allows multiple answers
Returns
boolean
Inherited from
allowsRevoting
Get Signature
get allowsRevoting():
boolean
Defined in: contexts/index.d.ts:701
true, if the poll allows to change the chosen answer options
Returns
boolean
Inherited from
closeDate
Get Signature
get closeDate():
number
Defined in: contexts/index.d.ts:723
Point in time (Unix timestamp) when the poll will be automatically closed
Returns
number
Inherited from
correctOptionIds
Get Signature
get correctOptionIds():
number[]
Defined in: contexts/index.d.ts:707
Array of 0-based identifiers of the correct answer options. Available only for polls in quiz mode which are closed or were sent (not forwarded) by the bot or to the private chat with the bot.
Returns
number[]
Inherited from
description
Get Signature
get description():
string
Defined in: contexts/index.d.ts:727
Optional. Description of the poll; for polls inside the Message object only
Returns
string
Inherited from
descriptionEntities
Get Signature
get descriptionEntities():
MessageEntity[]
Defined in: contexts/index.d.ts:732
Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the description
Returns
Inherited from
explanation
Get Signature
get explanation():
string
Defined in: contexts/index.d.ts:712
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
explanationEntities
Get Signature
get explanationEntities():
MessageEntity[]
Defined in: contexts/index.d.ts:717
Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
Returns
Inherited from
id
Get Signature
get id():
string
Defined in: contexts/index.d.ts:681
Unique poll identifier
Returns
string
Inherited from
openPeriod
Get Signature
get openPeriod():
number
Defined in: contexts/index.d.ts:719
Amount of time in seconds the poll will be active after creation
Returns
number
Inherited from
options
Get Signature
get options():
PollOption[]
Defined in: contexts/index.d.ts:689
List of poll options
Returns
Inherited from
question
Get Signature
get question():
string
Defined in: contexts/index.d.ts:683
Poll question, 1-300 characters
Returns
string
Inherited from
questionEntities
Get Signature
get questionEntities():
MessageEntity[]
Defined in: contexts/index.d.ts:687
Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions
Returns
Inherited from
totalVoterCount
Get Signature
get totalVoterCount():
number
Defined in: contexts/index.d.ts:691
Total number of users that voted in the poll
Returns
number
Inherited from
type
Get Signature
get type():
TelegramPollType
Defined in: contexts/index.d.ts:697
Poll type, currently can be regular or quiz
Returns
Inherited from
Methods
clone()
clone(
options?):PollContext
Defined in: contexts/index.d.ts:5407
Parameters
| Parameter | Type |
|---|---|
options? | PollContextOptions |
Returns
PollContext
Inherited from
hasCloseDate()
hasCloseDate():
this is Require<PollContext<Bot>, "closeDate">
Defined in: contexts/index.d.ts:6430
Checks if poll has closeDate property
Returns
this is Require<PollContext<Bot>, "closeDate">
hasCorrectOptionIds()
hasCorrectOptionIds():
this is Require<PollContext<Bot>, "correctOptionIds">
Defined in: contexts/index.d.ts:6422
Checks if poll has correctOptionIds property
Returns
this is Require<PollContext<Bot>, "correctOptionIds">
hasExplanation()
hasExplanation():
this is Require<PollContext<Bot>, "explanation">
Defined in: contexts/index.d.ts:6424
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:6426
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:6428
Checks if poll has openPeriod property
Returns
this is Require<PollContext<Bot>, "openPeriod">
is()
is<
T>(rawTypes):this is InstanceType<ContextsMapping<Bot>[T]> & GetDerives<Bot, T> & (IsAny<Bot["__Derives"]> extends true ? {} : Bot["__Derives"] extends {} ? Bot["__Derives"]["global"] & Bot["__Derives"][T] : {})
Defined in: contexts/index.d.ts:4865
Type Parameters
| Type Parameter |
|---|
T extends UpdateName |
Parameters
| Parameter | Type |
|---|---|
rawTypes | MaybeArray<SoftString<T>> |
Returns
this is InstanceType<ContextsMapping<Bot>[T]> & GetDerives<Bot, T> & (IsAny<Bot["__Derives"]> extends true ? {} : Bot["__Derives"] extends {} ? Bot["__Derives"]["global"] & Bot["__Derives"][T] : {})
Inherited from
isAnonymous()
isAnonymous():
boolean
Defined in: contexts/index.d.ts:695
true, if the poll is anonymous
Returns
boolean
Inherited from
isClosed()
isClosed():
boolean
Defined in: contexts/index.d.ts:693
true, if the poll is closed
Returns
boolean
Inherited from
isQuiz()
isQuiz():
this is RequireValue<PollContext<Bot>, "type", Quiz>
Defined in: contexts/index.d.ts:6420
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:6418
Returns true if current poll is a regular one
Returns
this is RequireValue<PollContext<Bot>, "type", Regular>