gramstax 0.9.0 → 0.11.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.
@@ -65,6 +65,7 @@ type ITMediaBlock = {
65
65
  };
66
66
  declare class TemplateEngine {
67
67
  static MAX_MEDIA_GROUP_ITEMS: number;
68
+ static BOT_API_VERSION: string;
68
69
  static ALLOWED_BLOCKS_TELEGRAM_LEGACY: string[];
69
70
  static ALLOWED_BLOCKS_TELEGRAM_RICH: string[];
70
71
  static ALLOWED_BLOCKS_TELEGRAM: string[];
@@ -324,6 +325,20 @@ declare class TemplateEngine {
324
325
  message: string;
325
326
  }>;
326
327
  };
328
+ static validateBlockGMessageRich(html: string): {
329
+ valid: boolean;
330
+ errors: Array<{
331
+ line: number;
332
+ message: string;
333
+ }>;
334
+ };
335
+ static _validateBlockGMessageRichInTemplate(template: string): {
336
+ valid: boolean;
337
+ errors: Array<{
338
+ line: number;
339
+ message: string;
340
+ }>;
341
+ };
327
342
  static validateTemplate(template: string): {
328
343
  valid: boolean;
329
344
  errors: Array<{
@@ -374,12 +389,12 @@ declare class TemplateManager {
374
389
  _compile(key: string, template: string, keepIfExist?: Partial<{
375
390
  [K in keyof ITCompiledTemplate]: boolean;
376
391
  }>, importCache?: Map<string, string>, rawCache?: Map<string, string>, filename?: string): void;
377
- getMedia(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): ReturnType<ITCompiledTemplate[`media`][`default`][`default`]>;
378
- getMessage(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): string;
379
- getDescription(key: string, AGBaseId?: string, ALang?: string, AScope?: string, data?: Record<string, any>): string;
380
- getDescriptionLanguage(key: string, AGBaseId?: string, AScope?: string): string[];
381
- getDescriptionScopes(key: string, AGBaseId?: string): string[];
382
- getKeyboard(key: string, AGBaseId?: string, ALang?: string, AType?: `inline` | `bottom`, data?: Record<string, any>): string[];
392
+ getGMedia(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): ReturnType<ITCompiledTemplate[`media`][`default`][`default`]>;
393
+ getGMessage(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): string;
394
+ getGDescription(key: string, AGBaseId?: string, ALang?: string, AScope?: string, data?: Record<string, any>): string;
395
+ getAGDescriptionLang(key: string, AGBaseId?: string, AScope?: string): string[];
396
+ getAGDescriptionScopes(key: string, AGBaseId?: string): string[];
397
+ getGKeyboard(key: string, AGBaseId?: string, ALang?: string, AType?: `inline` | `bottom`, data?: Record<string, any>): string[];
383
398
  write(filename: string, template: string): Promise<boolean | null>;
384
399
  has(key: string): boolean;
385
400
  destroy(): Promise<void>;
@@ -506,6 +521,13 @@ declare class Ctx {
506
521
  }>;
507
522
  reply(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReply): Promise<grammy_types.Message.TextMessage>;
508
523
  replyRich(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options1?: ITOptReplyRich[0] | null, options2?: ITOptReplyRich[1]): Promise<grammy_types.Message.RichMessageMessage>;
524
+ editRich(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options1?: ITOptReplyRich[0] | null, options2?: ITOptEdit, fallbackReply?: boolean): Promise<true | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
525
+ text: string;
526
+ } & Partial<{
527
+ entities: grammy_types.MessageEntity[];
528
+ }>) | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
529
+ rich_message: grammy_types.RichMessage;
530
+ }) | undefined>;
509
531
  replyMedia<T extends Exclude<ITMediaBlock[`type`], `group`>>(type: T, keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: T extends `photo` ? ITOptReplyPhoto : T extends `video` ? ITOptReplyVideo : T extends `audio` ? ITOptReplyAudio : T extends `document` ? ITOptReplyDocument : T extends `animation` ? ITOptReplyAnimation : T extends `voice` ? ITOptReplyVoice : T extends `video_note` ? ITOptReplyVideoNote : T extends `sticker` ? ITOptReplySticker : T extends `location` ? ITOptReplyLocation : T extends `contact` ? ITOptReplyContact : undefined): Promise<grammy_types.Message.LocationMessage | grammy_types.Message.ContactMessage | grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.VoiceMessage | grammy_types.Message.VideoNoteMessage | grammy_types.Message.StickerMessage | undefined>;
510
532
  replyMediaGroup(type?: ITMediaGroupType, data?: ITData, AGBaseId?: string, options?: ITOptReplyPhoto | ITOptReplyVideo | ITOptReplyAudio | ITOptReplyDocument): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
511
533
  replyPhoto(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyPhoto): Promise<grammy_types.Message.LocationMessage | grammy_types.Message.ContactMessage | grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.VoiceMessage | grammy_types.Message.VideoNoteMessage | grammy_types.Message.StickerMessage | undefined>;
@@ -772,10 +794,96 @@ declare class WebhookQueue<T = unknown> {
772
794
  dequeue(): Promise<T>;
773
795
  }
774
796
 
775
- type PageRouteResult = {
776
- state: `matched` | `no-match` | `no-handler` | `blocked`;
777
- result: any[];
797
+ type ITE2eUser = {
798
+ id?: number;
799
+ username?: string;
800
+ first_name?: string;
801
+ last_name?: string;
802
+ language_code?: string;
803
+ is_bot?: boolean;
804
+ };
805
+ type ITE2eChat = {
806
+ id?: number;
807
+ type?: `private` | `group` | `supergroup` | `channel`;
808
+ first_name?: string;
809
+ last_name?: string;
810
+ username?: string;
811
+ title?: string;
778
812
  };
813
+ type ITE2eUpdateOptions = {
814
+ user?: ITE2eUser;
815
+ chat?: ITE2eChat;
816
+ date?: number;
817
+ message_id?: number;
818
+ };
819
+ type ITE2eMediaOptions = ITE2eUpdateOptions & {
820
+ caption?: string;
821
+ };
822
+ type ITE2eLocationOptions = ITE2eUpdateOptions & {
823
+ latitude?: number;
824
+ longitude?: number;
825
+ };
826
+ type ITE2eContactOptions = ITE2eUpdateOptions & {
827
+ phone_number?: string;
828
+ first_name?: string;
829
+ last_name?: string;
830
+ user_id?: number;
831
+ };
832
+ type ITE2eCallbackQueryOptions = ITE2eUpdateOptions & {
833
+ id?: string;
834
+ messageText?: string;
835
+ };
836
+ type ITE2eDiceOptions = ITE2eUpdateOptions & {
837
+ emoji?: `🎲` | `🎯` | `🏀` | `⚽` | `🎰` | `🎳`;
838
+ };
839
+
840
+ type ITE2eApiCall = {
841
+ method: string;
842
+ body: any;
843
+ timestamp: number;
844
+ };
845
+ declare class E2eHelper {
846
+ private bot;
847
+ calls: ITE2eApiCall[];
848
+ private _nextUpdateId;
849
+ private _nextMessageId;
850
+ private _nextApiMsgId;
851
+ constructor(bot: Gramstax);
852
+ private _initialized;
853
+ private _ensureInit;
854
+ lastCall(method?: string): ITE2eApiCall | undefined;
855
+ clearCalls(): void;
856
+ gmsg(page: string, aGBaseId: string, data?: Record<string, any>, aLang?: string): string;
857
+ gkb(page: string, aGBaseId: string, aType?: `inline` | `bottom`, data?: Record<string, any>, aLang?: string): string[];
858
+ gmedia(page: string, aGBaseId: string, data?: Record<string, any>, aLang?: string): Record<string, any>;
859
+ extractText(call: ITE2eApiCall): string | undefined;
860
+ extractButtonLabels(call: ITE2eApiCall): string[];
861
+ private _defaultUser;
862
+ private _defaultChat;
863
+ private _nextIds;
864
+ private _buildMessageUpdate;
865
+ handleUpdate(update: Record<string, unknown>): Promise<ITE2eApiCall[]>;
866
+ sendText(text: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
867
+ sendPhoto(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
868
+ sendVideo(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
869
+ sendAudio(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
870
+ sendDocument(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
871
+ sendAnimation(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
872
+ sendVoice(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
873
+ sendVideoNote(options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
874
+ sendSticker(options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
875
+ sendLocation(options?: ITE2eLocationOptions): Promise<ITE2eApiCall[]>;
876
+ sendContact(options?: ITE2eContactOptions): Promise<ITE2eApiCall[]>;
877
+ sendCallbackQuery(data: string, options?: ITE2eCallbackQueryOptions): Promise<ITE2eApiCall[]>;
878
+ sendDice(options?: ITE2eDiceOptions): Promise<ITE2eApiCall[]>;
879
+ sendEditedText(text: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
880
+ sendNewChatMembers(options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
881
+ sendChannelPost(text: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
882
+ sendPollAnswer(pollId: string, optionIds: number[], options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
883
+ sendInlineQuery(query: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
884
+ sendChosenInlineResult(resultId: string, query: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
885
+ }
886
+
779
887
  declare class Gramstax<ICtx extends Ctx = Ctx> {
780
888
  templateManager: TemplateManager;
781
889
  cacheKeyboard: Map<any, any>;
@@ -794,6 +902,7 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
794
902
  };
795
903
  handlerBotUpdate: any;
796
904
  deployType: `polling` | `webhook` | `serverless` | `test`;
905
+ e2e?: E2eHelper;
797
906
  constructor(params: ITGramstaxParams);
798
907
  stop(): Promise<void>;
799
908
  _onCatch(error: BotError<ITCt>): void;
@@ -839,7 +948,7 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
839
948
  _pageBuildData(Page: typeof Ctx, filePath: string): void;
840
949
  _pageSorts(Page: typeof Ctx, pages: typeof Gramstax.prototype.pages, indexPage: number): void;
841
950
  executeSyncBlocksDescription(pages: typeof Gramstax.prototype.pages): Promise<void>;
842
- _pageLoads(): {
951
+ _pageLoads(pagesPath?: string): {
843
952
  all: Record<string, typeof Ctx>;
844
953
  routeDynamic: string[];
845
954
  routeDynamicSpesific: {
@@ -1187,7 +1296,9 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
1187
1296
  lenListRouteStaticSession: number;
1188
1297
  lenListRouteDynamicSpesific: 11;
1189
1298
  };
1190
- _pageRoutes(ctx: ICtx, fromListener: `callbackdata` | keyof typeof Gramstax.prototype.pages.routeDynamicSpesific): Promise<PageRouteResult>;
1299
+ _pageRoutes(ctx: ICtx, fromListener: `callbackdata` | keyof typeof Gramstax.prototype.pages.routeDynamicSpesific): Promise<{
1300
+ state: `matched` | `no-match` | `no-handler` | `blocked`;
1301
+ }>;
1191
1302
  _onHandle(ct: ITCt, listenerName: Parameters<Gramstax[`_pageRoutes`]>[1], shouldCheckNotFound?: boolean): Promise<void>;
1192
1303
  registerLowPlugin?(): Array<ITCtMiddleware<ITCt>>;
1193
1304
  registerLowOnCallbackData(): void;
@@ -1327,4 +1438,4 @@ declare class MockTelegramServer {
1327
1438
  sendCallbackQuery(data: string, options?: ITMockTelegramCallbackQueryOptions): Promise<ITMockTelegramRequestRecord[]>;
1328
1439
  }
1329
1440
 
1330
- export { BlockKeyboard, CacheExternal, Ctx, Gramstax, type ITBottomKb, type ITBottomKbParams, type ITBuildDataOptions, type ITCacheRpc, type ITCompiledTemplate, type ITCt, type ITCtMiddleware, type ITCtxParams, type ITData, type ITGramstaxParams, type ITInBoKb, type ITInlineKb, type ITInlineKbParams, type ITKbCols, type ITKbDest, type ITMediaBlock, type ITMockTelegramCallbackQueryOptions, type ITMockTelegramChat, type ITMockTelegramContactOptions, type ITMockTelegramHandler, type ITMockTelegramJson, type ITMockTelegramLocationOptions, type ITMockTelegramMediaOptions, type ITMockTelegramRequestRecord, type ITMockTelegramServerOptions, type ITMockTelegramUpdateOptions, type ITMockTelegramUser, type ITOptEdit, type ITOptEditMedia1, type ITOptEditMedia2, type ITOptReply, type ITOptReplyAnimation, type ITOptReplyAudio, type ITOptReplyContact, type ITOptReplyDocument, type ITOptReplyLocation, type ITOptReplyPhoto, type ITOptReplyRich, type ITOptReplySticker, type ITOptReplyVideo, type ITOptReplyVideoNote, type ITOptReplyVoice, type ITPageData, type ITReplyAction, type ITTemp, type ITTemplateOptions, type ITWebhookQueueConfig, LabelKeyboard, LoggingHelper, MockTelegramServer, PageManager, TemplateEngine, TemplateManager, WebhookQueue, log };
1441
+ export { BlockKeyboard, CacheExternal, Ctx, E2eHelper, Gramstax, type ITBottomKb, type ITBottomKbParams, type ITBuildDataOptions, type ITCacheRpc, type ITCompiledTemplate, type ITCt, type ITCtMiddleware, type ITCtxParams, type ITData, type ITE2eApiCall, type ITE2eCallbackQueryOptions, type ITE2eChat, type ITE2eContactOptions, type ITE2eDiceOptions, type ITE2eLocationOptions, type ITE2eMediaOptions, type ITE2eUpdateOptions, type ITE2eUser, type ITGramstaxParams, type ITInBoKb, type ITInlineKb, type ITInlineKbParams, type ITKbCols, type ITKbDest, type ITMediaBlock, type ITMockTelegramCallbackQueryOptions, type ITMockTelegramChat, type ITMockTelegramContactOptions, type ITMockTelegramHandler, type ITMockTelegramJson, type ITMockTelegramLocationOptions, type ITMockTelegramMediaOptions, type ITMockTelegramRequestRecord, type ITMockTelegramServerOptions, type ITMockTelegramUpdateOptions, type ITMockTelegramUser, type ITOptEdit, type ITOptEditMedia1, type ITOptEditMedia2, type ITOptReply, type ITOptReplyAnimation, type ITOptReplyAudio, type ITOptReplyContact, type ITOptReplyDocument, type ITOptReplyLocation, type ITOptReplyPhoto, type ITOptReplyRich, type ITOptReplySticker, type ITOptReplyVideo, type ITOptReplyVideoNote, type ITOptReplyVoice, type ITPageData, type ITReplyAction, type ITTemp, type ITTemplateOptions, type ITWebhookQueueConfig, LabelKeyboard, LoggingHelper, MockTelegramServer, PageManager, TemplateEngine, TemplateManager, WebhookQueue, log };
@@ -65,6 +65,7 @@ type ITMediaBlock = {
65
65
  };
66
66
  declare class TemplateEngine {
67
67
  static MAX_MEDIA_GROUP_ITEMS: number;
68
+ static BOT_API_VERSION: string;
68
69
  static ALLOWED_BLOCKS_TELEGRAM_LEGACY: string[];
69
70
  static ALLOWED_BLOCKS_TELEGRAM_RICH: string[];
70
71
  static ALLOWED_BLOCKS_TELEGRAM: string[];
@@ -324,6 +325,20 @@ declare class TemplateEngine {
324
325
  message: string;
325
326
  }>;
326
327
  };
328
+ static validateBlockGMessageRich(html: string): {
329
+ valid: boolean;
330
+ errors: Array<{
331
+ line: number;
332
+ message: string;
333
+ }>;
334
+ };
335
+ static _validateBlockGMessageRichInTemplate(template: string): {
336
+ valid: boolean;
337
+ errors: Array<{
338
+ line: number;
339
+ message: string;
340
+ }>;
341
+ };
327
342
  static validateTemplate(template: string): {
328
343
  valid: boolean;
329
344
  errors: Array<{
@@ -374,12 +389,12 @@ declare class TemplateManager {
374
389
  _compile(key: string, template: string, keepIfExist?: Partial<{
375
390
  [K in keyof ITCompiledTemplate]: boolean;
376
391
  }>, importCache?: Map<string, string>, rawCache?: Map<string, string>, filename?: string): void;
377
- getMedia(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): ReturnType<ITCompiledTemplate[`media`][`default`][`default`]>;
378
- getMessage(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): string;
379
- getDescription(key: string, AGBaseId?: string, ALang?: string, AScope?: string, data?: Record<string, any>): string;
380
- getDescriptionLanguage(key: string, AGBaseId?: string, AScope?: string): string[];
381
- getDescriptionScopes(key: string, AGBaseId?: string): string[];
382
- getKeyboard(key: string, AGBaseId?: string, ALang?: string, AType?: `inline` | `bottom`, data?: Record<string, any>): string[];
392
+ getGMedia(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): ReturnType<ITCompiledTemplate[`media`][`default`][`default`]>;
393
+ getGMessage(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): string;
394
+ getGDescription(key: string, AGBaseId?: string, ALang?: string, AScope?: string, data?: Record<string, any>): string;
395
+ getAGDescriptionLang(key: string, AGBaseId?: string, AScope?: string): string[];
396
+ getAGDescriptionScopes(key: string, AGBaseId?: string): string[];
397
+ getGKeyboard(key: string, AGBaseId?: string, ALang?: string, AType?: `inline` | `bottom`, data?: Record<string, any>): string[];
383
398
  write(filename: string, template: string): Promise<boolean | null>;
384
399
  has(key: string): boolean;
385
400
  destroy(): Promise<void>;
@@ -506,6 +521,13 @@ declare class Ctx {
506
521
  }>;
507
522
  reply(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReply): Promise<grammy_types.Message.TextMessage>;
508
523
  replyRich(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options1?: ITOptReplyRich[0] | null, options2?: ITOptReplyRich[1]): Promise<grammy_types.Message.RichMessageMessage>;
524
+ editRich(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options1?: ITOptReplyRich[0] | null, options2?: ITOptEdit, fallbackReply?: boolean): Promise<true | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
525
+ text: string;
526
+ } & Partial<{
527
+ entities: grammy_types.MessageEntity[];
528
+ }>) | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
529
+ rich_message: grammy_types.RichMessage;
530
+ }) | undefined>;
509
531
  replyMedia<T extends Exclude<ITMediaBlock[`type`], `group`>>(type: T, keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: T extends `photo` ? ITOptReplyPhoto : T extends `video` ? ITOptReplyVideo : T extends `audio` ? ITOptReplyAudio : T extends `document` ? ITOptReplyDocument : T extends `animation` ? ITOptReplyAnimation : T extends `voice` ? ITOptReplyVoice : T extends `video_note` ? ITOptReplyVideoNote : T extends `sticker` ? ITOptReplySticker : T extends `location` ? ITOptReplyLocation : T extends `contact` ? ITOptReplyContact : undefined): Promise<grammy_types.Message.LocationMessage | grammy_types.Message.ContactMessage | grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.VoiceMessage | grammy_types.Message.VideoNoteMessage | grammy_types.Message.StickerMessage | undefined>;
510
532
  replyMediaGroup(type?: ITMediaGroupType, data?: ITData, AGBaseId?: string, options?: ITOptReplyPhoto | ITOptReplyVideo | ITOptReplyAudio | ITOptReplyDocument): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
511
533
  replyPhoto(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyPhoto): Promise<grammy_types.Message.LocationMessage | grammy_types.Message.ContactMessage | grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.VoiceMessage | grammy_types.Message.VideoNoteMessage | grammy_types.Message.StickerMessage | undefined>;
@@ -772,10 +794,96 @@ declare class WebhookQueue<T = unknown> {
772
794
  dequeue(): Promise<T>;
773
795
  }
774
796
 
775
- type PageRouteResult = {
776
- state: `matched` | `no-match` | `no-handler` | `blocked`;
777
- result: any[];
797
+ type ITE2eUser = {
798
+ id?: number;
799
+ username?: string;
800
+ first_name?: string;
801
+ last_name?: string;
802
+ language_code?: string;
803
+ is_bot?: boolean;
804
+ };
805
+ type ITE2eChat = {
806
+ id?: number;
807
+ type?: `private` | `group` | `supergroup` | `channel`;
808
+ first_name?: string;
809
+ last_name?: string;
810
+ username?: string;
811
+ title?: string;
778
812
  };
813
+ type ITE2eUpdateOptions = {
814
+ user?: ITE2eUser;
815
+ chat?: ITE2eChat;
816
+ date?: number;
817
+ message_id?: number;
818
+ };
819
+ type ITE2eMediaOptions = ITE2eUpdateOptions & {
820
+ caption?: string;
821
+ };
822
+ type ITE2eLocationOptions = ITE2eUpdateOptions & {
823
+ latitude?: number;
824
+ longitude?: number;
825
+ };
826
+ type ITE2eContactOptions = ITE2eUpdateOptions & {
827
+ phone_number?: string;
828
+ first_name?: string;
829
+ last_name?: string;
830
+ user_id?: number;
831
+ };
832
+ type ITE2eCallbackQueryOptions = ITE2eUpdateOptions & {
833
+ id?: string;
834
+ messageText?: string;
835
+ };
836
+ type ITE2eDiceOptions = ITE2eUpdateOptions & {
837
+ emoji?: `🎲` | `🎯` | `🏀` | `⚽` | `🎰` | `🎳`;
838
+ };
839
+
840
+ type ITE2eApiCall = {
841
+ method: string;
842
+ body: any;
843
+ timestamp: number;
844
+ };
845
+ declare class E2eHelper {
846
+ private bot;
847
+ calls: ITE2eApiCall[];
848
+ private _nextUpdateId;
849
+ private _nextMessageId;
850
+ private _nextApiMsgId;
851
+ constructor(bot: Gramstax);
852
+ private _initialized;
853
+ private _ensureInit;
854
+ lastCall(method?: string): ITE2eApiCall | undefined;
855
+ clearCalls(): void;
856
+ gmsg(page: string, aGBaseId: string, data?: Record<string, any>, aLang?: string): string;
857
+ gkb(page: string, aGBaseId: string, aType?: `inline` | `bottom`, data?: Record<string, any>, aLang?: string): string[];
858
+ gmedia(page: string, aGBaseId: string, data?: Record<string, any>, aLang?: string): Record<string, any>;
859
+ extractText(call: ITE2eApiCall): string | undefined;
860
+ extractButtonLabels(call: ITE2eApiCall): string[];
861
+ private _defaultUser;
862
+ private _defaultChat;
863
+ private _nextIds;
864
+ private _buildMessageUpdate;
865
+ handleUpdate(update: Record<string, unknown>): Promise<ITE2eApiCall[]>;
866
+ sendText(text: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
867
+ sendPhoto(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
868
+ sendVideo(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
869
+ sendAudio(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
870
+ sendDocument(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
871
+ sendAnimation(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
872
+ sendVoice(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
873
+ sendVideoNote(options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
874
+ sendSticker(options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
875
+ sendLocation(options?: ITE2eLocationOptions): Promise<ITE2eApiCall[]>;
876
+ sendContact(options?: ITE2eContactOptions): Promise<ITE2eApiCall[]>;
877
+ sendCallbackQuery(data: string, options?: ITE2eCallbackQueryOptions): Promise<ITE2eApiCall[]>;
878
+ sendDice(options?: ITE2eDiceOptions): Promise<ITE2eApiCall[]>;
879
+ sendEditedText(text: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
880
+ sendNewChatMembers(options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
881
+ sendChannelPost(text: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
882
+ sendPollAnswer(pollId: string, optionIds: number[], options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
883
+ sendInlineQuery(query: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
884
+ sendChosenInlineResult(resultId: string, query: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
885
+ }
886
+
779
887
  declare class Gramstax<ICtx extends Ctx = Ctx> {
780
888
  templateManager: TemplateManager;
781
889
  cacheKeyboard: Map<any, any>;
@@ -794,6 +902,7 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
794
902
  };
795
903
  handlerBotUpdate: any;
796
904
  deployType: `polling` | `webhook` | `serverless` | `test`;
905
+ e2e?: E2eHelper;
797
906
  constructor(params: ITGramstaxParams);
798
907
  stop(): Promise<void>;
799
908
  _onCatch(error: BotError<ITCt>): void;
@@ -839,7 +948,7 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
839
948
  _pageBuildData(Page: typeof Ctx, filePath: string): void;
840
949
  _pageSorts(Page: typeof Ctx, pages: typeof Gramstax.prototype.pages, indexPage: number): void;
841
950
  executeSyncBlocksDescription(pages: typeof Gramstax.prototype.pages): Promise<void>;
842
- _pageLoads(): {
951
+ _pageLoads(pagesPath?: string): {
843
952
  all: Record<string, typeof Ctx>;
844
953
  routeDynamic: string[];
845
954
  routeDynamicSpesific: {
@@ -1187,7 +1296,9 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
1187
1296
  lenListRouteStaticSession: number;
1188
1297
  lenListRouteDynamicSpesific: 11;
1189
1298
  };
1190
- _pageRoutes(ctx: ICtx, fromListener: `callbackdata` | keyof typeof Gramstax.prototype.pages.routeDynamicSpesific): Promise<PageRouteResult>;
1299
+ _pageRoutes(ctx: ICtx, fromListener: `callbackdata` | keyof typeof Gramstax.prototype.pages.routeDynamicSpesific): Promise<{
1300
+ state: `matched` | `no-match` | `no-handler` | `blocked`;
1301
+ }>;
1191
1302
  _onHandle(ct: ITCt, listenerName: Parameters<Gramstax[`_pageRoutes`]>[1], shouldCheckNotFound?: boolean): Promise<void>;
1192
1303
  registerLowPlugin?(): Array<ITCtMiddleware<ITCt>>;
1193
1304
  registerLowOnCallbackData(): void;
@@ -1327,4 +1438,4 @@ declare class MockTelegramServer {
1327
1438
  sendCallbackQuery(data: string, options?: ITMockTelegramCallbackQueryOptions): Promise<ITMockTelegramRequestRecord[]>;
1328
1439
  }
1329
1440
 
1330
- export { BlockKeyboard, CacheExternal, Ctx, Gramstax, type ITBottomKb, type ITBottomKbParams, type ITBuildDataOptions, type ITCacheRpc, type ITCompiledTemplate, type ITCt, type ITCtMiddleware, type ITCtxParams, type ITData, type ITGramstaxParams, type ITInBoKb, type ITInlineKb, type ITInlineKbParams, type ITKbCols, type ITKbDest, type ITMediaBlock, type ITMockTelegramCallbackQueryOptions, type ITMockTelegramChat, type ITMockTelegramContactOptions, type ITMockTelegramHandler, type ITMockTelegramJson, type ITMockTelegramLocationOptions, type ITMockTelegramMediaOptions, type ITMockTelegramRequestRecord, type ITMockTelegramServerOptions, type ITMockTelegramUpdateOptions, type ITMockTelegramUser, type ITOptEdit, type ITOptEditMedia1, type ITOptEditMedia2, type ITOptReply, type ITOptReplyAnimation, type ITOptReplyAudio, type ITOptReplyContact, type ITOptReplyDocument, type ITOptReplyLocation, type ITOptReplyPhoto, type ITOptReplyRich, type ITOptReplySticker, type ITOptReplyVideo, type ITOptReplyVideoNote, type ITOptReplyVoice, type ITPageData, type ITReplyAction, type ITTemp, type ITTemplateOptions, type ITWebhookQueueConfig, LabelKeyboard, LoggingHelper, MockTelegramServer, PageManager, TemplateEngine, TemplateManager, WebhookQueue, log };
1441
+ export { BlockKeyboard, CacheExternal, Ctx, E2eHelper, Gramstax, type ITBottomKb, type ITBottomKbParams, type ITBuildDataOptions, type ITCacheRpc, type ITCompiledTemplate, type ITCt, type ITCtMiddleware, type ITCtxParams, type ITData, type ITE2eApiCall, type ITE2eCallbackQueryOptions, type ITE2eChat, type ITE2eContactOptions, type ITE2eDiceOptions, type ITE2eLocationOptions, type ITE2eMediaOptions, type ITE2eUpdateOptions, type ITE2eUser, type ITGramstaxParams, type ITInBoKb, type ITInlineKb, type ITInlineKbParams, type ITKbCols, type ITKbDest, type ITMediaBlock, type ITMockTelegramCallbackQueryOptions, type ITMockTelegramChat, type ITMockTelegramContactOptions, type ITMockTelegramHandler, type ITMockTelegramJson, type ITMockTelegramLocationOptions, type ITMockTelegramMediaOptions, type ITMockTelegramRequestRecord, type ITMockTelegramServerOptions, type ITMockTelegramUpdateOptions, type ITMockTelegramUser, type ITOptEdit, type ITOptEditMedia1, type ITOptEditMedia2, type ITOptReply, type ITOptReplyAnimation, type ITOptReplyAudio, type ITOptReplyContact, type ITOptReplyDocument, type ITOptReplyLocation, type ITOptReplyPhoto, type ITOptReplyRich, type ITOptReplySticker, type ITOptReplyVideo, type ITOptReplyVideoNote, type ITOptReplyVoice, type ITPageData, type ITReplyAction, type ITTemp, type ITTemplateOptions, type ITWebhookQueueConfig, LabelKeyboard, LoggingHelper, MockTelegramServer, PageManager, TemplateEngine, TemplateManager, WebhookQueue, log };