teledzik 1.1.4 → 1.2.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.
@@ -80,7 +80,7 @@ export declare class Context<U extends Deunionize<tg.Update> = tg.Update> {
80
80
  has<Filter extends tt.UpdateType | Guard<Context['update']>>(filters: MaybeArray<Filter>): this is FilteredContext<Context, Filter>;
81
81
  get text(): GetText<U>;
82
82
  entities<EntityTypes extends tg.MessageEntity['type'][]>(...types: EntityTypes): (tg.MessageEntity & {
83
- type: EntityTypes extends [] ? "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "blockquote" | "italic" | "underline" | "strikethrough" | "spoiler" | "code" | "custom_emoji" | "pre" | "text_link" | "text_mention" : EntityTypes[number];
83
+ type: EntityTypes extends [] ? "url" | "mention" | "hashtag" | "cashtag" | "bot_command" | "email" | "phone_number" | "bold" | "blockquote" | "italic" | "underline" | "strikethrough" | "spoiler" | "code" | "custom_emoji" | "pre" | "text_link" | "text_mention" : EntityTypes[number];
84
84
  fragment: string;
85
85
  })[];
86
86
  /**
@@ -171,7 +171,11 @@ export declare class Context<U extends Deunionize<tg.Update> = tg.Update> {
171
171
  chat_id: string | number;
172
172
  user_id: number;
173
173
  until_date?: number | undefined;
174
- revoke_messages?: boolean | undefined;
174
+ revoke_messages?: boolean | undefined; /**
175
+ * Context-aware shorthand for {@link Telegram.copyMessages}
176
+ * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
177
+ * @param messageIds Identifiers of 1-100 messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.
178
+ */
175
179
  }, "chat_id" | "user_id" | "until_date"> | undefined) => Promise<true>;
176
180
  /**
177
181
  * @see https://core.telegram.org/bots/api#unbanchatmember
@@ -637,6 +641,66 @@ export declare class Context<U extends Deunionize<tg.Update> = tg.Update> {
637
641
  * @param messageIds Identifiers of 1-100 messages to delete. See deleteMessage for limitations on which messages can be deleted
638
642
  */
639
643
  deleteMessages(messageIds: number[]): Promise<true>;
644
+ /**
645
+ * Send a live photo to the current chat.
646
+ * @see https://core.telegram.org/bots/api#sendlivephoto
647
+ */
648
+ sendLivePhoto(photo: tg.InputFile | string, video: tg.InputFile | string, extra?: tt.ExtraSendLivePhoto): Promise<never>;
649
+ /**
650
+ * Reply with a live photo to the current message.
651
+ * @see https://core.telegram.org/bots/api#sendlivephoto
652
+ */
653
+ replyWithLivePhoto(photo: tg.InputFile | string, video: tg.InputFile | string, extra?: tt.ExtraSendLivePhoto): Promise<never>;
654
+ /**
655
+ * Edit an ephemeral message text in the current chat.
656
+ * @see https://core.telegram.org/bots/api#editephemeralmessagetext
657
+ */
658
+ editEphemeralMessageText(messageId: number, text: string, extra?: tt.ExtraEditEphemeralMessageText): Promise<never>;
659
+ /**
660
+ * Edit an ephemeral message media in the current chat.
661
+ * @see https://core.telegram.org/bots/api#editephemeralmessagemedia
662
+ */
663
+ editEphemeralMessageMedia(messageId: number, media: tg.InputMedia, extra?: tt.ExtraEditEphemeralMessageMedia): Promise<never>;
664
+ /**
665
+ * Edit an ephemeral message caption in the current chat.
666
+ * @see https://core.telegram.org/bots/api#editephemeralmessagecaption
667
+ */
668
+ editEphemeralMessageCaption(messageId: number, extra?: tt.ExtraEditEphemeralMessageCaption): Promise<never>;
669
+ /**
670
+ * Edit an ephemeral message reply markup in the current chat.
671
+ * @see https://core.telegram.org/bots/api#editephemeralmessagereplymarkup
672
+ */
673
+ editEphemeralMessageReplyMarkup(messageId: number, replyMarkup?: tg.InlineKeyboardMarkup): Promise<never>;
674
+ /**
675
+ * Delete an ephemeral message in the current chat.
676
+ * @see https://core.telegram.org/bots/api#deleteephemeralmessage
677
+ */
678
+ deleteEphemeralMessage(messageId?: number): Promise<never>;
679
+ /**
680
+ * Send a streaming message draft (private chats only).
681
+ * @see https://core.telegram.org/bots/api#sendmessagedraft
682
+ */
683
+ sendMessageDraft(draftId: number, text: string, extra?: tt.ExtraSendMessageDraft): Promise<never>;
684
+ /**
685
+ * Delete all reactions from the current message.
686
+ * @see https://core.telegram.org/bots/api#deleteallmessagereactions
687
+ */
688
+ deleteAllMessageReactions(messageId?: number): Promise<never>;
689
+ /**
690
+ * Delete a specific reaction from the current message.
691
+ * @see https://core.telegram.org/bots/api#deletemessagereaction
692
+ */
693
+ deleteMessageReaction(messageId?: number, extra?: tt.ExtraDeleteMessageReaction): Promise<never>;
694
+ /**
695
+ * Answer a guest query.
696
+ * @see https://core.telegram.org/bots/api#answerguestquery
697
+ */
698
+ answerGuestQuery(result: any, extra?: tt.ExtraAnswerGuestQuery): Promise<never>;
699
+ /**
700
+ * Answer a chat join request query.
701
+ * @see https://core.telegram.org/bots/api#answerchatjoinrequestquery
702
+ */
703
+ answerChatJoinRequestQuery(isApproved: boolean, extra?: tt.ExtraAnswerChatJoinRequestQuery): Promise<never>;
640
704
  /**
641
705
  * @see https://core.telegram.org/bots/api#forwardmessage
642
706
  */
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Telegram Bot API 10.0 - 10.3 Recent Updates
3
+ * @see https://core.telegram.org/bots/api#recent-changes
4
+ */
5
+ import { Chat, User, MessageEntity, PhotoSize, Video } from '@telegraf/types';
6
+ import { InputFile } from './typegram';
7
+ /**
8
+ * Ephemeral message parameters.
9
+ * Allows sending messages visible only to a specific user and the bot.
10
+ */
11
+ export interface EphemeralMessageParameters {
12
+ /** Target user who will see the ephemeral message */
13
+ receiver_user_id?: number;
14
+ /** Callback query ID if replying to a callback */
15
+ callback_query_id?: string;
16
+ /** If true, replace the original message that generated the callback query */
17
+ replace_callback_query_message?: boolean;
18
+ }
19
+ /**
20
+ * Disabled button representation in reply markup.
21
+ */
22
+ export interface DisabledButton {
23
+ text: string;
24
+ disabled: true;
25
+ }
26
+ /**
27
+ * Information about a unique gift.
28
+ */
29
+ export interface UniqueGiftInfo {
30
+ text?: string;
31
+ entities?: MessageEntity[];
32
+ is_private?: boolean;
33
+ [key: string]: any;
34
+ }
35
+ /**
36
+ * Update when a user stops streaming/message generation.
37
+ */
38
+ export interface MessageGenerationStopped {
39
+ chat_id: number;
40
+ draft_id: number;
41
+ user?: User;
42
+ }
43
+ /**
44
+ * Service message when a chat joins a community.
45
+ */
46
+ export interface CommunityChatJoined {
47
+ community: Community;
48
+ chat: Chat;
49
+ }
50
+ /**
51
+ * Represents a community — group of chats and channels linked together.
52
+ */
53
+ export interface Community {
54
+ id: number;
55
+ title: string;
56
+ username?: string;
57
+ is_channel?: boolean;
58
+ }
59
+ /**
60
+ * Service message when a chat is added to a community.
61
+ */
62
+ export interface CommunityChatAdded {
63
+ community: Community;
64
+ chat: Chat;
65
+ }
66
+ /**
67
+ * Service message when a chat is removed from a community.
68
+ */
69
+ export interface CommunityChatRemoved {
70
+ community: Community;
71
+ chat: Chat;
72
+ }
73
+ /**
74
+ * Represents an update to a user payment subscription.
75
+ */
76
+ export interface BotSubscriptionUpdated {
77
+ chat: Chat;
78
+ user?: User;
79
+ date: number;
80
+ subscription_expiration_date?: number;
81
+ is_canceled?: boolean;
82
+ }
83
+ /**
84
+ * Represents a link in poll media.
85
+ */
86
+ export interface PollMediaLink {
87
+ url: string;
88
+ }
89
+ /**
90
+ * Input media link for poll options.
91
+ */
92
+ export interface InputMediaLink {
93
+ type: 'link';
94
+ url: string;
95
+ }
96
+ /**
97
+ * Represents a live photo (photo with short video).
98
+ */
99
+ export interface LivePhoto {
100
+ file_id: string;
101
+ file_unique_id: string;
102
+ width: number;
103
+ height: number;
104
+ duration: number;
105
+ file_size?: number;
106
+ }
107
+ /**
108
+ * Input media representation for sending live photos.
109
+ */
110
+ export interface InputMediaLivePhoto<File = InputFile> {
111
+ type: 'live_photo';
112
+ media: string | File;
113
+ video: string | File;
114
+ caption?: string;
115
+ parse_mode?: string;
116
+ caption_entities?: MessageEntity[];
117
+ has_spoiler?: boolean;
118
+ }
119
+ /**
120
+ * Describes paid media containing a live photo.
121
+ */
122
+ export interface PaidMediaLivePhoto {
123
+ type: 'live_photo';
124
+ photo: PhotoSize[];
125
+ video: Video;
126
+ }
127
+ /**
128
+ * Input media representation for sending live photos as paid media.
129
+ */
130
+ export interface InputPaidMediaLivePhoto<File = InputFile> {
131
+ type: 'live_photo';
132
+ media: string | File;
133
+ video: string | File;
134
+ }
135
+ /**
136
+ * Represents a sent guest message.
137
+ */
138
+ export interface SentGuestMessage {
139
+ message_id: number;
140
+ chat: Chat;
141
+ }
142
+ /**
143
+ * Access settings for managed secretary bots.
144
+ */
145
+ export interface BotAccessSettings {
146
+ can_manage_messages?: boolean;
147
+ can_send_messages?: boolean;
148
+ can_read_messages?: boolean;
149
+ can_post_messages?: boolean;
150
+ can_edit_messages?: boolean;
151
+ can_delete_messages?: boolean;
152
+ [key: string]: any;
153
+ }
@@ -10,15 +10,29 @@ export interface RichMessage {
10
10
  blocks: object[];
11
11
  is_rtl?: boolean;
12
12
  }
13
+ export interface RichMessageButton {
14
+ text: string;
15
+ url?: string;
16
+ callback_data?: string;
17
+ web_app?: any;
18
+ [key: string]: any;
19
+ }
20
+ export interface InputRichMessageMedia {
21
+ type: string;
22
+ media: string;
23
+ [key: string]: any;
24
+ }
13
25
  /**
14
26
  * Describes a rich message to send.
15
- * Exactly ONE of `html` or `markdown` must be specified.
27
+ * Exactly ONE of `html` or `markdown` must be specified, or `blocks`.
16
28
  */
17
29
  export interface InputRichMessage {
18
30
  html?: string;
19
31
  markdown?: string;
20
32
  is_rtl?: boolean;
21
33
  skip_entity_detection?: boolean;
34
+ media?: InputRichMessageMedia[];
35
+ blocks?: object[];
22
36
  }
23
37
  /** Can be used as InputMessageContent in inline, guest, and Web App queries. */
24
38
  export interface InputRichMessageContent {
@@ -86,7 +100,9 @@ export declare class RichHTMLBuilder {
86
100
  checked?: boolean;
87
101
  }>): this;
88
102
  blockQuote(html: string): this;
103
+ expandableBlockQuote(html: string): this;
89
104
  pullQuote(html: string, cite?: string): this;
105
+ document(src: string, caption?: string): this;
90
106
  photo(src: string, caption?: string, spoiler?: boolean): this;
91
107
  video(src: string, caption?: string, spoiler?: boolean): this;
92
108
  audio(src: string, caption?: string): this;
@@ -97,6 +113,7 @@ export declare class RichHTMLBuilder {
97
113
  bordered?: boolean;
98
114
  striped?: boolean;
99
115
  hasHeader?: boolean;
116
+ isCompact?: boolean;
100
117
  }): this;
101
118
  details(summary: string, content: string, open?: boolean): this;
102
119
  mathBlock(expression: string): this;
@@ -4,6 +4,7 @@
4
4
  import * as Typegram from '@telegraf/types';
5
5
  export * from '@telegraf/types';
6
6
  export * from './rich-message';
7
+ export * from './bot-api-recent';
7
8
  interface InputFileByPath {
8
9
  source: string;
9
10
  filename?: string;
@@ -13,6 +13,7 @@ export { deunionize } from './core/helpers/deunionize';
13
13
  export { session, MemorySessionStore, SessionStore } from './session';
14
14
  export * as Scenes from './scenes';
15
15
  export * as RichMessage from './core/types/rich-message';
16
+ export * as RecentTypes from './core/types/bot-api-recent';
16
17
  export { RichHTMLBuilder, RichMarkdownBuilder, RichHTMLBuilder as HTML, MD } from './core/types/rich-message';
17
18
  export { SmartQueue } from './core/helpers/smart-queue';
18
19
  export { AIStreamAdapter } from './core/helpers/ai-stream';
@@ -1,6 +1,6 @@
1
1
  /** @format */
2
2
  import { Expand } from './core/helpers/util';
3
- import { Message, Opts, Telegram, Update, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply, ReplyParameters, ParseMode } from './core/types/typegram';
3
+ import { Message, Opts, Telegram, Update, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply, ReplyParameters, ParseMode, MessageEntity, EphemeralMessageParameters } from './core/types/typegram';
4
4
  import type { InputRichMessage } from './core/types/rich-message';
5
5
  import { UnionKeys } from './core/helpers/deunionize';
6
6
  import { FmtString } from './format';
@@ -125,10 +125,13 @@ export type ExtraSendRichMessage = {
125
125
  message_effect_id?: string;
126
126
  reply_parameters?: ReplyParameters;
127
127
  reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
128
+ ephemeral_message_parameters?: EphemeralMessageParameters;
128
129
  };
129
130
  /** sendRichMessageDraft only works in private chats; chat_id must be a number. */
130
131
  export type ExtraSendRichMessageDraft = {
131
132
  message_thread_id?: number;
133
+ can_stop?: boolean;
134
+ keep_on_stop?: boolean;
132
135
  };
133
136
  export type ExtraEditMessageRichText = {
134
137
  chat_id?: number | string;
@@ -138,3 +141,57 @@ export type ExtraEditMessageRichText = {
138
141
  parse_mode?: ParseMode;
139
142
  reply_markup?: InlineKeyboardMarkup;
140
143
  };
144
+ export type ExtraSendLivePhoto = {
145
+ business_connection_id?: string;
146
+ message_thread_id?: number;
147
+ caption?: string;
148
+ parse_mode?: ParseMode;
149
+ caption_entities?: MessageEntity[];
150
+ has_spoiler?: boolean;
151
+ disable_notification?: boolean;
152
+ protect_content?: boolean;
153
+ message_effect_id?: string;
154
+ reply_parameters?: ReplyParameters;
155
+ reply_markup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
156
+ ephemeral_message_parameters?: EphemeralMessageParameters;
157
+ allow_paid_broadcast?: boolean;
158
+ };
159
+ export type ExtraEditEphemeralMessageText = {
160
+ parse_mode?: ParseMode;
161
+ entities?: MessageEntity[];
162
+ rich_message?: InputRichMessage;
163
+ link_preview_options?: any;
164
+ reply_markup?: InlineKeyboardMarkup;
165
+ };
166
+ export type ExtraEditEphemeralMessageMedia = {
167
+ reply_markup?: InlineKeyboardMarkup;
168
+ };
169
+ export type ExtraEditEphemeralMessageCaption = {
170
+ caption?: string;
171
+ parse_mode?: ParseMode;
172
+ caption_entities?: MessageEntity[];
173
+ show_caption_above_media?: boolean;
174
+ reply_markup?: InlineKeyboardMarkup;
175
+ };
176
+ export type ExtraSendMessageDraft = {
177
+ message_thread_id?: number;
178
+ can_stop?: boolean;
179
+ keep_on_stop?: boolean;
180
+ parse_mode?: ParseMode;
181
+ entities?: MessageEntity[];
182
+ };
183
+ export type ExtraAnswerGuestQuery = {
184
+ cache_time?: number;
185
+ is_personal?: boolean;
186
+ next_offset?: string;
187
+ };
188
+ export type ExtraAnswerChatJoinRequestQuery = {
189
+ error_message?: string;
190
+ };
191
+ export type ExtraSendChatJoinRequestWebApp = {
192
+ button_text?: string;
193
+ };
194
+ export type ExtraDeleteMessageReaction = {
195
+ user_id?: number;
196
+ reaction?: any[];
197
+ };
@@ -693,5 +693,80 @@ export declare class Telegram extends ApiClient {
693
693
  * Universal in-place message editor with Modern Rich UI formatting.
694
694
  */
695
695
  editRichMessage(chatId: number | string, messageId: number | string, content: any, extra?: any): Promise<any>;
696
+ /**
697
+ * Send a live photo (photo with short video).
698
+ * @see https://core.telegram.org/bots/api#sendlivephoto
699
+ */
700
+ sendLivePhoto(chatId: number | string, photo: tg.InputFile | string, video: tg.InputFile | string, extra?: tt.ExtraSendLivePhoto): Promise<never>;
701
+ /**
702
+ * Edit an ephemeral message text.
703
+ * @see https://core.telegram.org/bots/api#editephemeralmessagetext
704
+ */
705
+ editEphemeralMessageText(chatId: number | string, messageId: number, text: string, extra?: tt.ExtraEditEphemeralMessageText): Promise<never>;
706
+ /**
707
+ * Edit an ephemeral message media.
708
+ * @see https://core.telegram.org/bots/api#editephemeralmessagemedia
709
+ */
710
+ editEphemeralMessageMedia(chatId: number | string, messageId: number, media: tg.InputMedia, extra?: tt.ExtraEditEphemeralMessageMedia): Promise<never>;
711
+ /**
712
+ * Edit an ephemeral message caption.
713
+ * @see https://core.telegram.org/bots/api#editephemeralmessagecaption
714
+ */
715
+ editEphemeralMessageCaption(chatId: number | string, messageId: number, extra?: tt.ExtraEditEphemeralMessageCaption): Promise<never>;
716
+ /**
717
+ * Edit an ephemeral message reply markup.
718
+ * @see https://core.telegram.org/bots/api#editephemeralmessagereplymarkup
719
+ */
720
+ editEphemeralMessageReplyMarkup(chatId: number | string, messageId: number, replyMarkup?: tg.InlineKeyboardMarkup): Promise<never>;
721
+ /**
722
+ * Delete an ephemeral message.
723
+ * @see https://core.telegram.org/bots/api#deleteephemeralmessage
724
+ */
725
+ deleteEphemeralMessage(chatId: number | string, messageId: number): Promise<never>;
726
+ /**
727
+ * Send a streaming message draft (private chats only).
728
+ * @see https://core.telegram.org/bots/api#sendmessagedraft
729
+ */
730
+ sendMessageDraft(chatId: number, draftId: number, text: string, extra?: tt.ExtraSendMessageDraft): Promise<never>;
731
+ /**
732
+ * Answer a guest query.
733
+ * @see https://core.telegram.org/bots/api#answerguestquery
734
+ */
735
+ answerGuestQuery(guestQueryId: string, result: any, extra?: tt.ExtraAnswerGuestQuery): Promise<never>;
736
+ /**
737
+ * Answer a chat join request query.
738
+ * @see https://core.telegram.org/bots/api#answerchatjoinrequestquery
739
+ */
740
+ answerChatJoinRequestQuery(queryId: string, isApproved: boolean, extra?: tt.ExtraAnswerChatJoinRequestQuery): Promise<never>;
741
+ /**
742
+ * Send a Web App to verify or complete a chat join request.
743
+ * @see https://core.telegram.org/bots/api#sendchatjoinrequestwebapp
744
+ */
745
+ sendChatJoinRequestWebApp(queryId: string, webAppUrl: string, extra?: tt.ExtraSendChatJoinRequestWebApp): Promise<never>;
746
+ /**
747
+ * Delete all reactions from a message.
748
+ * @see https://core.telegram.org/bots/api#deleteallmessagereactions
749
+ */
750
+ deleteAllMessageReactions(chatId: number | string, messageId: number): Promise<never>;
751
+ /**
752
+ * Delete a specific reaction on a message.
753
+ * @see https://core.telegram.org/bots/api#deletemessagereaction
754
+ */
755
+ deleteMessageReaction(chatId: number | string, messageId: number, extra?: tt.ExtraDeleteMessageReaction): Promise<never>;
756
+ /**
757
+ * Get access settings for a managed secretary bot.
758
+ * @see https://core.telegram.org/bots/api#getmanagedbotaccesssettings
759
+ */
760
+ getManagedBotAccessSettings(userId: number): Promise<never>;
761
+ /**
762
+ * Set access settings for a managed secretary bot.
763
+ * @see https://core.telegram.org/bots/api#setmanagedbotaccesssettings
764
+ */
765
+ setManagedBotAccessSettings(userId: number, settings: tg.BotAccessSettings): Promise<never>;
766
+ /**
767
+ * Get personal chat messages managed by a secretary bot.
768
+ * @see https://core.telegram.org/bots/api#getuserpersonalchatmessages
769
+ */
770
+ getUserPersonalChatMessages(userId: number, chatId: number | string, messageIds: number[]): Promise<never>;
696
771
  }
697
772
  export default Telegram;