gramstax 0.8.24 → 0.9.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/dist/src/index.cjs +7 -7
- package/dist/src/index.d.cts +196 -250
- package/dist/src/index.d.ts +196 -250
- package/dist/src/index.js +7 -7
- package/package.json +5 -5
package/dist/src/index.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { LoggingPretty } from 'logging-pretty';
|
|
2
2
|
import { Keyv } from 'keyv';
|
|
3
3
|
import * as grammy from 'grammy';
|
|
4
|
-
import { Context, Keyboard, InlineKeyboard, BotConfig, Bot, BotError } from 'grammy';
|
|
4
|
+
import { Context, Keyboard, InlineKeyboard, Middleware, BotConfig, Bot, BotError } from 'grammy';
|
|
5
5
|
import * as grammy_types from 'grammy/types';
|
|
6
6
|
import { UserFromGetMe } from 'grammy/types';
|
|
7
7
|
import { FSWatcher } from 'chokidar';
|
|
8
|
-
import * as node_worker_threads from 'node:worker_threads';
|
|
9
|
-
import { Worker } from 'node:worker_threads';
|
|
10
|
-
import { Server, Client } from 'net-ipc';
|
|
11
8
|
|
|
12
9
|
declare class LoggingHelper extends LoggingPretty {
|
|
13
10
|
private timers;
|
|
@@ -68,69 +65,82 @@ type ITMediaBlock = {
|
|
|
68
65
|
};
|
|
69
66
|
declare class TemplateEngine {
|
|
70
67
|
static MAX_MEDIA_GROUP_ITEMS: number;
|
|
68
|
+
static ALLOWED_BLOCKS_TELEGRAM_LEGACY: string[];
|
|
69
|
+
static ALLOWED_BLOCKS_TELEGRAM_RICH: string[];
|
|
70
|
+
static ALLOWED_BLOCKS_TELEGRAM: string[];
|
|
71
|
+
static ALLOWED_BLOCKS_PAGE: string[];
|
|
71
72
|
static ALLOWED_BLOCKS: string[];
|
|
73
|
+
static _extractBlockNames(blocks: string[]): Set<string>;
|
|
74
|
+
static _TELEGRAM_REQUIRED_ATTRS: Record<string, string[] | {
|
|
75
|
+
oneOf: string[][];
|
|
76
|
+
}>;
|
|
77
|
+
static _TELEGRAM_ATTR_VALUE_VALIDATORS: Record<string, Record<string, (value: string) => string | null>>;
|
|
78
|
+
static _PAGE_REQUIRED_ATTRS: Record<string, string[] | {
|
|
79
|
+
oneOf: string[][];
|
|
80
|
+
}>;
|
|
81
|
+
static _PAGE_ATTR_VALUE_VALIDATORS: Record<string, Record<string, (value: string) => string | null>>;
|
|
72
82
|
static ALLOWED_SCOPE: string[];
|
|
73
83
|
static _escape(str: string): string;
|
|
74
84
|
static _processScopeVariables(template: string): string;
|
|
75
85
|
static _processScopeExec(template: string): string;
|
|
76
|
-
static
|
|
77
|
-
[
|
|
86
|
+
static _processGBaseBlocks(template: string): {
|
|
87
|
+
[AGBaseId: string]: string;
|
|
78
88
|
};
|
|
79
|
-
static
|
|
80
|
-
static
|
|
81
|
-
static
|
|
82
|
-
static
|
|
83
|
-
static
|
|
84
|
-
static
|
|
89
|
+
static _processGScriptBlocks(template: string): string;
|
|
90
|
+
static _processGSpaceBlocks(template: string): string;
|
|
91
|
+
static _processGDivBlocks(template: string): string;
|
|
92
|
+
static _processGSwitchBlocks(template: string): string;
|
|
93
|
+
static _processGMapBlocks(template: string): string;
|
|
94
|
+
static _processGMediaBlocks(template: string): {
|
|
85
95
|
[lang: string]: ITMediaBlock;
|
|
86
96
|
};
|
|
87
97
|
static _splitMediaSrcList(src: string): string[];
|
|
88
|
-
static
|
|
98
|
+
static _processGMediaGroupBlocks(template: string): {
|
|
89
99
|
[lang: string]: ITMediaBlock;
|
|
90
100
|
};
|
|
91
101
|
private static _processMediaGroupItems;
|
|
92
|
-
static
|
|
102
|
+
static _processGMessageBlocks(template: string): {
|
|
93
103
|
[lang: string]: string;
|
|
94
104
|
};
|
|
95
|
-
static
|
|
105
|
+
static _processGDescriptionBlocks(template: string): {
|
|
96
106
|
[lang: string]: {
|
|
97
107
|
[scope: string]: string;
|
|
98
108
|
};
|
|
99
109
|
};
|
|
100
|
-
static
|
|
110
|
+
static _processGKeyboardBlocks(template: string): {
|
|
101
111
|
[lang: string]: {
|
|
102
112
|
inline?: string;
|
|
103
113
|
bottom?: string;
|
|
104
114
|
};
|
|
105
115
|
};
|
|
106
116
|
static _compileToFunction<T extends boolean>(template: T extends true ? string[] : string, isArray: T): T extends true ? (data?: Record<string, any>) => string[] : (data?: Record<string, any>) => string;
|
|
107
|
-
static
|
|
108
|
-
[
|
|
109
|
-
[
|
|
117
|
+
static compileBlockGMedia(template: string, baseBlocks?: ReturnType<typeof TemplateEngine._processGBaseBlocks>): {
|
|
118
|
+
[AGBaseId: string]: {
|
|
119
|
+
[ALang: string]: (data?: Record<string, any>) => ITMediaBlock;
|
|
110
120
|
};
|
|
111
121
|
};
|
|
112
|
-
static
|
|
113
|
-
[
|
|
114
|
-
[
|
|
122
|
+
static compileBlockGMessage(template: string, baseBlocks?: ReturnType<typeof TemplateEngine._processGBaseBlocks>): {
|
|
123
|
+
[AGBaseId: string]: {
|
|
124
|
+
[ALang: string]: (data?: Record<string, any>) => string;
|
|
115
125
|
};
|
|
116
126
|
};
|
|
117
|
-
static
|
|
118
|
-
[
|
|
119
|
-
[
|
|
120
|
-
[
|
|
127
|
+
static compileBlockGDescription(template: string, gBaseBlocks?: ReturnType<typeof TemplateEngine._processGBaseBlocks>): {
|
|
128
|
+
[AGBaseId: string]: {
|
|
129
|
+
[AScope: string]: {
|
|
130
|
+
[ALang: string]: (data?: Record<string, any>) => string;
|
|
121
131
|
};
|
|
122
132
|
};
|
|
123
133
|
};
|
|
124
|
-
static
|
|
125
|
-
[
|
|
126
|
-
[
|
|
134
|
+
static compileBlockGKeyboards(template: string, gBaseBlocks?: ReturnType<typeof TemplateEngine._processGBaseBlocks>): {
|
|
135
|
+
[AGBaseId: string]: {
|
|
136
|
+
[ALang: string]: {
|
|
127
137
|
inline?: (data?: Record<string, any>) => string[];
|
|
128
138
|
bottom?: (data?: Record<string, any>) => string[];
|
|
129
139
|
};
|
|
130
140
|
};
|
|
131
141
|
};
|
|
132
|
-
static _extractBlock(content: string, blocks?: string | string[],
|
|
133
|
-
static
|
|
142
|
+
static _extractBlock(content: string, blocks?: string | string[], AGBaseId?: string, section?: `all` | `value`, lang?: string): string;
|
|
143
|
+
static _processGImportBlocks(template: string): {
|
|
134
144
|
processed: string;
|
|
135
145
|
imports: {
|
|
136
146
|
src: string;
|
|
@@ -141,7 +151,7 @@ declare class TemplateEngine {
|
|
|
141
151
|
indent: string;
|
|
142
152
|
}[];
|
|
143
153
|
};
|
|
144
|
-
static
|
|
154
|
+
static processGImportBlocks(template: string, resolver: (src: string) => string | null, depth?: number, importCache?: Map<string, string>): string;
|
|
145
155
|
static validateNamesBlock(template: string): {
|
|
146
156
|
valid: boolean;
|
|
147
157
|
errors: Array<{
|
|
@@ -171,35 +181,79 @@ declare class TemplateEngine {
|
|
|
171
181
|
}>;
|
|
172
182
|
};
|
|
173
183
|
private static _validateBlockAttributes;
|
|
174
|
-
static
|
|
184
|
+
static _validateTelegramTagAttributes(template: string): Array<{
|
|
185
|
+
line: number;
|
|
186
|
+
message: string;
|
|
187
|
+
}>;
|
|
188
|
+
static validateTelegramAttributesBlock(template: string): {
|
|
189
|
+
valid: boolean;
|
|
190
|
+
errors: Array<{
|
|
191
|
+
line: number;
|
|
192
|
+
message: string;
|
|
193
|
+
}>;
|
|
194
|
+
};
|
|
195
|
+
static _validateTelegramTagAttributeValues(template: string): Array<{
|
|
196
|
+
line: number;
|
|
197
|
+
message: string;
|
|
198
|
+
}>;
|
|
199
|
+
static validateTelegramAttributeValuesBlock(template: string): {
|
|
200
|
+
valid: boolean;
|
|
201
|
+
errors: Array<{
|
|
202
|
+
line: number;
|
|
203
|
+
message: string;
|
|
204
|
+
}>;
|
|
205
|
+
};
|
|
206
|
+
static _validatePageTagAttributes(template: string): Array<{
|
|
207
|
+
line: number;
|
|
208
|
+
message: string;
|
|
209
|
+
}>;
|
|
210
|
+
static validatePageAttributesBlock(template: string): {
|
|
211
|
+
valid: boolean;
|
|
212
|
+
errors: Array<{
|
|
213
|
+
line: number;
|
|
214
|
+
message: string;
|
|
215
|
+
}>;
|
|
216
|
+
};
|
|
217
|
+
static _validatePageTagAttributeValues(template: string): Array<{
|
|
218
|
+
line: number;
|
|
219
|
+
message: string;
|
|
220
|
+
}>;
|
|
221
|
+
static validatePageAttributeValuesBlock(template: string): {
|
|
222
|
+
valid: boolean;
|
|
223
|
+
errors: Array<{
|
|
224
|
+
line: number;
|
|
225
|
+
message: string;
|
|
226
|
+
}>;
|
|
227
|
+
};
|
|
228
|
+
static validateBlockGBaseAttributes(template: string): {
|
|
175
229
|
valid: boolean;
|
|
176
230
|
errors: Array<{
|
|
177
231
|
line: number;
|
|
178
232
|
message: string;
|
|
179
233
|
}>;
|
|
180
234
|
};
|
|
181
|
-
static
|
|
235
|
+
static validateBlockGMessageAttributes(template: string): {
|
|
182
236
|
valid: boolean;
|
|
183
237
|
errors: Array<{
|
|
184
238
|
line: number;
|
|
185
239
|
message: string;
|
|
186
240
|
}>;
|
|
187
241
|
};
|
|
188
|
-
static
|
|
242
|
+
static validateBlockGKeyboardAttributes(template: string): {
|
|
189
243
|
valid: boolean;
|
|
190
244
|
errors: Array<{
|
|
191
245
|
line: number;
|
|
192
246
|
message: string;
|
|
193
247
|
}>;
|
|
194
248
|
};
|
|
195
|
-
static
|
|
249
|
+
static validateBlockGMediaAttributes(template: string): {
|
|
196
250
|
valid: boolean;
|
|
197
251
|
errors: Array<{
|
|
198
252
|
line: number;
|
|
199
253
|
message: string;
|
|
200
254
|
}>;
|
|
201
255
|
};
|
|
202
|
-
static
|
|
256
|
+
static validateBlockGMediaGroupAttributes(template: string): {
|
|
203
257
|
valid: boolean;
|
|
204
258
|
errors: Array<{
|
|
205
259
|
line: number;
|
|
@@ -207,63 +261,63 @@ declare class TemplateEngine {
|
|
|
207
261
|
}>;
|
|
208
262
|
};
|
|
209
263
|
private static _validateMediaGroupItems;
|
|
210
|
-
static
|
|
264
|
+
static validateBlockGDescriptionAttributes(template: string): {
|
|
211
265
|
valid: boolean;
|
|
212
266
|
errors: Array<{
|
|
213
267
|
line: number;
|
|
214
268
|
message: string;
|
|
215
269
|
}>;
|
|
216
270
|
};
|
|
217
|
-
static
|
|
271
|
+
static validateBlockGScriptAttributes(template: string): {
|
|
218
272
|
valid: boolean;
|
|
219
273
|
errors: Array<{
|
|
220
274
|
line: number;
|
|
221
275
|
message: string;
|
|
222
276
|
}>;
|
|
223
277
|
};
|
|
224
|
-
static
|
|
278
|
+
static validateBlockGSwitchAttributes(template: string): {
|
|
225
279
|
valid: boolean;
|
|
226
280
|
errors: Array<{
|
|
227
281
|
line: number;
|
|
228
282
|
message: string;
|
|
229
283
|
}>;
|
|
230
284
|
};
|
|
231
|
-
static
|
|
285
|
+
static validateBlockGCaseAttributes(template: string): {
|
|
232
286
|
valid: boolean;
|
|
233
287
|
errors: Array<{
|
|
234
288
|
line: number;
|
|
235
289
|
message: string;
|
|
236
290
|
}>;
|
|
237
291
|
};
|
|
238
|
-
static
|
|
292
|
+
static validateBlockGDefaultAttributes(template: string): {
|
|
239
293
|
valid: boolean;
|
|
240
294
|
errors: Array<{
|
|
241
295
|
line: number;
|
|
242
296
|
message: string;
|
|
243
297
|
}>;
|
|
244
298
|
};
|
|
245
|
-
static
|
|
299
|
+
static validateBlockGMapAttributes(template: string): {
|
|
246
300
|
valid: boolean;
|
|
247
301
|
errors: Array<{
|
|
248
302
|
line: number;
|
|
249
303
|
message: string;
|
|
250
304
|
}>;
|
|
251
305
|
};
|
|
252
|
-
static
|
|
306
|
+
static validateBlockGDivAttributes(template: string): {
|
|
253
307
|
valid: boolean;
|
|
254
308
|
errors: Array<{
|
|
255
309
|
line: number;
|
|
256
310
|
message: string;
|
|
257
311
|
}>;
|
|
258
312
|
};
|
|
259
|
-
static
|
|
313
|
+
static validateBlockGImportAttributes(template: string): {
|
|
260
314
|
valid: boolean;
|
|
261
315
|
errors: Array<{
|
|
262
316
|
line: number;
|
|
263
317
|
message: string;
|
|
264
318
|
}>;
|
|
265
319
|
};
|
|
266
|
-
static
|
|
320
|
+
static validateBlockGSpaceAttributes(template: string): {
|
|
267
321
|
valid: boolean;
|
|
268
322
|
errors: Array<{
|
|
269
323
|
line: number;
|
|
@@ -280,10 +334,10 @@ declare class TemplateEngine {
|
|
|
280
334
|
}
|
|
281
335
|
|
|
282
336
|
type ITCompiledTemplate = {
|
|
283
|
-
media: ReturnType<typeof TemplateEngine.
|
|
284
|
-
message: ReturnType<typeof TemplateEngine.
|
|
285
|
-
keyboard: ReturnType<typeof TemplateEngine.
|
|
286
|
-
description: ReturnType<typeof TemplateEngine.
|
|
337
|
+
media: ReturnType<typeof TemplateEngine.compileBlockGMedia>;
|
|
338
|
+
message: ReturnType<typeof TemplateEngine.compileBlockGMessage>;
|
|
339
|
+
keyboard: ReturnType<typeof TemplateEngine.compileBlockGKeyboards>;
|
|
340
|
+
description: ReturnType<typeof TemplateEngine.compileBlockGDescription>;
|
|
287
341
|
};
|
|
288
342
|
type ITTemplateOptions = {
|
|
289
343
|
path: string[];
|
|
@@ -311,21 +365,21 @@ declare class TemplateManager {
|
|
|
311
365
|
_getExtension(filename: string): string;
|
|
312
366
|
_readTemplateFile(filename: string): string | null;
|
|
313
367
|
_isValidFile(filename: string): boolean;
|
|
314
|
-
|
|
315
|
-
|
|
368
|
+
_getGBaseAtLine(template: string, line: number): {
|
|
369
|
+
AGBaseId: string | null;
|
|
316
370
|
hasId: boolean;
|
|
317
371
|
} | null;
|
|
318
|
-
_validateTemplate(
|
|
372
|
+
_validateTemplate(AGBaseId: string, template: string, filename?: string): void;
|
|
319
373
|
_getKey(filename: string): string;
|
|
320
374
|
_compile(key: string, template: string, keepIfExist?: Partial<{
|
|
321
375
|
[K in keyof ITCompiledTemplate]: boolean;
|
|
322
376
|
}>, importCache?: Map<string, string>, rawCache?: Map<string, string>, filename?: string): void;
|
|
323
|
-
getMedia(key: string,
|
|
324
|
-
getMessage(key: string,
|
|
325
|
-
getDescription(key: string,
|
|
326
|
-
getDescriptionLanguage(key: string,
|
|
327
|
-
getDescriptionScopes(key: string,
|
|
328
|
-
getKeyboard(key: string,
|
|
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[];
|
|
329
383
|
write(filename: string, template: string): Promise<boolean | null>;
|
|
330
384
|
has(key: string): boolean;
|
|
331
385
|
destroy(): Promise<void>;
|
|
@@ -335,6 +389,8 @@ type ITInlineKb = InlineKeyboard;
|
|
|
335
389
|
type ITBottomKb = Keyboard;
|
|
336
390
|
type ITInBoKb = ITBottomKb | ITInlineKb;
|
|
337
391
|
type ITCt = Context;
|
|
392
|
+
type ITCtMiddleware<C extends ITCt = ITCt> = Middleware<C>;
|
|
393
|
+
type ITOptReplyRich = Parameters<Context[`replyWithRichMessage`]>;
|
|
338
394
|
type ITOptReply = Parameters<Context[`reply`]>[1];
|
|
339
395
|
type ITOptReplyPhoto = Parameters<Context[`replyWithPhoto`]>[1];
|
|
340
396
|
type ITOptReplyVideo = Parameters<Context[`replyWithVideo`]>[1];
|
|
@@ -352,12 +408,12 @@ type ITOptEditMedia2 = Parameters<Context[`editMessageMedia`]>[1];
|
|
|
352
408
|
type ITReplyAction = Parameters<Context[`replyWithChatAction`]>[0];
|
|
353
409
|
type ITData = Record<string, any>;
|
|
354
410
|
type ITBottomKbParams = {
|
|
355
|
-
|
|
411
|
+
AGBaseId?: string;
|
|
356
412
|
data?: ITData;
|
|
357
413
|
cache?: boolean;
|
|
358
414
|
};
|
|
359
415
|
type ITInlineKbParams = {
|
|
360
|
-
|
|
416
|
+
AGBaseId?: string;
|
|
361
417
|
data?: ITData;
|
|
362
418
|
cache?: boolean;
|
|
363
419
|
};
|
|
@@ -438,55 +494,58 @@ declare class Ctx {
|
|
|
438
494
|
constructor(params: ITCtxParams);
|
|
439
495
|
hookBeforeRoute?(): Promise<boolean>;
|
|
440
496
|
hookAfterRoute?(): Promise<void>;
|
|
441
|
-
broadcast(ids: number[], languageCode: string[], keyboard?: ITInBoKb, data?: ITData,
|
|
497
|
+
broadcast(ids: number[], languageCode: string[], keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReply, throwError?: boolean): Promise<{
|
|
442
498
|
successCount: number;
|
|
443
499
|
failedCount: number;
|
|
444
500
|
totalCount: number;
|
|
445
501
|
}>;
|
|
446
|
-
broadcastMedia(ids: number[], languageCode: string[], keyboard?: ITInBoKb, data?: ITData,
|
|
502
|
+
broadcastMedia(ids: number[], languageCode: string[], keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyPhoto | ITOptReplyVideo | ITOptReplyAudio | ITOptReplyDocument | ITOptReplyAnimation | ITOptReplyVoice | ITOptReplyVideoNote | ITOptReplySticker | ITOptReplyLocation | ITOptReplyContact, throwError?: boolean): Promise<{
|
|
447
503
|
successCount: number;
|
|
448
504
|
failedCount: number;
|
|
449
505
|
totalCount: number;
|
|
450
506
|
}>;
|
|
451
|
-
reply(keyboard?: ITInBoKb, data?: ITData,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
507
|
+
reply(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReply): Promise<grammy_types.Message.TextMessage>;
|
|
508
|
+
replyRich(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options1?: ITOptReplyRich[0] | null, options2?: ITOptReplyRich[1]): Promise<grammy_types.Message.RichMessageMessage>;
|
|
509
|
+
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
|
+
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
|
+
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>;
|
|
512
|
+
replyPhotoGroup(data?: ITData, AGBaseId?: string, options?: ITOptReplyPhoto): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
|
|
513
|
+
replyVideo(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyVideo): 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>;
|
|
514
|
+
replyVideoGroup(data?: ITData, AGBaseId?: string, options?: ITOptReplyVideo): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
|
|
515
|
+
replyAudio(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyAudio): 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>;
|
|
516
|
+
replyAudioGroup(data?: ITData, AGBaseId?: string, options?: ITOptReplyAudio): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
|
|
517
|
+
replyDocument(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyDocument): 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>;
|
|
518
|
+
replyDocumentGroup(data?: ITData, AGBaseId?: string, options?: ITOptReplyDocument): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
|
|
519
|
+
replyAnimation(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyAnimation): 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>;
|
|
520
|
+
replyVoice(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyVoice): 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>;
|
|
521
|
+
replyVideoNote(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyVideoNote): 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>;
|
|
522
|
+
replySticker(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplySticker): 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>;
|
|
523
|
+
replyLocation(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyLocation): 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>;
|
|
524
|
+
replyContact(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyContact): 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>;
|
|
468
525
|
replyAction(type: ITReplyAction): Promise<true>;
|
|
469
|
-
edit(keyboardInline?: ITInlineKb, data?: ITData,
|
|
526
|
+
edit(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options?: ITOptEdit, fallbackReply?: boolean): Promise<true | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
|
|
470
527
|
text: string;
|
|
471
528
|
} & Partial<{
|
|
472
529
|
entities: grammy_types.MessageEntity[];
|
|
473
|
-
}>) |
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
530
|
+
}>) | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
|
|
531
|
+
rich_message: grammy_types.RichMessage;
|
|
532
|
+
}) | undefined>;
|
|
533
|
+
editMedia<T extends Exclude<ITMediaBlock[`type`], `group`>>(type: T, keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options1?: T extends `voice` ? ITOptReplyVoice : T extends `video_note` ? ITOptReplyVideoNote : T extends `sticker` ? ITOptReplySticker : T extends `location` ? ITOptReplyLocation : T extends `contact` ? ITOptReplyContact : ITOptEditMedia1, options2?: ITOptEditMedia2, fallbackReply?: boolean): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
534
|
+
editPhoto(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options1?: ITOptEditMedia1, options2?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
535
|
+
editVideo(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options1?: ITOptEditMedia1, options2?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
536
|
+
editAudio(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options1?: ITOptEditMedia1, options2?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
537
|
+
editDocument(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options1?: ITOptEditMedia1, options2?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
538
|
+
editMediaGroup(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)[]>;
|
|
539
|
+
editPhotoGroup(data?: ITData, AGBaseId?: string, options?: ITOptReplyPhoto): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
|
|
540
|
+
editVideoGroup(data?: ITData, AGBaseId?: string, options?: ITOptReplyVideo): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
|
|
541
|
+
editAudioGroup(data?: ITData, AGBaseId?: string, options?: ITOptReplyAudio): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
|
|
542
|
+
editDocumentGroup(data?: ITData, AGBaseId?: string, options?: ITOptReplyDocument): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
|
|
543
|
+
editAnimation(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options1?: ITOptEditMedia1, options2?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
544
|
+
editVoice(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
545
|
+
editVideoNote(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
546
|
+
editSticker(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
547
|
+
editLocation(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
548
|
+
editContact(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options?: ITOptEditMedia2): Promise<true | 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 | (grammy_types.Update.Edited & grammy_types.Message) | (grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[] | undefined>;
|
|
490
549
|
delete(): Promise<true>;
|
|
491
550
|
callbackQueryAnswer(options?: Parameters<typeof Ctx.prototype.ct.answerCallbackQuery>[0]): Promise<true | null>;
|
|
492
551
|
setSession(method: string | string[], params: any, moreRoot?: Record<any, any>): Promise<boolean | null>;
|
|
@@ -497,8 +556,8 @@ declare class Ctx {
|
|
|
497
556
|
static buildData(options: ITBuildDataOptions): ITPageData<[]>;
|
|
498
557
|
static buildData(): ITPageData<[]>;
|
|
499
558
|
keyboardCols<T = any>(k: T, l: string[], layout: ITKbCols, cb: (e: string, i: number) => any): T;
|
|
500
|
-
bottomKeyboardT(layout?: ITKbCols,
|
|
501
|
-
inlineKeyboardT(PageDest: ITKbDest[], layout?: ITKbCols,
|
|
559
|
+
bottomKeyboardT(layout?: ITKbCols, AGBaseId?: string | null, data?: Record<any, any>): Keyboard;
|
|
560
|
+
inlineKeyboardT(PageDest: ITKbDest[], layout?: ITKbCols, AGBaseId?: string | null, data?: ITData): InlineKeyboard;
|
|
502
561
|
inlineKeyboard(callback: (k: ITInlineKb, l: string[]) => ITInlineKb, params?: ITInlineKbParams): ITInlineKb;
|
|
503
562
|
bottomKeyboard(callback: (k: ITBottomKb, l: string[]) => ITBottomKb, params?: ITBottomKbParams): ITBottomKb;
|
|
504
563
|
getSeperatorTag(mtd?: `space` | `colon`): " " | ":";
|
|
@@ -713,6 +772,10 @@ declare class WebhookQueue<T = unknown> {
|
|
|
713
772
|
dequeue(): Promise<T>;
|
|
714
773
|
}
|
|
715
774
|
|
|
775
|
+
type PageRouteResult = {
|
|
776
|
+
state: `matched` | `no-match` | `no-handler` | `blocked`;
|
|
777
|
+
result: any[];
|
|
778
|
+
};
|
|
716
779
|
declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
717
780
|
templateManager: TemplateManager;
|
|
718
781
|
cacheKeyboard: Map<any, any>;
|
|
@@ -723,7 +786,7 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
723
786
|
};
|
|
724
787
|
log: LoggingHelper | undefined;
|
|
725
788
|
bot: Bot;
|
|
726
|
-
botConfig?: BotConfig<
|
|
789
|
+
botConfig?: BotConfig<ITCt>;
|
|
727
790
|
webhookQueue?: ITWebhookQueueConfig;
|
|
728
791
|
protected webhookQueueInstance?: WebhookQueue<any>;
|
|
729
792
|
protected webhookServer?: {
|
|
@@ -733,25 +796,30 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
733
796
|
deployType: `polling` | `webhook` | `serverless` | `test`;
|
|
734
797
|
constructor(params: ITGramstaxParams);
|
|
735
798
|
stop(): Promise<void>;
|
|
736
|
-
_onCatch(error: BotError<
|
|
799
|
+
_onCatch(error: BotError<ITCt>): void;
|
|
800
|
+
_onStart(botInfo: UserFromGetMe, method: `polling` | `webhook` | `serverless`, data: string | null): Promise<void>;
|
|
737
801
|
hookBeforeStart?(): Promise<any>;
|
|
738
802
|
hookAfterStart?(): Promise<any>;
|
|
739
|
-
hookBeforeRoute?(ctx: ICtx, data
|
|
803
|
+
hookBeforeRoute?(ctx: ICtx, data?: {
|
|
740
804
|
listenerName: string;
|
|
805
|
+
isEdit: boolean;
|
|
741
806
|
}): Promise<boolean>;
|
|
742
|
-
hookAfterRoute?(ctx: ICtx, data
|
|
807
|
+
hookAfterRoute?(ctx: ICtx, data?: {
|
|
743
808
|
listenerName: string;
|
|
744
|
-
|
|
809
|
+
state: `matched` | `no-match` | `no-handler` | `blocked` | `error` | `notfound`;
|
|
810
|
+
isEdit: boolean;
|
|
745
811
|
}): Promise<void>;
|
|
746
|
-
hookErrorPage?(ctx: ICtx, data
|
|
812
|
+
hookErrorPage?(ctx: ICtx, data?: {
|
|
747
813
|
listenerName: string;
|
|
748
814
|
error: any;
|
|
749
815
|
isEdit: boolean;
|
|
750
816
|
}): Promise<void>;
|
|
751
|
-
hookErrorInputNotFoundPage?(ctx: ICtx
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
817
|
+
hookErrorInputNotFoundPage?(ctx: ICtx, data?: {
|
|
818
|
+
listenerName: string;
|
|
819
|
+
isEdit: boolean;
|
|
820
|
+
}): Promise<void>;
|
|
821
|
+
createBot(token: string): Bot<grammy.Context, grammy.Api<grammy.RawApi>>;
|
|
822
|
+
createCtx(ct: ITCt): ICtx;
|
|
755
823
|
_runPolling(): void;
|
|
756
824
|
_runWebhook(fullUrl: string): Promise<void>;
|
|
757
825
|
_startWebhookWorker(queue: WebhookQueue<any>, acquireChat: (chatId: any) => Promise<() => void>, getChatId: (update: any) => any): void;
|
|
@@ -1113,39 +1181,27 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
1113
1181
|
listRouteStatic: readonly ["handleCallbackData", "handleText", "handleCommandText", "handleCaptionPhoto", "handleCommandCaptionPhoto", "handleCaptionVideo", "handleCommandCaptionVideo", "handleCaptionAudio", "handleCommandCaptionAudio", "handleCaptionDocument", "handleCommandCaptionDocument", "handleCaptionAnimation", "handleCommandCaptionAnimation", "handleCaptionVoice", "handleCommandCaptionVoice"];
|
|
1114
1182
|
listRouteStaticIntent: readonly ["handleArgsCallbackData", "handleArgsText", "handleCommandArgsText", "handleCaptionArgsPhoto", "handleCommandCaptionArgsPhoto", "handleCaptionArgsVideo", "handleCommandCaptionArgsVideo", "handleCaptionArgsAudio", "handleCommandCaptionArgsAudio", "handleCaptionArgsDocument", "handleCommandCaptionArgsDocument", "handleCaptionArgsAnimation", "handleCommandCaptionArgsAnimation", "handleCaptionArgsVoice", "handleCommandCaptionArgsVoice"];
|
|
1115
1183
|
listRouteStaticSession: readonly [...("handleSessionCallbackData" | "handleSessionText" | "handleSessionCommandText" | "handleSessionCaptionPhoto" | "handleSessionCommandCaptionPhoto" | "handleSessionCaptionVideo" | "handleSessionCommandCaptionVideo" | "handleSessionCaptionAudio" | "handleSessionCommandCaptionAudio" | "handleSessionCaptionDocument" | "handleSessionCommandCaptionDocument" | "handleSessionCaptionAnimation" | "handleSessionCommandCaptionAnimation" | "handleSessionCaptionVoice" | "handleSessionCommandCaptionVoice" | "handleSessionArgsCallbackData" | "handleSessionArgsText" | "handleSessionCommandArgsText" | "handleSessionCaptionArgsPhoto" | "handleSessionCommandCaptionArgsPhoto" | "handleSessionCaptionArgsVideo" | "handleSessionCommandCaptionArgsVideo" | "handleSessionCaptionArgsAudio" | "handleSessionCommandCaptionArgsAudio" | "handleSessionCaptionArgsDocument" | "handleSessionCommandCaptionArgsDocument" | "handleSessionCaptionArgsAnimation" | "handleSessionCommandCaptionArgsAnimation" | "handleSessionCaptionArgsVoice" | "handleSessionCommandCaptionArgsVoice")[], "handleSessionFreeText", "handleSessionFreePhoto", "handleSessionFreeVideo", "handleSessionFreeAudio", "handleSessionFreeDocument", "handleSessionFreeAnimation", "handleSessionFreeVoice", "handleSessionFreeVideoNote", "handleSessionFreeSticker", "handleSessionFreeLocation", "handleSessionFreeContact"];
|
|
1184
|
+
listRouteDynamicSpesific: readonly ["handleFreeText", "handleFreePhoto", "handleFreeVideo", "handleFreeAudio", "handleFreeDocument", "handleFreeAnimation", "handleFreeVoice", "handleFreeVideoNote", "handleFreeSticker", "handleFreeLocation", "handleFreeContact"];
|
|
1116
1185
|
lenListRouteStatic: 15;
|
|
1117
1186
|
lenListRouteStaticIntent: 15;
|
|
1118
1187
|
lenListRouteStaticSession: number;
|
|
1188
|
+
lenListRouteDynamicSpesific: 11;
|
|
1119
1189
|
};
|
|
1120
|
-
_pageRoutes(ctx: ICtx, fromListener: `callbackdata` | keyof typeof Gramstax.prototype.pages.routeDynamicSpesific): Promise<
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
_onMessageLocation(ct: Context): Promise<void>;
|
|
1136
|
-
_onMessageContact(ct: Context): Promise<void>;
|
|
1137
|
-
_registerOnCallbackQueryData(): void;
|
|
1138
|
-
_registerOnMessageText(): void;
|
|
1139
|
-
_registerOnMessagePhoto(): void;
|
|
1140
|
-
_registerOnMessageVideo(): void;
|
|
1141
|
-
_registerOnMessageAudio(): void;
|
|
1142
|
-
_registerOnMessageDocument(): void;
|
|
1143
|
-
_registerOnMessageAnimation(): void;
|
|
1144
|
-
_registerOnMessageVoice(): void;
|
|
1145
|
-
_registerOnMessageVideoNote(): void;
|
|
1146
|
-
_registerOnMessageSticker(): void;
|
|
1147
|
-
_registerOnMessageLocation(): void;
|
|
1148
|
-
_registerOnMessageContact(): void;
|
|
1190
|
+
_pageRoutes(ctx: ICtx, fromListener: `callbackdata` | keyof typeof Gramstax.prototype.pages.routeDynamicSpesific): Promise<PageRouteResult>;
|
|
1191
|
+
_onHandle(ct: ITCt, listenerName: Parameters<Gramstax[`_pageRoutes`]>[1], shouldCheckNotFound?: boolean): Promise<void>;
|
|
1192
|
+
registerLowPlugin?(): Array<ITCtMiddleware<ITCt>>;
|
|
1193
|
+
registerLowOnCallbackData(): void;
|
|
1194
|
+
registerLowOnMessageText(): void;
|
|
1195
|
+
registerLowOnMessagePhoto(): void;
|
|
1196
|
+
registerLowOnMessageVideo(): void;
|
|
1197
|
+
registerLowOnMessageAudio(): void;
|
|
1198
|
+
registerLowOnMessageDocument(): void;
|
|
1199
|
+
registerLowOnMessageAnimation(): void;
|
|
1200
|
+
registerLowOnMessageVoice(): void;
|
|
1201
|
+
registerLowOnMessageVideoNote(): void;
|
|
1202
|
+
registerLowOnMessageSticker(): void;
|
|
1203
|
+
registerLowOnMessageLocation(): void;
|
|
1204
|
+
registerLowOnMessageContact(): void;
|
|
1149
1205
|
}
|
|
1150
1206
|
|
|
1151
1207
|
declare class LabelKeyboard {
|
|
@@ -1158,116 +1214,6 @@ declare class BlockKeyboard {
|
|
|
1158
1214
|
static _build(key: string, lang?: string, type?: string, reverse?: boolean): string;
|
|
1159
1215
|
}
|
|
1160
1216
|
|
|
1161
|
-
type ITMapRpc = Map<any, {
|
|
1162
|
-
reject: (error: any) => any;
|
|
1163
|
-
resolve: (result: any) => any;
|
|
1164
|
-
}>;
|
|
1165
|
-
declare class WorkerThreadRpc {
|
|
1166
|
-
send: (data: any) => any;
|
|
1167
|
-
register: Record<any, any>;
|
|
1168
|
-
map: ITMapRpc;
|
|
1169
|
-
constructor(send: (data: any) => any, register: Record<any, any>);
|
|
1170
|
-
make(data: any): Promise<void>;
|
|
1171
|
-
makeId(): number;
|
|
1172
|
-
makeRequest(method: string, params: any, _wait?: boolean, _others?: Record<string, any>): Promise<any>;
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
declare class WorkerThreadLaunch {
|
|
1176
|
-
path: string;
|
|
1177
|
-
argv: any[];
|
|
1178
|
-
register?: any | undefined;
|
|
1179
|
-
static isMainThread: boolean;
|
|
1180
|
-
private _readyResolve?;
|
|
1181
|
-
private _readyPromise;
|
|
1182
|
-
pid: number;
|
|
1183
|
-
thread: Worker;
|
|
1184
|
-
threadId: number;
|
|
1185
|
-
rpc: WorkerThreadRpc;
|
|
1186
|
-
constructor(path: string, argv: any[], register?: any | undefined);
|
|
1187
|
-
ready(): Promise<void>;
|
|
1188
|
-
readyResolve(): void;
|
|
1189
|
-
init(): void;
|
|
1190
|
-
handleOnMessage(data: any): Promise<void>;
|
|
1191
|
-
kill(): void;
|
|
1192
|
-
send(payload: any): void;
|
|
1193
|
-
request(method: string, params: any, _wait?: boolean, _others?: any): Promise<any>;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
declare class WorkerThreadGatewayServer {
|
|
1197
|
-
server: Server;
|
|
1198
|
-
rpc: Map<string, WorkerThreadRpc>;
|
|
1199
|
-
register: any;
|
|
1200
|
-
constructor();
|
|
1201
|
-
start(path: string, register?: any): Promise<unknown>;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
declare class WorkerThreadGatewayClient {
|
|
1205
|
-
client: Client;
|
|
1206
|
-
rpc: WorkerThreadRpc;
|
|
1207
|
-
constructor();
|
|
1208
|
-
connect(path: string): Promise<unknown>;
|
|
1209
|
-
request(method: string, params: any, _wait?: boolean, _others?: any): Promise<any>;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
declare class WorkerThreadInit {
|
|
1213
|
-
argv: string[];
|
|
1214
|
-
id: number;
|
|
1215
|
-
pid: number;
|
|
1216
|
-
rpc: WorkerThreadRpc;
|
|
1217
|
-
parentPort: node_worker_threads.MessagePort | null;
|
|
1218
|
-
gatewayServer?: WorkerThreadGatewayServer;
|
|
1219
|
-
gatewayClients: Map<string, WorkerThreadGatewayClient>;
|
|
1220
|
-
gatewayClientLatest?: WorkerThreadGatewayClient;
|
|
1221
|
-
static gatewayServerPath?: string;
|
|
1222
|
-
gatewayServerPath: any;
|
|
1223
|
-
get gatewayClient(): WorkerThreadGatewayClient | undefined;
|
|
1224
|
-
static isMainThread: boolean;
|
|
1225
|
-
constructor();
|
|
1226
|
-
init(): void;
|
|
1227
|
-
handleOnMessage(data: any): void;
|
|
1228
|
-
send(payload: any): void;
|
|
1229
|
-
request(method: string, params: any, _wait?: boolean, _others?: any): Promise<any>;
|
|
1230
|
-
createGatewayServer(register?: any, path?: string): Promise<boolean>;
|
|
1231
|
-
createGatewayClient(serverPath: string): Promise<WorkerThreadGatewayClient>;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
type WorkerThreadExportOpt<TWorker extends WorkerThreadInit, TMain extends WorkerThreadLaunch, TWrap> = {
|
|
1235
|
-
path: string;
|
|
1236
|
-
WTInit: new () => TWorker;
|
|
1237
|
-
WTLaunch?: new (path: string, argv?: any[]) => TMain;
|
|
1238
|
-
wrap?: (main: TMain) => TWrap;
|
|
1239
|
-
};
|
|
1240
|
-
type WorkerThreadGatewayProxy<T> = {
|
|
1241
|
-
[K in keyof T as K extends keyof WorkerThreadInit ? never : K extends string ? (T[K] extends (...args: any[]) => any ? K : never) : never]: T[K] extends (...args: infer A) => infer R ? (owner: WorkerThreadInit, ...args: A) => Promise<Awaited<R>> : never;
|
|
1242
|
-
};
|
|
1243
|
-
type WorkerThreadAsyncMethods<T> = {
|
|
1244
|
-
[K in keyof T as K extends keyof WorkerThreadInit ? never : K extends string ? (T[K] extends (...args: any[]) => any ? K : never) : never]: T[K] extends (...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> : never;
|
|
1245
|
-
};
|
|
1246
|
-
declare class WorkerThreadExport {
|
|
1247
|
-
static launchGatewayClient<TWorker extends WorkerThreadInit>(path: string): WorkerThreadGatewayProxy<TWorker> & {
|
|
1248
|
-
new (owner: WorkerThreadInit): WorkerThreadAsyncMethods<TWorker>;
|
|
1249
|
-
};
|
|
1250
|
-
static init<TWorker extends WorkerThreadInit, TMain extends WorkerThreadLaunch, TWrap = Record<any, any>>(options: WorkerThreadExportOpt<TWorker, TMain, TWrap>): TWrap & WorkerThreadAsyncMethods<TWorker> & {
|
|
1251
|
-
launchWorker: (argv?: any[]) => Promise<TMain>;
|
|
1252
|
-
launchGatewayClient: (serverPath?: string) => WorkerThreadGatewayProxy<TWorker> & {
|
|
1253
|
-
new (owner: WorkerThreadInit): WorkerThreadAsyncMethods<TWorker>;
|
|
1254
|
-
};
|
|
1255
|
-
};
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
declare class WorkerThreadPool {
|
|
1259
|
-
thread: Map<number, WorkerThreadLaunch>;
|
|
1260
|
-
threadCount: number;
|
|
1261
|
-
constructor(instance: WorkerThreadLaunch[]);
|
|
1262
|
-
add(instance: WorkerThreadLaunch): void;
|
|
1263
|
-
addMany(instance: WorkerThreadLaunch[]): void;
|
|
1264
|
-
getInstance(threadId: number): WorkerThreadLaunch | undefined;
|
|
1265
|
-
kill(threadId: number): number | undefined;
|
|
1266
|
-
killAll(): void;
|
|
1267
|
-
broadcastRequest(method: string, params: any): Promise<any[]>;
|
|
1268
|
-
request(threadId: number, method: string, params: any, _wait?: boolean, _others?: any): Promise<any>;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
1217
|
type ITMockTelegramJson = {
|
|
1272
1218
|
ok: boolean;
|
|
1273
1219
|
result: unknown;
|
|
@@ -1381,4 +1327,4 @@ declare class MockTelegramServer {
|
|
|
1381
1327
|
sendCallbackQuery(data: string, options?: ITMockTelegramCallbackQueryOptions): Promise<ITMockTelegramRequestRecord[]>;
|
|
1382
1328
|
}
|
|
1383
1329
|
|
|
1384
|
-
export { BlockKeyboard, CacheExternal, Ctx, Gramstax, type ITBottomKb, type ITBottomKbParams, type ITBuildDataOptions, type ITCacheRpc, type ITCompiledTemplate, type ITCt, type ITCtxParams, type ITData, type ITGramstaxParams, type ITInBoKb, type ITInlineKb, type ITInlineKbParams, type ITKbCols, type ITKbDest, type
|
|
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 };
|