@grammyjs/types 3.24.0 → 3.25.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/manage.d.ts CHANGED
@@ -660,6 +660,8 @@ export interface ChatAdministratorRights {
660
660
  can_change_info: boolean;
661
661
  /** True, if the user is allowed to invite new users to the chat */
662
662
  can_invite_users: boolean;
663
+ /** True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. */
664
+ can_manage_tags?: boolean;
663
665
  /** True, if the administrator can post stories to the chat */
664
666
  can_post_stories: boolean;
665
667
  /** True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive */
@@ -739,6 +741,8 @@ export interface ChatMemberAdministrator {
739
741
  can_change_info: boolean;
740
742
  /** True, if the user is allowed to invite new users to the chat */
741
743
  can_invite_users: boolean;
744
+ /** True, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. */
745
+ can_manage_tags?: boolean;
742
746
  /** True, if the administrator can post stories to the chat */
743
747
  can_post_stories: boolean;
744
748
  /** True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive */
@@ -764,6 +768,8 @@ export interface ChatMemberMember {
764
768
  status: "member";
765
769
  /** Information about the user */
766
770
  user: User;
771
+ /** Tag of the member */
772
+ tag?: string;
767
773
  /** Date when the user's subscription will expire; Unix time */
768
774
  until_date?: number;
769
775
  }
@@ -773,6 +779,8 @@ export interface ChatMemberRestricted {
773
779
  status: "restricted";
774
780
  /** Information about the user */
775
781
  user: User;
782
+ /** Tag of the member */
783
+ tag?: string;
776
784
  /** True, if the user is a member of the chat at the moment of the request */
777
785
  is_member: boolean;
778
786
  /** True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues */
@@ -799,6 +807,8 @@ export interface ChatMemberRestricted {
799
807
  can_change_info: boolean;
800
808
  /** True, if the user is allowed to invite new users to the chat */
801
809
  can_invite_users: boolean;
810
+ /** True, if the user is allowed to edit their own tag */
811
+ can_edit_tag: boolean;
802
812
  /** True, if the user is allowed to pin messages */
803
813
  can_pin_messages: boolean;
804
814
  /** True, if the user is allowed to create forum topics */
@@ -863,6 +873,8 @@ export interface ChatPermissions {
863
873
  can_change_info?: boolean;
864
874
  /** True, if the user is allowed to invite new users to the chat */
865
875
  can_invite_users?: boolean;
876
+ /** True, if the user is allowed to edit their own tag */
877
+ can_edit_tag?: boolean;
866
878
  /** True, if the user is allowed to pin messages. Ignored in public supergroups */
867
879
  can_pin_messages?: boolean;
868
880
  /** True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages */
package/message.d.ts CHANGED
@@ -26,6 +26,8 @@ export declare namespace Message {
26
26
  direct_messages_topic?: DirectMessagesTopic;
27
27
  }
28
28
  interface CommonMessage extends ServiceMessage {
29
+ /** Tag or custom title of the sender of the message; for supergroups only */
30
+ sender_tag?: string;
29
31
  /** If the sender of the message boosted the chat, the number of boosts added by the user */
30
32
  sender_boost_count?: number;
31
33
  /** The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account. */
@@ -74,7 +76,7 @@ export declare namespace Message {
74
76
  caption_entities?: MessageEntity[];
75
77
  }
76
78
  interface MediaMessage extends CaptionableMessage {
77
- /** The unique identifier of a media message group this message belongs to */
79
+ /** The unique identifier inside this chat of a media message group this message belongs to */
78
80
  media_group_id?: string;
79
81
  /** True, if the message media is covered by a spoiler animation */
80
82
  has_media_spoiler?: true;
@@ -341,6 +343,19 @@ Links `tg://user?id=<user_id>` can be used to mention a user by their identifier
341
343
 
342
344
  You can find the list of programming and markup languages for which syntax highlighting is supported at [libprisma#supported-languages](https://github.com/TelegramMessenger/libprisma#supported-languages).
343
345
 
346
+ #### Date-time entity formatting
347
+
348
+ Date-time entity formatting is specified by a format string, which must adhere to the following regular expression: `r|w?[dD]?[tT]?`.
349
+
350
+ If the format string is empty, the underlying text is displayed as-is; however, the user can still receive the underlying date in their local format. When populated, the format string determines the output based on the presence of the following control characters:
351
+
352
+ - `r`: Displays the time relative to the current time. Cannot be combined with any other control characters.
353
+ - `w`: Displays the day of the week in the user's localized language.
354
+ - `d`: Displays the date in short form (e.g., “17.03.22”).
355
+ - `D`: Displays the date in long form (e.g., “March 17, 2022”).
356
+ - `t`: Displays the time in short form (e.g., “22:45”).
357
+ - `T`: Displays the time in long form (e.g., “22:45:00”).
358
+
344
359
  #### MarkdownV2 style
345
360
  To use this mode, pass *MarkdownV2* in the *parse_mode* field. Use the following syntax in your message:
346
361
 
@@ -354,6 +369,10 @@ __underline__
354
369
  [inline URL](http://www.example.com/)
355
370
  [inline mention of a user](tg://user?id=123456789)
356
371
  ![👍](tg://emoji?id=5368324170671202286)
372
+ ![22:45 tomorrow](tg://time?unix=1647531900&format=wDT)
373
+ ![22:45 tomorrow](tg://time?unix=1647531900&format=t)
374
+ ![22:45 tomorrow](tg://time?unix=1647531900&format=r)
375
+ ![22:45 tomorrow](tg://time?unix=1647531900)
357
376
  `inline fixed-width code`
358
377
  `​`​`
359
378
  pre-formatted fixed-width code block
@@ -382,6 +401,7 @@ Please note:
382
401
  - In case of ambiguity between `italic` and `underline` entities `__` is always greedily treated from left to right as beginning or end of an `underline` entity, so instead of `___italic underline___` use `___italic underline_**__`, adding an empty bold entity as a separator.
383
402
  - A valid emoji must be provided as an alternative value for the custom emoji. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker.
384
403
  - Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.
404
+ - See date-time entity formatting for more details about supported date-time formats.
385
405
 
386
406
  #### HTML style
387
407
  To use this mode, pass *HTML* in the *parse_mode* field. The following tags are currently supported:
@@ -396,6 +416,10 @@ To use this mode, pass *HTML* in the *parse_mode* field. The following tags are
396
416
  <a href="http://www.example.com/">inline URL</a>
397
417
  <a href="tg://user?id=123456789">inline mention of a user</a>
398
418
  <tg-emoji emoji-id="5368324170671202286">👍</tg-emoji>
419
+ <tg-time unix="1647531900" format="wDT">22:45 tomorrow</tg-time>
420
+ <tg-time unix="1647531900" format="t">22:45 tomorrow</tg-time>
421
+ <tg-time unix="1647531900" format="r">22:45 tomorrow</tg-time>
422
+ <tg-time unix="1647531900">22:45 tomorrow</tg-time>
399
423
  <code>inline fixed-width code</code>
400
424
  <pre>pre-formatted fixed-width code block</pre>
401
425
  <pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>
@@ -412,6 +436,7 @@ Please note:
412
436
  - Programming language can't be specified for standalone `code` tags.
413
437
  - A valid emoji must be used as the content of the tg-emoji tag. The emoji will be shown instead of the custom emoji in places where a custom emoji cannot be displayed (e.g., system notifications) or if the message is forwarded by a non-premium user. It is recommended to use the emoji from the emoji field of the custom emoji sticker.
414
438
  - Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.
439
+ - See date-time entity formatting for more details about supported date-time formats.
415
440
 
416
441
  #### Markdown style
417
442
  This is a legacy mode, retained for backward compatibility. To use this mode, pass *Markdown* in the *parse_mode* field. Use the following syntax in your message:
@@ -438,7 +463,7 @@ Please note:
438
463
  export type ParseMode = "Markdown" | "MarkdownV2" | "HTML";
439
464
  export declare namespace MessageEntity {
440
465
  interface AbstractMessageEntity {
441
- /** Type of the entity. Currently, can be “mention” (`@username`), “hashtag” (#hashtag or `#hashtag@chatusername`), “cashtag” ($USD or `$USD@chatusername`), “bot_command” (`/start@jobs_bot`), “url” (https://telegram.org), “email” (`do-not-reply@telegram.org`), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) */
466
+ /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag or #hashtag@chatusername), “cashtag” ($USD or $USD@chatusername), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “blockquote” (block quotation), “expandable_blockquote” (collapsed-by-default block quotation), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers), or “date_time” (for formatted date and time) */
442
467
  type: string;
443
468
  /** Offset in UTF-16 code units to the start of the entity */
444
469
  offset: number;
@@ -468,9 +493,16 @@ export declare namespace MessageEntity {
468
493
  /** For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker */
469
494
  custom_emoji_id: string;
470
495
  }
496
+ interface DateTimeMessageEntity extends AbstractMessageEntity {
497
+ type: "date_time";
498
+ /** For “date_time” only, the Unix time associated with the entity */
499
+ unix_time: number;
500
+ /** For “date_time” only, the string that defines the formatting of the date and time. See date-time entity formatting for more details. */
501
+ date_time_format: "r" | `${"w" | ""}${"d" | "D" | ""}${"t" | "T" | ""}`;
502
+ }
471
503
  }
472
504
  /** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
473
- export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity;
505
+ export type MessageEntity = MessageEntity.CommonMessageEntity | MessageEntity.CustomEmojiMessageEntity | MessageEntity.PreMessageEntity | MessageEntity.TextLinkMessageEntity | MessageEntity.TextMentionMessageEntity | MessageEntity.DateTimeMessageEntity;
474
506
  /** This object contains information about the quoted part of a message that is replied to by the given message. */
475
507
  export interface TextQuote {
476
508
  /** Text of the quoted part of a message that is replied to by the given message */
package/methods.d.ts CHANGED
@@ -110,7 +110,7 @@ export type ApiMethods<F> = {
110
110
  /** @deprecated Use `reply_parameters` instead. */
111
111
  reply_to_message_id?: number;
112
112
  }): Message.TextMessage;
113
- /** Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns True on success. */
113
+ /** Use this method to stream a partial message to a user while the message is being generated. Returns True on success. */
114
114
  sendMessageDraft(args: {
115
115
  /** Unique identifier for the target private chat */
116
116
  chat_id: number;
@@ -966,6 +966,8 @@ export type ApiMethods<F> = {
966
966
  can_change_info?: boolean;
967
967
  /** Pass True if the administrator can invite new users to the chat */
968
968
  can_invite_users?: boolean;
969
+ /** Pass True if the administrator can edit the tags of regular members; for groups and supergroups only */
970
+ can_manage_tags?: boolean;
969
971
  /** True if the administrator can post stories to the chat */
970
972
  can_post_stories?: boolean;
971
973
  /** Pass True if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive */
@@ -992,6 +994,15 @@ export type ApiMethods<F> = {
992
994
  /** New custom title for the administrator; 0-16 characters, emoji are not allowed */
993
995
  custom_title: string;
994
996
  }): true;
997
+ /** Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the “can_manage_tags” administrator right. Returns True on success. */
998
+ setChatMemberTag(args: {
999
+ /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
1000
+ chat_id: number | string;
1001
+ /** Unique identifier of the target user */
1002
+ user_id: number;
1003
+ /** New tag for the member; 0-16 characters, emoji are not allowed */
1004
+ tag?: string;
1005
+ }): true;
995
1006
  /** Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success. */
996
1007
  banChatSenderChat(args: {
997
1008
  /** Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grammyjs/types",
3
- "version": "3.24.0",
3
+ "version": "3.25.0",
4
4
  "description": "Telegram Bot API type declarations for grammY",
5
5
  "main": "mod.js",
6
6
  "repository": {