ultra-telegram-framework 1.0.3

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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +174 -0
  3. package/dist/adapters/gas.d.ts +10 -0
  4. package/dist/adapters/gas.js +90 -0
  5. package/dist/adapters/node.d.ts +52 -0
  6. package/dist/adapters/node.js +150 -0
  7. package/dist/adapters/web.d.ts +4 -0
  8. package/dist/adapters/web.js +90 -0
  9. package/dist/core/base-api.d.ts +40 -0
  10. package/dist/core/base-api.js +26 -0
  11. package/dist/core/bot.d.ts +1828 -0
  12. package/dist/core/bot.js +2753 -0
  13. package/dist/core/composer.d.ts +87 -0
  14. package/dist/core/composer.js +164 -0
  15. package/dist/core/context/base-context.d.ts +24 -0
  16. package/dist/core/context/base-context.js +56 -0
  17. package/dist/core/context/reply-context.d.ts +234 -0
  18. package/dist/core/context/reply-context.js +528 -0
  19. package/dist/core/context.d.ts +8 -0
  20. package/dist/core/context.js +34 -0
  21. package/dist/core/keyboard.d.ts +76 -0
  22. package/dist/core/keyboard.js +182 -0
  23. package/dist/core/menu.d.ts +58 -0
  24. package/dist/core/menu.js +87 -0
  25. package/dist/index.d.ts +18 -0
  26. package/dist/index.js +24 -0
  27. package/dist/scenes/scene-manager.d.ts +39 -0
  28. package/dist/scenes/scene-manager.js +65 -0
  29. package/dist/scenes/stage.d.ts +8 -0
  30. package/dist/scenes/stage.js +34 -0
  31. package/dist/scenes/wizard.d.ts +18 -0
  32. package/dist/scenes/wizard.js +32 -0
  33. package/dist/session/gas-cache-storage.d.ts +34 -0
  34. package/dist/session/gas-cache-storage.js +49 -0
  35. package/dist/session/gas-hybrid-storage.d.ts +27 -0
  36. package/dist/session/gas-hybrid-storage.js +49 -0
  37. package/dist/session/gas-storage.d.ts +24 -0
  38. package/dist/session/gas-storage.js +47 -0
  39. package/dist/session/index.d.ts +28 -0
  40. package/dist/session/index.js +43 -0
  41. package/dist/session/memory-storage.d.ts +28 -0
  42. package/dist/session/memory-storage.js +35 -0
  43. package/dist/session/storage.d.ts +18 -0
  44. package/dist/session/storage.js +2 -0
  45. package/dist/types/telegram.d.ts +7560 -0
  46. package/dist/types/telegram.js +4 -0
  47. package/package.json +42 -0
@@ -0,0 +1,87 @@
1
+ import { Context } from './context';
2
+ import { PhotoSize, Document, Video, Voice, Location, LivePhoto } from '../types/telegram';
3
+ /**
4
+ * Type for the error handling function.
5
+ */
6
+ export type ErrorHandler<C extends Context = Context> = (err: unknown, ctx: C) => Promise<void> | void;
7
+ /**
8
+ * Type for the next() function, which passes control to the next handler in the queue.
9
+ */
10
+ export type NextFunction = () => Promise<void>;
11
+ /**
12
+ * Strict type for editor autocompletion.
13
+ * Contains Update object keys, Message fields, and entity types (Entities).
14
+ */
15
+ export type UpdateFilter = 'message' | 'edited_message' | 'channel_post' | 'edited_channel_post' | 'callback_query' | 'business_connection' | 'business_message' | 'edited_business_message' | 'deleted_business_messages' | 'message_reaction' | 'message_reaction_count' | 'chat_boost' | 'removed_chat_boost' | 'guest_message' | 'text' | 'photo' | 'document' | 'audio' | 'video' | 'voice' | 'animation' | 'sticker' | 'contact' | 'location' | 'live_photo' | 'command' | 'bot_command' | 'hashtag' | 'url' | 'mention' | 'email' | 'phone_number';
16
+ /**
17
+ * Main type of our handler (middleware).
18
+ * It accepts the context (ctx) and the relay function (next).
19
+ */
20
+ export type Middleware<C extends Context = Context> = (ctx: C, next: NextFunction) => Promise<unknown> | void;
21
+ /**
22
+ * Helper type that guarantees the presence of certain fields in Message
23
+ * depending on the passed filter.
24
+ */
25
+ export type NarrowedMessage<F extends UpdateFilter> = F extends 'text' ? {
26
+ text: string;
27
+ } : F extends 'photo' ? {
28
+ photo: PhotoSize[];
29
+ } : F extends 'document' ? {
30
+ document: Document;
31
+ } : F extends 'video' ? {
32
+ video: Video;
33
+ } : F extends 'voice' ? {
34
+ voice: Voice;
35
+ } : F extends 'location' ? {
36
+ location: Location;
37
+ } : F extends 'live_photo' ? {
38
+ live_photo: LivePhoto;
39
+ photo: PhotoSize[];
40
+ } : {};
41
+ /**
42
+ * Main type of the narrowed context.
43
+ * It extends the base context C, making certain fields MANDATORY.
44
+ */
45
+ export type NarrowedContext<C extends Context, F extends UpdateFilter> = C & {
46
+ callbackQuery: F extends 'callback_query' ? NonNullable<C['callbackQuery']> : C['callbackQuery'];
47
+ message: F extends 'message' | 'text' | 'photo' | 'document' | 'audio' | 'video' | 'voice' | 'animation' | 'sticker' | 'contact' | 'location' | 'live_photo' | 'guest_message' | 'business_message' ? NonNullable<C['message']> & NarrowedMessage<F> : C['message'];
48
+ };
49
+ export declare class Composer<C extends Context = Context> {
50
+ private handlers;
51
+ private errorHandler?;
52
+ catch(handler: ErrorHandler<C>): this;
53
+ /**
54
+ * Adds a general handler or an ENTIRE MODULE (another Composer).
55
+ */
56
+ use(...middlewares: (Middleware<C> | Composer<C>)[]): this;
57
+ /**
58
+ * Registers a handler for a specific command (or an array of commands).
59
+ *
60
+ * @param command Command name without the slash (e.g., 'start' or ['start', 'help'])
61
+ * @param middlewares Functions that will be executed if the command matches
62
+ */
63
+ command(command: string | string[], ...middlewares: Middleware<C>[]): this;
64
+ /**
65
+ * Registers a handler for inline button clicks (callback_query).
66
+ *
67
+ * @param actionName String or regular expression to check callback_data
68
+ * @param middlewares Functions that will be executed on a match
69
+ */
70
+ action(actionName: string | RegExp, ...middlewares: Middleware<C>[]): this;
71
+ /**
72
+ * Registers a handler that will trigger under certain conditions (update type, presence of a field or entity).
73
+ * @param filter Field name or array of names (e.g., 'photo', 'document', 'callback_query')
74
+ * @param middlewares Handler functions that will be executed on a match
75
+ */
76
+ on<F extends UpdateFilter>(filter: F | F[], ...middlewares: Middleware<NarrowedContext<C, F>>[]): this;
77
+ /**
78
+ * Magic engine: collects an array of middlewares into a single execution chain.
79
+ * When one middleware calls next(), this function triggers the next one.
80
+ */
81
+ static compose<C extends Context>(middlewares: Middleware<C>[]): Middleware<C>;
82
+ /**
83
+ * Returns all handlers registered in this class as one large function.
84
+ * Wrapped in try...catch to intercept errors.
85
+ */
86
+ middleware(): Middleware<C>;
87
+ }
@@ -0,0 +1,164 @@
1
+ export class Composer {
2
+ constructor() {
3
+ // Here we store our entire chain of handlers
4
+ this.handlers = [];
5
+ }
6
+ catch(handler) {
7
+ this.errorHandler = handler;
8
+ return this;
9
+ }
10
+ /**
11
+ * Adds a general handler or an ENTIRE MODULE (another Composer).
12
+ */
13
+ use(...middlewares) {
14
+ middlewares.forEach(middleware => {
15
+ if (middleware instanceof Composer) {
16
+ // If it is a separate file with commands (module), we extract the chain from it
17
+ this.handlers.push(middleware.middleware());
18
+ }
19
+ else {
20
+ // If it is a regular function
21
+ this.handlers.push(middleware);
22
+ }
23
+ });
24
+ return this;
25
+ }
26
+ /**
27
+ * Registers a handler for a specific command (or an array of commands).
28
+ *
29
+ * @param command Command name without the slash (e.g., 'start' or ['start', 'help'])
30
+ * @param middlewares Functions that will be executed if the command matches
31
+ */
32
+ command(command, ...middlewares) {
33
+ const commands = Array.isArray(command) ? command : [command];
34
+ // Create a "filter middleware"
35
+ const filterMiddleware = async (ctx, next) => {
36
+ const text = ctx.text;
37
+ // If there is no text or it does not start with a slash - it's not a command
38
+ if (!text || !text.startsWith('/')) {
39
+ return next(); // Pass the relay further
40
+ }
41
+ // Extract the clean command name (ignore '@bot_username' if present)
42
+ const cmdText = text.split(' ')[0].split('@')[0].substring(1);
43
+ if (commands.includes(cmdText)) {
44
+ // If the command is ours, run the passed handlers
45
+ await Composer.compose(middlewares)(ctx, next);
46
+ }
47
+ else {
48
+ // If the command is not ours, proceed further
49
+ await next();
50
+ }
51
+ };
52
+ this.handlers.push(filterMiddleware);
53
+ return this;
54
+ }
55
+ /**
56
+ * Registers a handler for inline button clicks (callback_query).
57
+ *
58
+ * @param actionName String or regular expression to check callback_data
59
+ * @param middlewares Functions that will be executed on a match
60
+ */
61
+ action(actionName, ...middlewares) {
62
+ const filterMiddleware = async (ctx, next) => {
63
+ var _a;
64
+ // Check if the update contains a callback_query and its data
65
+ const callbackData = (_a = ctx.callbackQuery) === null || _a === void 0 ? void 0 : _a.data;
66
+ if (!callbackData) {
67
+ return next();
68
+ }
69
+ // Check for a match (if it's a string - exact match, if RegExp - pattern check)
70
+ const isMatch = typeof actionName === 'string'
71
+ ? callbackData === actionName
72
+ : actionName.test(callbackData);
73
+ if (isMatch) {
74
+ await Composer.compose(middlewares)(ctx, next);
75
+ }
76
+ else {
77
+ await next();
78
+ }
79
+ };
80
+ this.handlers.push(filterMiddleware);
81
+ return this;
82
+ }
83
+ /**
84
+ * Registers a handler that will trigger under certain conditions (update type, presence of a field or entity).
85
+ * @param filter Field name or array of names (e.g., 'photo', 'document', 'callback_query')
86
+ * @param middlewares Handler functions that will be executed on a match
87
+ */
88
+ on(filter, ...middlewares) {
89
+ const filters = Array.isArray(filter) ? filter : [filter];
90
+ const filterMiddleware = async (ctx, next) => {
91
+ const updateAny = ctx.update;
92
+ const messageAny = ctx.message;
93
+ const isMatch = filters.some(checking => {
94
+ // Merge entities from text and media file captions
95
+ const entities = (messageAny === null || messageAny === void 0 ? void 0 : messageAny.entities) || (messageAny === null || messageAny === void 0 ? void 0 : messageAny.caption_entities) || [];
96
+ // Check for commands
97
+ if (checking === 'command') {
98
+ return entities.some((e) => e.type === 'bot_command');
99
+ }
100
+ // Check for other entities (hashtag, url, mention, etc.)
101
+ const isEntity = entities.some((e) => e.type === checking);
102
+ if (isEntity)
103
+ return true;
104
+ // Check for the presence of a field (photo, document, text) in the UNIVERSAL message
105
+ if (messageAny && checking in messageAny)
106
+ return true;
107
+ // Check for the presence of a field in the update root (e.g., callback_query)
108
+ if (checking in updateAny)
109
+ return true;
110
+ return false;
111
+ });
112
+ if (isMatch) {
113
+ await Composer.compose(middlewares)(ctx, next);
114
+ }
115
+ else {
116
+ await next();
117
+ }
118
+ };
119
+ this.handlers.push(filterMiddleware);
120
+ return this;
121
+ }
122
+ /**
123
+ * Magic engine: collects an array of middlewares into a single execution chain.
124
+ * When one middleware calls next(), this function triggers the next one.
125
+ */
126
+ static compose(middlewares) {
127
+ return async (ctx, next) => {
128
+ let index = -1;
129
+ const dispatch = async (i) => {
130
+ if (i <= index)
131
+ throw new Error('next() called multiple times in one middleware!');
132
+ index = i;
133
+ const middleware = middlewares[i];
134
+ if (!middleware) {
135
+ // If the handlers are finished, call the final next
136
+ return next();
137
+ }
138
+ // Call the current middleware and pass it the function to call the next one
139
+ await middleware(ctx, () => dispatch(i + 1));
140
+ };
141
+ await dispatch(0);
142
+ };
143
+ }
144
+ /**
145
+ * Returns all handlers registered in this class as one large function.
146
+ * Wrapped in try...catch to intercept errors.
147
+ */
148
+ middleware() {
149
+ const composed = Composer.compose(this.handlers);
150
+ return async (ctx, next) => {
151
+ try {
152
+ await composed(ctx, next);
153
+ }
154
+ catch (err) {
155
+ if (this.errorHandler) {
156
+ await this.errorHandler(err, ctx);
157
+ }
158
+ else {
159
+ throw err;
160
+ }
161
+ }
162
+ };
163
+ }
164
+ }
@@ -0,0 +1,24 @@
1
+ import { TelegramBotApi, Update, CallbackQuery, MaybeInaccessibleMessage } from "../../types/telegram";
2
+ export declare abstract class BaseContext {
3
+ readonly update: Update;
4
+ readonly api: TelegramBotApi;
5
+ readonly message?: MaybeInaccessibleMessage;
6
+ readonly callbackQuery?: CallbackQuery;
7
+ constructor(update: Update, api: TelegramBotApi);
8
+ get chatId(): number | undefined;
9
+ get isMessageAccessible(): boolean;
10
+ get from(): import("../../types/telegram").User | undefined;
11
+ get text(): string | undefined;
12
+ protected getRequiredIds(operation: string): {
13
+ chatId: number;
14
+ messageId: number;
15
+ };
16
+ protected getRequiredIds(operation: string, force: true): {
17
+ chatId: number;
18
+ messageId: number;
19
+ };
20
+ protected getRequiredIds(operation: string, force: false): {
21
+ chatId: number;
22
+ messageId: number | undefined;
23
+ };
24
+ }
@@ -0,0 +1,56 @@
1
+ export class BaseContext {
2
+ constructor(update, api) {
3
+ var _a;
4
+ this.update = update;
5
+ this.api = api;
6
+ this.message =
7
+ update.message ||
8
+ update.edited_message ||
9
+ update.channel_post ||
10
+ ((_a = update.callback_query) === null || _a === void 0 ? void 0 : _a.message) ||
11
+ update.business_message ||
12
+ update.guest_message;
13
+ this.callbackQuery = update.callback_query;
14
+ }
15
+ get chatId() {
16
+ var _a, _b, _c, _d, _e;
17
+ return (((_b = (_a = this.message) === null || _a === void 0 ? void 0 : _a.chat) === null || _b === void 0 ? void 0 : _b.id) ||
18
+ ((_c = this.update.my_chat_member) === null || _c === void 0 ? void 0 : _c.chat.id) ||
19
+ ((_d = this.update.chat_member) === null || _d === void 0 ? void 0 : _d.chat.id) ||
20
+ ((_e = this.update.chat_join_request) === null || _e === void 0 ? void 0 : _e.chat.id));
21
+ }
22
+ get isMessageAccessible() {
23
+ return !!this.message && this.message.date !== 0;
24
+ }
25
+ get from() {
26
+ var _a, _b;
27
+ const msg = this.message;
28
+ if (msg && "from" in msg)
29
+ return msg.from;
30
+ return ((_a = this.callbackQuery) === null || _a === void 0 ? void 0 : _a.from) || ((_b = this.update.inline_query) === null || _b === void 0 ? void 0 : _b.from);
31
+ }
32
+ get text() {
33
+ const msg = this.message;
34
+ if (!msg)
35
+ return undefined;
36
+ if ("text" in msg)
37
+ return msg.text;
38
+ if ("caption" in msg)
39
+ return msg.caption;
40
+ return undefined;
41
+ }
42
+ getRequiredIds(operation, force = true) {
43
+ var _a, _b;
44
+ const chatId = this.chatId;
45
+ if (!chatId)
46
+ throw new Error(`Cannot perform ${operation}: chat_id not found.`);
47
+ if (!force) {
48
+ return { chatId, messageId: this.isMessageAccessible ? (_a = this.message) === null || _a === void 0 ? void 0 : _a.message_id : undefined };
49
+ }
50
+ const messageId = (_b = this.message) === null || _b === void 0 ? void 0 : _b.message_id;
51
+ if (!this.isMessageAccessible || !messageId) {
52
+ throw new Error(`Cannot perform ${operation}: message is inaccessible or deleted.`);
53
+ }
54
+ return { chatId, messageId };
55
+ }
56
+ }
@@ -0,0 +1,234 @@
1
+ import { Message, SendMessageParams, SendPhotoParams, InputFile, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply, InlineKeyboardButton, SendVideoParams, SendDocumentParams, SendLivePhotoParams, SendGiftParams, AnswerCallbackQueryParams, ReactionType, EditMessageTextParams, MessageId, EditMessageCaptionParams, SendInvoiceParams, AnswerShippingQueryParams, SendPaidMediaParams, InputPaidMediaPhoto, InputPaidMediaVideo, InputPaidMediaLivePhoto, SendMediaGroupParams, InputMediaDocument, InputMediaAudio, InputMediaPhoto, InputMediaVideo, InputMediaLivePhoto, InputPollOption, SendPollParams, InlineQueryResult, AnswerGuestQueryParams, SentGuestMessage, SendGameParams, SetGameScoreParams, GameHighScore, DeleteMessageReactionParams, DeleteAllMessageReactionsParams, SendMessageDraftParams } from "../../types/telegram";
2
+ import { InlineKeyboard, ReplyKeyboard } from "../keyboard";
3
+ import { BaseContext } from "./base-context";
4
+ export declare abstract class ReplyContext extends BaseContext {
5
+ reply(text: string, options?: Omit<SendMessageParams, "chat_id" | "text">): Promise<Message>;
6
+ /**
7
+ * Reply to the current message with a keyboard (Inline or Reply)
8
+ * @param text - message text
9
+ * @param keyboard - keyboard
10
+ * @param options - parameters object
11
+ * @returns `Promise<Message>`
12
+ */
13
+ replyWithKeyboard(text: string, keyboard: InlineKeyboard | ReplyKeyboard | InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply, options?: Omit<SendMessageParams, "chat_id" | "text" | "reply_markup">): Promise<Message>;
14
+ /**
15
+ * Quick reply with an Inline keyboard
16
+ * @param text - message text
17
+ * @param buttons - keyboard
18
+ * @param options - parameters object
19
+ * @returns `Promise<Message>`
20
+ */
21
+ replyWithInlineKeyboard(text: string, buttons: InlineKeyboardButton[][] | InlineKeyboard, options?: Omit<SendMessageParams, "chat_id" | "text" | "reply_markup">): Promise<Message>;
22
+ /**
23
+ * Reply to the current message with a photo
24
+ * @param photo URL of the image or `file_id`
25
+ * @param options Parameters object or just the notification text
26
+ * @returns `Promise<Message>`
27
+ */
28
+ replyWithPhoto(photo: string | InputFile, options?: Omit<SendPhotoParams, "chat_id" | "photo">): Promise<Message>;
29
+ /**
30
+ * Reply to the current message with a video file
31
+ * @param video URL of the video or `file_id`
32
+ * @param options Parameters object or just the notification text
33
+ * @returns `Promise<Message>`
34
+ */
35
+ replyWithVideo(video: string | InputFile, options?: Omit<SendVideoParams, "chat_id" | "video">): Promise<Message>;
36
+ /**
37
+ * Reply to the current message with a document (file)
38
+ * @param document URL of the file or `file_id`
39
+ * @param options Parameters object or just the notification text
40
+ * @returns `Promise<Message>`
41
+ */
42
+ replyWithDocument(document: string | InputFile, options?: Omit<SendDocumentParams, "chat_id" | "document">): Promise<Message>;
43
+ /**
44
+ * Reply to the current message with a "live photo" (Live Photo)
45
+ * @param photo URL of the photo or `file_id`
46
+ * @param livePhoto URL of the "live photo" or `file_id`
47
+ * @param options Parameters object or just the notification text
48
+ * @returns `Promise<Message>`
49
+ */
50
+ replyWithLivePhoto(photo: string | InputFile, livePhoto: string | InputFile, options?: Omit<SendLivePhotoParams, "chat_id" | "photo" | "live_photo">): Promise<Message>;
51
+ /**
52
+ * Send a gift (Star Gift) to the current user
53
+ * @param giftId Gift ID
54
+ * @param options Parameters object
55
+ * @returns `Promise<boolean>`
56
+ */
57
+ sendGift(giftId: string, options?: Omit<SendGiftParams, "user_id" | "chat_id" | "gift_id">): Promise<boolean>;
58
+ /**
59
+ * Remove loading indicator from an inline button
60
+ * @param params Parameters object or just the notification text
61
+ * @returns `Promise<boolean>`
62
+ */
63
+ answerCbQuery(params?: (Omit<AnswerCallbackQueryParams, "callback_query_id">) | string): Promise<boolean>;
64
+ /**
65
+ * React to the current message
66
+ * @param reactions Array of reactions (e.g.: `[{ type: "emoji", emoji: "👍" }]`)
67
+ * @returns `Promise<boolean>`
68
+ */
69
+ react(reactions: ReactionType[]): Promise<boolean>;
70
+ /**
71
+ * Send chat action status to the current chat (e.g., "typing", "upload_photo")
72
+ * @param action Action status (e.g., "typing", "upload_photo")
73
+ * @returns `Promise<boolean>`
74
+ */
75
+ replyWithChatAction(action: "typing" | "upload_photo" | "record_video" | "upload_video" | "record_voice" | "upload_voice" | "upload_document" | "choose_sticker" | "find_location" | "record_video_note" | "upload_video_note"): Promise<boolean>;
76
+ /**
77
+ * Delete the current message
78
+ * @returns `Promise<boolean>`
79
+ */
80
+ deleteMessage(): Promise<boolean>;
81
+ /**
82
+ * Edit the text of the current message
83
+ * @param text Message text
84
+ * @param options Additional parameters
85
+ * @returns `Promise<Message | boolean>`
86
+ */
87
+ editMessage(text: string, options?: Omit<EditMessageTextParams, "chat_id" | "text" | "message_id">): Promise<Message | boolean>;
88
+ /**
89
+ * Forward the current message to another chat
90
+ * @param toChatId ID of the chat where the message is forwarded
91
+ * @returns `Promise<Message>`
92
+ */
93
+ forwardTo(toChatId: string | number): Promise<Message>;
94
+ /**
95
+ * Copy the current message to another chat
96
+ * @param toChatId ID of the chat where the message is copied
97
+ * @returns `Promise<MessageId>`
98
+ */
99
+ copyTo(toChatId: string | number): Promise<MessageId>;
100
+ /**
101
+ * Returns command arguments (everything that follows the command name).
102
+ * Example: for the message "/start ref_123", it will return "ref_123".
103
+ * If it is just "/start", it will return an empty string.
104
+ * @returns `string`
105
+ */
106
+ get payload(): string;
107
+ /**
108
+ * ID of the user who initiated the event
109
+ * @returns `number | undefined`
110
+ */
111
+ get senderId(): number | undefined;
112
+ /**
113
+ * Change only the inline keyboard of the current message
114
+ * @param replyMarkup - keyboard
115
+ * @returns `Promise<Message | boolean>`
116
+ */
117
+ editReplyMarkup(replyMarkup?: InlineKeyboardMarkup): Promise<Message | boolean>;
118
+ /**
119
+ * Change the caption of the current media file (photo/video)
120
+ * @param caption - caption
121
+ * @param options - parameters object
122
+ * @returns `Promise<Message | boolean>`
123
+ */
124
+ editCaption(caption: string, options?: Omit<EditMessageCaptionParams, "chat_id" | "message_id" | "caption">): Promise<Message | boolean>;
125
+ /**
126
+ * Get the list of administrators of the current chat
127
+ * @returns `Promise<ChatMember[]>`
128
+ */
129
+ getAdministrators(): Promise<import("../../types/telegram").ChatMember[]>;
130
+ /**
131
+ * Get information about a specific member in the current chat
132
+ * @param userId User ID
133
+ * @returns `Promise<ChatMember>`
134
+ */
135
+ getMember(userId: number): Promise<import("../../types/telegram").ChatMember>;
136
+ /**
137
+ * Leave the current chat (group/channel)
138
+ * @returns `Promise<boolean>`
139
+ */
140
+ leaveChat(): Promise<boolean>;
141
+ /**
142
+ * Send an invoice to the current chat
143
+ * @param params Parameters object
144
+ * @returns `Promise<Message>`
145
+ */
146
+ replyWithInvoice(params: Omit<SendInvoiceParams, "chat_id">): Promise<Message>;
147
+ /**
148
+ * Answer a shipping query (Shipping Query)
149
+ * @param ok Is everything okay
150
+ * @param options Additional parameters
151
+ * @returns `Promise<boolean>`
152
+ */
153
+ answerShippingQuery(ok: boolean, options?: Omit<AnswerShippingQueryParams, "shipping_query_id" | "ok">): Promise<boolean>;
154
+ /**
155
+ * Answer a pre-checkout query (Pre-checkout Query)
156
+ * @param ok Is everything okay
157
+ * @param errorMessage Error message
158
+ * @returns `Promise<boolean>`
159
+ */
160
+ answerPreCheckoutQuery(ok: boolean, errorMessage?: string): Promise<boolean>;
161
+ /**
162
+ * Send a game to the current chat
163
+ * @param gameShortName - short name of the game
164
+ * @param options - parameters object
165
+ * @returns `Promise<Message>`
166
+ */
167
+ replyWithGame(gameShortName: string, options?: Omit<SendGameParams, "chat_id" | "game_short_name">): Promise<Message>;
168
+ /**
169
+ * Set a high score for a player in the game
170
+ * @param score - game score
171
+ * @param options - parameters object
172
+ * @returns `Promise<Message | boolean>`
173
+ */
174
+ setGameScore(score: number, options?: Omit<SetGameScoreParams, "user_id" | "score">): Promise<Message | boolean>;
175
+ /**
176
+ * Get high scores table for the game
177
+ * @returns `Promise<GameHighScore[]>`
178
+ */
179
+ getGameHighScores(): Promise<GameHighScore[]>;
180
+ /**
181
+ * Answer a guest query (Guest Mode)
182
+ * @param result - query result
183
+ * @param options - parameters object
184
+ * @returns `Promise<SentGuestMessage>`
185
+ */
186
+ answerGuest(result: InlineQueryResult, options?: Omit<AnswerGuestQueryParams, "guest_query_id" | "result">): Promise<SentGuestMessage>;
187
+ /**
188
+ * Delete reaction on the current message.
189
+ * By default, deletes the reaction of the user who initiated the event.
190
+ * @param options - parameters object
191
+ * @returns `Promise<boolean>`
192
+ */
193
+ deleteReaction(options?: Omit<DeleteMessageReactionParams, "chat_id" | "message_id">): Promise<boolean>;
194
+ /**
195
+ * Delete all reactions of a specific user in the current chat (up to 10,000).
196
+ * By default, deletes the reactions of the user who initiated the event.
197
+ * @param options - parameters object
198
+ * @returns `Promise<boolean>`
199
+ */
200
+ deleteAllReactions(options?: Omit<DeleteAllMessageReactionsParams, "chat_id">): Promise<boolean>;
201
+ /**
202
+ * Send a poll or quiz (Poll / Quiz) to the current chat.
203
+ * Supports new API 10.0 features: media, explanation_media, 1 answer option.
204
+ * @param question - poll text
205
+ * @param pollOptions - answer options
206
+ * @param options - parameters object
207
+ * @returns `Promise<Message>`
208
+ */
209
+ replyWithPoll(question: string, pollOptions: (string | InputPollOption)[], options?: Omit<SendPollParams, "chat_id" | "question" | "options">): Promise<Message>;
210
+ /**
211
+ * Streaming a temporary message (Draft) for generating responses (e.g., AI).
212
+ * This ephemeral message lives for 30 seconds. After completion, it is mandatory to call a regular reply().
213
+ * @param draftId - unique stream identifier (must be > 0). Identical IDs animate changes.
214
+ * @param options - parameters object
215
+ * @returns `Promise<boolean>`
216
+ */
217
+ replyWithDraft(draftId: number, options?: Omit<SendMessageDraftParams, "draft_id">): Promise<boolean>;
218
+ /**
219
+ * Send a group of media files (album).
220
+ * Supports photos, videos, audio, documents, and new Live Photos (API 10.0).
221
+ * @param media - array of media files
222
+ * @param options - parameters object
223
+ * @returns `Promise<Message[]>`
224
+ */
225
+ replyWithMediaGroup(media: InputMediaAudio[] | InputMediaDocument[] | Array<InputMediaPhoto | InputMediaVideo | InputMediaLivePhoto>, options?: Omit<SendMediaGroupParams, "chat_id" | "media">): Promise<Message[]>;
226
+ /**
227
+ * Send paid media, for viewing which the user must pay with Telegram Stars.
228
+ * @param starCount - number of stars the user must pay
229
+ * @param media - array of media files
230
+ * @param options - parameters object
231
+ * @returns `Promise<Message>`
232
+ */
233
+ replyWithPaidMedia(starCount: number, media: (InputPaidMediaPhoto | InputPaidMediaVideo | InputPaidMediaLivePhoto)[], options?: Omit<SendPaidMediaParams, "chat_id" | "star_count" | "media">): Promise<Message>;
234
+ }