@grammyjs/types 3.20.0 → 3.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/checklist.d.ts ADDED
@@ -0,0 +1,70 @@
1
+ import type { User } from "./manage.js";
2
+ import type { Message, MessageEntity, ParseMode } from "./message.js";
3
+ /** Describes a task in a checklist. */
4
+ export interface ChecklistTask {
5
+ /** Unique identifier of the task */
6
+ id: number;
7
+ /** Text of the task */
8
+ text: string;
9
+ /** Special entities that appear in the task text */
10
+ text_entities?: MessageEntity[];
11
+ /** User that completed the task; omitted if the task wasn't completed */
12
+ completed_by_user?: User;
13
+ /** Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed */
14
+ completion_date?: number;
15
+ }
16
+ /** Describes a checklist. */
17
+ export interface Checklist {
18
+ /** Title of the checklist */
19
+ title: string;
20
+ /** Special entities that appear in the checklist title */
21
+ title_entities?: MessageEntity[];
22
+ /** List of tasks in the checklist */
23
+ tasks: ChecklistTask[];
24
+ /** True, if users other than the creator of the list can add tasks to the list */
25
+ others_can_add_tasks?: true;
26
+ /** True, if users other than the creator of the list can mark tasks as done or not done */
27
+ others_can_mark_tasks_as_done?: true;
28
+ }
29
+ /** Describes a task to add to a checklist. */
30
+ export interface InputChecklistTask {
31
+ /** Unique identifier of the task; must be positive and unique among all task identifiers currently present in the checklist */
32
+ id: number;
33
+ /** Text of the task; 1-100 characters after entities parsing */
34
+ text: string;
35
+ /** Mode for parsing entities in the text. See formatting options for more details. */
36
+ parse_mode?: string;
37
+ /** List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed. */
38
+ text_entities?: MessageEntity[];
39
+ }
40
+ /** Describes a checklist to create. */
41
+ export interface InputChecklist {
42
+ /** Title of the checklist; 1-255 characters after entities parsing */
43
+ title: string;
44
+ /** Mode for parsing entities in the title. See formatting options for more details. */
45
+ parse_mode?: ParseMode;
46
+ /** List of special entities that appear in the title, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, and custom_emoji entities are allowed. */
47
+ title_entities?: MessageEntity[];
48
+ /** List of 1-30 tasks in the checklist */
49
+ tasks: InputChecklistTask[];
50
+ /** Pass True if other users can add tasks to the checklist */
51
+ others_can_add_tasks?: boolean;
52
+ /** Pass True if other users can mark tasks as done or not done in the checklist */
53
+ others_can_mark_tasks_as_done?: true;
54
+ }
55
+ /** Describes a service message about checklist tasks marked as done or not done. */
56
+ export interface ChecklistTasksDone {
57
+ /** Message containing the checklist whose tasks were marked as done or not done. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
58
+ checklist_message?: Message;
59
+ /** Identifiers of the tasks that were marked as done */
60
+ marked_as_done_task_ids?: number[];
61
+ /** Identifiers of the tasks that were marked as not done */
62
+ marked_as_not_done_task_ids?: number[];
63
+ }
64
+ /** Describes a service message about tasks added to a checklist. */
65
+ export interface ChecklistTasksAdded {
66
+ /** Message containing the checklist to which the tasks were added. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
67
+ checklist_message?: Message;
68
+ /** List of tasks added to the checklist */
69
+ tasks: ChecklistTask[];
70
+ }
package/manage.d.ts CHANGED
@@ -563,7 +563,7 @@ export interface ChatInviteLink {
563
563
  export interface ChatAdministratorRights {
564
564
  /** True, if the user's presence in the chat is hidden */
565
565
  is_anonymous: boolean;
566
- /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */
566
+ /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege. */
567
567
  can_manage_chat: boolean;
568
568
  /** True, if the administrator can delete messages of other users */
569
569
  can_delete_messages: boolean;
@@ -583,7 +583,7 @@ export interface ChatAdministratorRights {
583
583
  can_edit_stories: boolean;
584
584
  /** True, if the administrator can delete stories posted by other users */
585
585
  can_delete_stories: boolean;
586
- /** True, if the administrator can post messages in the channel, or access channel statistics; for channels only */
586
+ /** True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only */
587
587
  can_post_messages?: boolean;
588
588
  /** True, if the administrator can edit messages of other users and can pin messages; for channels only */
589
589
  can_edit_messages?: boolean;
@@ -640,7 +640,7 @@ export interface ChatMemberAdministrator {
640
640
  can_be_edited: boolean;
641
641
  /** True, if the user's presence in the chat is hidden */
642
642
  is_anonymous: boolean;
643
- /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */
643
+ /** True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege. */
644
644
  can_manage_chat: boolean;
645
645
  /** True, if the administrator can delete messages of other users */
646
646
  can_delete_messages: boolean;
@@ -660,7 +660,7 @@ export interface ChatMemberAdministrator {
660
660
  can_edit_stories: boolean;
661
661
  /** True, if the administrator can delete stories posted by other users */
662
662
  can_delete_stories: boolean;
663
- /** True, if the administrator can post messages in the channel, or access channel statistics; for channels only */
663
+ /** True, if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only */
664
664
  can_post_messages?: boolean;
665
665
  /** True, if the administrator can edit messages of other users and can pin messages; for channels only */
666
666
  can_edit_messages?: boolean;
@@ -702,7 +702,7 @@ export interface ChatMemberRestricted {
702
702
  can_send_video_notes: boolean;
703
703
  /** True, if the user is allowed to send voice notes */
704
704
  can_send_voice_notes: boolean;
705
- /** True, if the user is allowed to send polls */
705
+ /** True, if the user is allowed to send polls and checklists */
706
706
  can_send_polls: boolean;
707
707
  /** True, if the user is allowed to send animations, games, stickers and use inline bots */
708
708
  can_send_other_messages: boolean;
@@ -766,7 +766,7 @@ export interface ChatPermissions {
766
766
  can_send_video_notes?: boolean;
767
767
  /** True, if the user is allowed to send voice notes */
768
768
  can_send_voice_notes?: boolean;
769
- /** True, if the user is allowed to send polls */
769
+ /** True, if the user is allowed to send polls and checklists */
770
770
  can_send_polls?: boolean;
771
771
  /** True, if the user is allowed to send animations, games, stickers and use inline bots */
772
772
  can_send_other_messages?: boolean;
package/message.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Checklist, ChecklistTasksAdded, ChecklistTasksDone } from "./checklist.js";
1
2
  import type { Chat, User } from "./manage.js";
2
3
  import type { InlineKeyboardMarkup } from "./markup.js";
3
4
  import type { PassportData } from "./passport.js";
@@ -89,6 +90,10 @@ export declare namespace Message {
89
90
  type VenueMessage = LocationMessage & MsgWith<"venue">;
90
91
  type LocationMessage = CommonMessage & MsgWith<"location">;
91
92
  type PaidMediaMessage = CommonMessage & MsgWith<"paid_media">;
93
+ type DirectMessagePriceChangedMessage = ServiceMessage & MsgWith<"direct_message_price_changed">;
94
+ type ChecklistMessage = CommonMessage & MsgWith<"checklist">;
95
+ type ChecklistTasksDoneMessage = ServiceMessage & MsgWith<"checklist_tasks_done">;
96
+ type ChecklistTasksAddedMessage = ServiceMessage & MsgWith<"checklist_tasks_added">;
92
97
  type NewChatMembersMessage = ServiceMessage & MsgWith<"new_chat_members">;
93
98
  type LeftChatMemberMessage = ServiceMessage & MsgWith<"left_chat_member">;
94
99
  type NewChatTitleMessage = ServiceMessage & MsgWith<"new_chat_title">;
@@ -172,6 +177,12 @@ export interface Message extends Message.MediaMessage {
172
177
  location?: Location;
173
178
  /** Message contains paid media; information about the paid media */
174
179
  paid_media?: PaidMediaInfo;
180
+ /** Message is a checklist */
181
+ checklist?: Checklist;
182
+ /** Service message: some tasks in a checklist were marked as done or not done */
183
+ checklist_tasks_done?: ChecklistTasksDone;
184
+ /** Service message: tasks were added to a checklist */
185
+ checklist_tasks_added?: ChecklistTasksAdded;
175
186
  /** New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) */
176
187
  new_chat_members?: User[];
177
188
  /** A member was removed from the group, information about them (this member may be the bot itself) */
@@ -243,6 +254,8 @@ export interface Message extends Message.MediaMessage {
243
254
  unique_gift?: UniqueGiftInfo;
244
255
  /** Service message: the price for paid messages has changed in the chat */
245
256
  paid_message_price_changed?: PaidMessagePriceChanged;
257
+ /** Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed */
258
+ direct_message_price_changed?: DirectMessagePriceChanged;
246
259
  /** Service message: video chat scheduled */
247
260
  video_chat_scheduled?: VideoChatScheduled;
248
261
  /** Service message: video chat started */
@@ -484,6 +497,8 @@ export interface ExternalReplyInfo {
484
497
  paid_media?: PaidMediaInfo;
485
498
  /** Message is a native poll, information about the poll */
486
499
  poll?: Poll;
500
+ /** Message is a checklist */
501
+ checklist?: Checklist;
487
502
  /** Message is a venue, information about the venue */
488
503
  venue?: Venue;
489
504
  }
@@ -1017,6 +1032,13 @@ export interface WriteAccessAllowed {
1017
1032
  /** True, if the access was granted when the bot was added to the attachment or side menu */
1018
1033
  from_attachment_menu?: boolean;
1019
1034
  }
1035
+ /** Describes a service message about a change in the price of direct messages sent to a channel chat. */
1036
+ export interface DirectMessagePriceChanged {
1037
+ /** True, if direct messages are enabled for the channel chat; false otherwise */
1038
+ are_direct_messages_enabled: boolean;
1039
+ /** The new number of Telegram Stars that must be paid by users for each direct message sent to the channel. Defaults to 0. */
1040
+ direct_message_star_count?: number;
1041
+ }
1020
1042
  /** This object represents a service message about a video chat scheduled in the chat. */
1021
1043
  export interface VideoChatScheduled {
1022
1044
  /** Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator */
package/methods.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { InputChecklist } from "./checklist.js";
1
2
  import type { InlineQueryResult, InlineQueryResultsButton } from "./inline.js";
2
3
  import type { LanguageCode } from "./langs.js";
3
4
  import type { AcceptedGiftTypes, BotCommand, BusinessConnection, ChatAdministratorRights, ChatFullInfo, ChatInviteLink, ChatMember, ChatMemberAdministrator, ChatMemberOwner, ChatPermissions, ForumTopic, UserChatBoosts, UserFromGetMe, UserProfilePhotos, WebhookInfo } from "./manage.js";
@@ -666,7 +667,7 @@ export type ApiMethods<F> = {
666
667
  question_parse_mode?: ParseMode;
667
668
  /** A list of special entities that appear in the poll question. It can be specified instead of question_parse_mode */
668
669
  question_entities?: MessageEntity[];
669
- /** A list of 2-10 answer options */
670
+ /** A list of 2-12 answer options */
670
671
  options: InputPollOption[];
671
672
  /** True, if the poll needs to be anonymous, defaults to True */
672
673
  is_anonymous?: boolean;
@@ -703,6 +704,38 @@ export type ApiMethods<F> = {
703
704
  /** @deprecated Use `reply_parameters` instead. */
704
705
  reply_to_message_id?: number;
705
706
  }): Message.PollMessage;
707
+ /** Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned. */
708
+ sendChecklist(args: {
709
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
710
+ business_connection_id: string;
711
+ /** Unique identifier for the target chat */
712
+ chat_id: number;
713
+ /** An object for the checklist to send */
714
+ checklist: InputChecklist;
715
+ /** Sends the message silently. Users will receive a notification with no sound. */
716
+ disable_notification?: boolean;
717
+ /** Protects the contents of the sent message from forwarding and saving */
718
+ protect_content?: boolean;
719
+ /** Unique identifier of the message effect to be added to the message */
720
+ message_effect_id?: string;
721
+ /** An object for description of the message to reply to */
722
+ reply_parameters?: ReplyParameters;
723
+ /** An object for an inline keyboard */
724
+ reply_markup?: InlineKeyboardMarkup;
725
+ }): Message.ChecklistMessage;
726
+ /** Use this method to edit a checklist on behalf of a connected business account. On success, the edited Message is returned. */
727
+ editMessageChecklist(args: {
728
+ /** Unique identifier of the business connection on behalf of which the message will be sent */
729
+ business_connection_id: string;
730
+ /** Unique identifier for the target chat */
731
+ chat_id: number;
732
+ /** Unique identifier for the target message */
733
+ message_id: number;
734
+ /** An object for the new checklist */
735
+ checklist: InputChecklist;
736
+ /** An object for the new inline keyboard for the message */
737
+ reply_markup?: InlineKeyboardMarkup;
738
+ }): Message.ChecklistMessage;
706
739
  /** Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned. */
707
740
  sendDice(args: {
708
741
  /** Unique identifier of the business connection on behalf of which the message will be sent */
@@ -823,7 +856,7 @@ export type ApiMethods<F> = {
823
856
  user_id: number;
824
857
  /** Pass True if the administrator's presence in the chat is hidden */
825
858
  is_anonymous?: boolean;
826
- /** Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. */
859
+ /** Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege. */
827
860
  can_manage_chat?: boolean;
828
861
  /** Pass True if the administrator can delete messages of other users */
829
862
  can_delete_messages?: boolean;
@@ -843,7 +876,7 @@ export type ApiMethods<F> = {
843
876
  can_edit_stories?: boolean;
844
877
  /** True if the administrator can delete stories posted by other users */
845
878
  can_delete_stories?: boolean;
846
- /** True if the administrator can post messages in the channel, or access channel statistics; for channels only */
879
+ /** Pass True if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only */
847
880
  can_post_messages?: boolean;
848
881
  /** True if the administrator can edit messages of other users and can pin messages; for channels only */
849
882
  can_edit_messages?: boolean;
@@ -1249,6 +1282,8 @@ export type ApiMethods<F> = {
1249
1282
  /** Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned. */
1250
1283
  for_channels?: boolean;
1251
1284
  }): ChatAdministratorRights;
1285
+ /** A method to get the current Telegram Stars balance of the bot. Requires no parameters. On success, returns a StarAmount object. */
1286
+ getMyStarBalance(): StarAmount;
1252
1287
  /** Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent. */
1253
1288
  editMessageText(args: {
1254
1289
  /** Unique identifier of the business connection on behalf of which the message to be edited was sent */
package/mod.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./api.js";
2
+ export * from "./checklist.js";
2
3
  export * from "./inline.js";
3
4
  export * from "./manage.js";
4
5
  export * from "./markup.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "Telegram Bot API type declarations for grammY",
5
5
  "main": "mod.js",
6
6
  "repository": {
package/payment.d.ts CHANGED
@@ -355,12 +355,16 @@ export interface GiftInfo {
355
355
  export interface UniqueGiftInfo {
356
356
  /** Information about the gift */
357
357
  gift: UniqueGift;
358
- /** Origin of the gift. Currently, either “upgrade” or “transfer” */
359
- origin: "upgrade" | "transfer";
358
+ /** Origin of the gift. Currently, either “upgrade” for gifts upgraded from regular gifts, “transfer” for gifts transferred from other users or channels, or “resale” for gifts bought from other users */
359
+ origin: "upgrade" | "transfer" | "resale";
360
360
  /** Unique identifier of the received gift for the bot; only present for gifts received on behalf of business accounts */
361
361
  owned_gift_id?: string;
362
362
  /** Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift */
363
363
  transfer_star_count?: number;
364
+ /** For gifts bought from other users, the price paid for the gift */
365
+ last_resale_star_count?: number;
366
+ /** Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now */
367
+ next_transfer_date?: string;
364
368
  }
365
369
  /** Describes a service message about a change in the price of paid messages within a chat. */
366
370
  export interface PaidMessagePriceChanged {
@@ -426,6 +430,8 @@ export interface OwnedGiftUnique {
426
430
  can_be_transferred?: true;
427
431
  /** Number of Telegram Stars that must be paid to transfer the gift; omitted if the bot cannot transfer the gift */
428
432
  transfer_star_count?: number;
433
+ /** Point in time (Unix timestamp) when the gift can be transferred. If it is in the past, then the gift can be transferred now */
434
+ next_transfer_date?: string;
429
435
  }
430
436
  /** Contains the list of gifts received and owned by a user or a chat. */
431
437
  export interface OwnedGifts {