Skip to content

Commit b94ab73

Browse files
authored
Add typings for PollAnswer and update Poll (telegraf#999)
1 parent ff560ca commit b94ab73

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

typings/context.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export declare class TelegrafContext {
2424
message?: tt.IncomingMessage
2525
preCheckoutQuery?: tt.PreCheckoutQuery
2626
shippingQuery?: tt.ShippingQuery
27+
poll: tt.Poll
28+
pollAnswer: tt.PollAnswer
2729

2830
constructor(
2931
update: tt.Update,

typings/telegram-types.d.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export type UpdateType =
3030
'inline_query' |
3131
'message' |
3232
'pre_checkout_query' |
33-
'shipping_query'
33+
'shipping_query' |
34+
'poll' |
35+
'poll_answer'
3436

3537
export type MessageSubTypes =
3638
'voice' |
@@ -760,13 +762,27 @@ export interface PollOption {
760762
voter_count: number
761763
}
762764

765+
export interface PollAnswer {
766+
/** Unique poll identifier */
767+
poll_id: string
768+
769+
/** The user, who changed the answer to the poll */
770+
user: TT.User
771+
772+
/** 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. */
773+
option_ids: number[]
774+
}
775+
763776
export interface Poll {
764777
/** Unique poll identifier */
765778
id: string
766779

767780
/** Poll question, 1-255 characters */
768781
question: string
769782

783+
/** List of poll options */
784+
options: PollOption[]
785+
770786
/** Total number of users that voted in the poll */
771787
total_voter_count: number
772788

0 commit comments

Comments
 (0)