Skip to content

Commit 5a6ec01

Browse files
committed
fix: missing ExpandableBlockquote, drop *MessageEntity from members
1 parent 1206083 commit 5a6ec01

2 files changed

Lines changed: 88 additions & 31 deletions

File tree

message.ts

Lines changed: 87 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -521,47 +521,90 @@ There is no way to specify “underline”, “strikethrough”, “spoiler”,
521521
export type ParseMode = "Markdown" | "MarkdownV2" | "HTML";
522522

523523
export declare namespace MessageEntity {
524-
interface AbstractMessageEntity {
524+
interface Abstract {
525525
/** 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) */
526526
type: string;
527527
/** Offset in UTF-16 code units to the start of the entity */
528528
offset: number;
529529
/** Length of the entity in UTF-16 code units */
530530
length: number;
531531
}
532-
export interface CommonMessageEntity extends AbstractMessageEntity {
533-
type:
534-
| "mention"
535-
| "hashtag"
536-
| "cashtag"
537-
| "bot_command"
538-
| "url"
539-
| "email"
540-
| "phone_number"
541-
| "bold"
542-
| "blockquote"
543-
| "italic"
544-
| "underline"
545-
| "strikethrough"
546-
| "spoiler"
547-
| "code";
548-
}
549-
export interface PreMessageEntity extends AbstractMessageEntity {
532+
533+
export interface Mention extends Abstract {
534+
type: "mention";
535+
}
536+
537+
export interface Hashtag extends Abstract {
538+
type: "hashtag";
539+
}
540+
541+
export interface Cashtag extends Abstract {
542+
type: "cashtag";
543+
}
544+
545+
export interface BotCommand extends Abstract {
546+
type: "bot_command";
547+
}
548+
549+
export interface Url extends Abstract {
550+
type: "url";
551+
}
552+
553+
export interface Email extends Abstract {
554+
type: "email";
555+
}
556+
557+
export interface PhoneNumber extends Abstract {
558+
type: "phone_number";
559+
}
560+
561+
export interface Bold extends Abstract {
562+
type: "bold";
563+
}
564+
565+
export interface Blockquote extends Abstract {
566+
type: "blockquote";
567+
}
568+
569+
export interface ExpandableBlockquote extends Abstract {
570+
type: "expandable_blockquote";
571+
}
572+
573+
export interface Italic extends Abstract {
574+
type: "italic";
575+
}
576+
577+
export interface Underline extends Abstract {
578+
type: "underline";
579+
}
580+
581+
export interface Strikethrough extends Abstract {
582+
type: "strikethrough";
583+
}
584+
585+
export interface Spoiler extends Abstract {
586+
type: "spoiler";
587+
}
588+
589+
export interface Code extends Abstract {
590+
type: "code";
591+
}
592+
export interface PreMessage extends Abstract {
550593
type: "pre";
551594
/** For “pre” only, the programming language of the entity text */
552595
language?: string;
553596
}
554-
export interface TextLinkMessageEntity extends AbstractMessageEntity {
597+
export interface TextLink extends Abstract {
555598
type: "text_link";
556599
/** For “text_link” only, URL that will be opened after user taps on the text */
557600
url: string;
558601
}
559-
export interface TextMentionMessageEntity extends AbstractMessageEntity {
602+
export interface TextMention extends Abstract {
560603
type: "text_mention";
561604
/** For “text_mention” only, the mentioned user */
562605
user: User;
563606
}
564-
export interface CustomEmojiMessageEntity extends AbstractMessageEntity {
607+
export interface CustomEmoji extends Abstract {
565608
type: "custom_emoji";
566609
/** For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker */
567610
custom_emoji_id: string;
@@ -570,11 +613,25 @@ export declare namespace MessageEntity {
570613

571614
/** This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc. */
572615
export type MessageEntity =
573-
| MessageEntity.CommonMessageEntity
574-
| MessageEntity.CustomEmojiMessageEntity
575-
| MessageEntity.PreMessageEntity
576-
| MessageEntity.TextLinkMessageEntity
577-
| MessageEntity.TextMentionMessageEntity;
616+
| MessageEntity.Mention
617+
| MessageEntity.Hashtag
618+
| MessageEntity.Cashtag
619+
| MessageEntity.BotCommand
620+
| MessageEntity.Url
621+
| MessageEntity.Email
622+
| MessageEntity.PhoneNumber
623+
| MessageEntity.Bold
624+
| MessageEntity.Blockquote
625+
| MessageEntity.ExpandableBlockquote
626+
| MessageEntity.Italic
627+
| MessageEntity.Underline
628+
| MessageEntity.Strikethrough
629+
| MessageEntity.Spoiler
630+
| MessageEntity.Code
631+
| MessageEntity.PreMessage
632+
| MessageEntity.TextLink
633+
| MessageEntity.TextMention
634+
| MessageEntity.CustomEmoji;
578635

579636
/** This object contains information about the quoted part of a message that is replied to by the given message. */
580637
export interface TextQuote {
@@ -1007,7 +1064,7 @@ export interface PollOption {
10071064
/** Option text, 1-100 characters */
10081065
text: string;
10091066
/** Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts */
1010-
text_entities?: MessageEntity.CustomEmojiMessageEntity[];
1067+
text_entities?: MessageEntity.CustomEmoji[];
10111068
/** Number of users that voted for this option */
10121069
voter_count: number;
10131070
}
@@ -1019,7 +1076,7 @@ export interface InputPollOption {
10191076
/** Mode for parsing entities in the text. See formatting options for more details. Currently, only custom emoji entities are allowed */
10201077
text_parse_mode?: ParseMode;
10211078
/** A list of special entities that appear in the poll option text. It can be specified instead of text_parse_mode */
1022-
text_entities?: MessageEntity.CustomEmojiMessageEntity[];
1079+
text_entities?: MessageEntity.CustomEmoji[];
10231080
}
10241081

10251082
/** This object represents an answer of a user in a non-anonymous poll. */
@@ -1044,7 +1101,7 @@ export interface Poll {
10441101
/** Poll question, 1-300 characters */
10451102
question: string;
10461103
/** Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions */
1047-
question_entities?: MessageEntity.CustomEmojiMessageEntity[];
1104+
question_entities?: MessageEntity.CustomEmoji[];
10481105
/** List of poll options */
10491106
options: PollOption[];
10501107
/** Total number of users that voted in the poll */

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@telegraf/types",
33
"private": false,
4-
"version": "8.3.0",
4+
"version": "8.3.1",
55
"description": "Type declarations for the Telegram API",
66
"main": "index.js",
77
"repository": {

0 commit comments

Comments
 (0)