gramstax 0.8.23 → 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 +209 -247
- package/dist/src/index.d.ts +209 -247
- 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;
|
|
@@ -27,7 +24,7 @@ type ITMore = Omit<Required<ConstructorParameters<typeof Keyv>>[0], `store` | `n
|
|
|
27
24
|
forceStore?: any;
|
|
28
25
|
};
|
|
29
26
|
type ITCacheRpc = {
|
|
30
|
-
method: string;
|
|
27
|
+
method: string | string[];
|
|
31
28
|
params: any;
|
|
32
29
|
[moreRoot: string]: any;
|
|
33
30
|
};
|
|
@@ -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): {
|
|
175
200
|
valid: boolean;
|
|
176
201
|
errors: Array<{
|
|
177
202
|
line: number;
|
|
178
203
|
message: string;
|
|
179
204
|
}>;
|
|
180
205
|
};
|
|
181
|
-
static
|
|
206
|
+
static _validatePageTagAttributes(template: string): Array<{
|
|
207
|
+
line: number;
|
|
208
|
+
message: string;
|
|
209
|
+
}>;
|
|
210
|
+
static validatePageAttributesBlock(template: string): {
|
|
182
211
|
valid: boolean;
|
|
183
212
|
errors: Array<{
|
|
184
213
|
line: number;
|
|
185
214
|
message: string;
|
|
186
215
|
}>;
|
|
187
216
|
};
|
|
188
|
-
static
|
|
217
|
+
static _validatePageTagAttributeValues(template: string): Array<{
|
|
218
|
+
line: number;
|
|
219
|
+
message: string;
|
|
220
|
+
}>;
|
|
221
|
+
static validatePageAttributeValuesBlock(template: string): {
|
|
189
222
|
valid: boolean;
|
|
190
223
|
errors: Array<{
|
|
191
224
|
line: number;
|
|
192
225
|
message: string;
|
|
193
226
|
}>;
|
|
194
227
|
};
|
|
195
|
-
static
|
|
228
|
+
static validateBlockGBaseAttributes(template: string): {
|
|
196
229
|
valid: boolean;
|
|
197
230
|
errors: Array<{
|
|
198
231
|
line: number;
|
|
199
232
|
message: string;
|
|
200
233
|
}>;
|
|
201
234
|
};
|
|
202
|
-
static
|
|
235
|
+
static validateBlockGMessageAttributes(template: string): {
|
|
236
|
+
valid: boolean;
|
|
237
|
+
errors: Array<{
|
|
238
|
+
line: number;
|
|
239
|
+
message: string;
|
|
240
|
+
}>;
|
|
241
|
+
};
|
|
242
|
+
static validateBlockGKeyboardAttributes(template: string): {
|
|
243
|
+
valid: boolean;
|
|
244
|
+
errors: Array<{
|
|
245
|
+
line: number;
|
|
246
|
+
message: string;
|
|
247
|
+
}>;
|
|
248
|
+
};
|
|
249
|
+
static validateBlockGMediaAttributes(template: string): {
|
|
250
|
+
valid: boolean;
|
|
251
|
+
errors: Array<{
|
|
252
|
+
line: number;
|
|
253
|
+
message: string;
|
|
254
|
+
}>;
|
|
255
|
+
};
|
|
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
|
};
|
|
@@ -436,57 +492,63 @@ declare class Ctx {
|
|
|
436
492
|
templateManager: TemplateManager;
|
|
437
493
|
temp: ITTemp;
|
|
438
494
|
constructor(params: ITCtxParams);
|
|
439
|
-
|
|
495
|
+
hookBeforeRoute?(): Promise<boolean>;
|
|
496
|
+
hookAfterRoute?(): Promise<void>;
|
|
497
|
+
broadcast(ids: number[], languageCode: string[], keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReply, throwError?: boolean): Promise<{
|
|
440
498
|
successCount: number;
|
|
441
499
|
failedCount: number;
|
|
442
500
|
totalCount: number;
|
|
443
501
|
}>;
|
|
444
|
-
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<{
|
|
445
503
|
successCount: number;
|
|
446
504
|
failedCount: number;
|
|
447
505
|
totalCount: number;
|
|
448
506
|
}>;
|
|
449
|
-
reply(keyboard?: ITInBoKb, data?: ITData,
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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>;
|
|
466
525
|
replyAction(type: ITReplyAction): Promise<true>;
|
|
467
|
-
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 & {
|
|
468
527
|
text: string;
|
|
469
528
|
} & Partial<{
|
|
470
529
|
entities: grammy_types.MessageEntity[];
|
|
471
|
-
}>) |
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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>;
|
|
487
549
|
delete(): Promise<true>;
|
|
488
550
|
callbackQueryAnswer(options?: Parameters<typeof Ctx.prototype.ct.answerCallbackQuery>[0]): Promise<true | null>;
|
|
489
|
-
setSession(method: string, params: any, moreRoot?: Record<any, any>): Promise<boolean | null>;
|
|
551
|
+
setSession(method: string | string[], params: any, moreRoot?: Record<any, any>): Promise<boolean | null>;
|
|
490
552
|
getSession(): Promise<ITCacheRpc | null>;
|
|
491
553
|
clearSession(): Promise<boolean | null>;
|
|
492
554
|
static buildData<C extends (...args: any[]) => any>(callbackData: C): ITPageData<Parameters<C>>;
|
|
@@ -494,8 +556,8 @@ declare class Ctx {
|
|
|
494
556
|
static buildData(options: ITBuildDataOptions): ITPageData<[]>;
|
|
495
557
|
static buildData(): ITPageData<[]>;
|
|
496
558
|
keyboardCols<T = any>(k: T, l: string[], layout: ITKbCols, cb: (e: string, i: number) => any): T;
|
|
497
|
-
bottomKeyboardT(layout?: ITKbCols,
|
|
498
|
-
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;
|
|
499
561
|
inlineKeyboard(callback: (k: ITInlineKb, l: string[]) => ITInlineKb, params?: ITInlineKbParams): ITInlineKb;
|
|
500
562
|
bottomKeyboard(callback: (k: ITBottomKb, l: string[]) => ITBottomKb, params?: ITBottomKbParams): ITBottomKb;
|
|
501
563
|
getSeperatorTag(mtd?: `space` | `colon`): " " | ":";
|
|
@@ -710,6 +772,10 @@ declare class WebhookQueue<T = unknown> {
|
|
|
710
772
|
dequeue(): Promise<T>;
|
|
711
773
|
}
|
|
712
774
|
|
|
775
|
+
type PageRouteResult = {
|
|
776
|
+
state: `matched` | `no-match` | `no-handler` | `blocked`;
|
|
777
|
+
result: any[];
|
|
778
|
+
};
|
|
713
779
|
declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
714
780
|
templateManager: TemplateManager;
|
|
715
781
|
cacheKeyboard: Map<any, any>;
|
|
@@ -720,7 +786,7 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
720
786
|
};
|
|
721
787
|
log: LoggingHelper | undefined;
|
|
722
788
|
bot: Bot;
|
|
723
|
-
botConfig?: BotConfig<
|
|
789
|
+
botConfig?: BotConfig<ITCt>;
|
|
724
790
|
webhookQueue?: ITWebhookQueueConfig;
|
|
725
791
|
protected webhookQueueInstance?: WebhookQueue<any>;
|
|
726
792
|
protected webhookServer?: {
|
|
@@ -730,12 +796,30 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
730
796
|
deployType: `polling` | `webhook` | `serverless` | `test`;
|
|
731
797
|
constructor(params: ITGramstaxParams);
|
|
732
798
|
stop(): Promise<void>;
|
|
733
|
-
_onCatch(error: BotError<
|
|
734
|
-
hookBeforeStart(): void;
|
|
735
|
-
hookAfterStart(): void;
|
|
799
|
+
_onCatch(error: BotError<ITCt>): void;
|
|
736
800
|
_onStart(botInfo: UserFromGetMe, method: `polling` | `webhook` | `serverless`, data: string | null): Promise<void>;
|
|
737
|
-
|
|
738
|
-
|
|
801
|
+
hookBeforeStart?(): Promise<any>;
|
|
802
|
+
hookAfterStart?(): Promise<any>;
|
|
803
|
+
hookBeforeRoute?(ctx: ICtx, data?: {
|
|
804
|
+
listenerName: string;
|
|
805
|
+
isEdit: boolean;
|
|
806
|
+
}): Promise<boolean>;
|
|
807
|
+
hookAfterRoute?(ctx: ICtx, data?: {
|
|
808
|
+
listenerName: string;
|
|
809
|
+
state: `matched` | `no-match` | `no-handler` | `blocked` | `error` | `notfound`;
|
|
810
|
+
isEdit: boolean;
|
|
811
|
+
}): Promise<void>;
|
|
812
|
+
hookErrorPage?(ctx: ICtx, data?: {
|
|
813
|
+
listenerName: string;
|
|
814
|
+
error: any;
|
|
815
|
+
isEdit: boolean;
|
|
816
|
+
}): Promise<void>;
|
|
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;
|
|
739
823
|
_runPolling(): void;
|
|
740
824
|
_runWebhook(fullUrl: string): Promise<void>;
|
|
741
825
|
_startWebhookWorker(queue: WebhookQueue<any>, acquireChat: (chatId: any) => Promise<() => void>, getChatId: (update: any) => any): void;
|
|
@@ -1097,39 +1181,27 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
1097
1181
|
listRouteStatic: readonly ["handleCallbackData", "handleText", "handleCommandText", "handleCaptionPhoto", "handleCommandCaptionPhoto", "handleCaptionVideo", "handleCommandCaptionVideo", "handleCaptionAudio", "handleCommandCaptionAudio", "handleCaptionDocument", "handleCommandCaptionDocument", "handleCaptionAnimation", "handleCommandCaptionAnimation", "handleCaptionVoice", "handleCommandCaptionVoice"];
|
|
1098
1182
|
listRouteStaticIntent: readonly ["handleArgsCallbackData", "handleArgsText", "handleCommandArgsText", "handleCaptionArgsPhoto", "handleCommandCaptionArgsPhoto", "handleCaptionArgsVideo", "handleCommandCaptionArgsVideo", "handleCaptionArgsAudio", "handleCommandCaptionArgsAudio", "handleCaptionArgsDocument", "handleCommandCaptionArgsDocument", "handleCaptionArgsAnimation", "handleCommandCaptionArgsAnimation", "handleCaptionArgsVoice", "handleCommandCaptionArgsVoice"];
|
|
1099
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"];
|
|
1100
1185
|
lenListRouteStatic: 15;
|
|
1101
1186
|
lenListRouteStaticIntent: 15;
|
|
1102
1187
|
lenListRouteStaticSession: number;
|
|
1188
|
+
lenListRouteDynamicSpesific: 11;
|
|
1103
1189
|
};
|
|
1104
|
-
_pageRoutes(ctx: ICtx, fromListener: `callbackdata` | keyof typeof Gramstax.prototype.pages.routeDynamicSpesific): Promise<
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
_onMessageLocation(ct: Context): Promise<void>;
|
|
1120
|
-
_onMessageContact(ct: Context): Promise<void>;
|
|
1121
|
-
_registerOnCallbackQueryData(): void;
|
|
1122
|
-
_registerOnMessageText(): void;
|
|
1123
|
-
_registerOnMessagePhoto(): void;
|
|
1124
|
-
_registerOnMessageVideo(): void;
|
|
1125
|
-
_registerOnMessageAudio(): void;
|
|
1126
|
-
_registerOnMessageDocument(): void;
|
|
1127
|
-
_registerOnMessageAnimation(): void;
|
|
1128
|
-
_registerOnMessageVoice(): void;
|
|
1129
|
-
_registerOnMessageVideoNote(): void;
|
|
1130
|
-
_registerOnMessageSticker(): void;
|
|
1131
|
-
_registerOnMessageLocation(): void;
|
|
1132
|
-
_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;
|
|
1133
1205
|
}
|
|
1134
1206
|
|
|
1135
1207
|
declare class LabelKeyboard {
|
|
@@ -1142,116 +1214,6 @@ declare class BlockKeyboard {
|
|
|
1142
1214
|
static _build(key: string, lang?: string, type?: string, reverse?: boolean): string;
|
|
1143
1215
|
}
|
|
1144
1216
|
|
|
1145
|
-
type ITMapRpc = Map<any, {
|
|
1146
|
-
reject: (error: any) => any;
|
|
1147
|
-
resolve: (result: any) => any;
|
|
1148
|
-
}>;
|
|
1149
|
-
declare class WorkerThreadRpc {
|
|
1150
|
-
send: (data: any) => any;
|
|
1151
|
-
register: Record<any, any>;
|
|
1152
|
-
map: ITMapRpc;
|
|
1153
|
-
constructor(send: (data: any) => any, register: Record<any, any>);
|
|
1154
|
-
make(data: any): Promise<void>;
|
|
1155
|
-
makeId(): number;
|
|
1156
|
-
makeRequest(method: string, params: any, _wait?: boolean, _others?: Record<string, any>): Promise<any>;
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
declare class WorkerThreadLaunch {
|
|
1160
|
-
path: string;
|
|
1161
|
-
argv: any[];
|
|
1162
|
-
register?: any | undefined;
|
|
1163
|
-
static isMainThread: boolean;
|
|
1164
|
-
private _readyResolve?;
|
|
1165
|
-
private _readyPromise;
|
|
1166
|
-
pid: number;
|
|
1167
|
-
thread: Worker;
|
|
1168
|
-
threadId: number;
|
|
1169
|
-
rpc: WorkerThreadRpc;
|
|
1170
|
-
constructor(path: string, argv: any[], register?: any | undefined);
|
|
1171
|
-
ready(): Promise<void>;
|
|
1172
|
-
readyResolve(): void;
|
|
1173
|
-
init(): void;
|
|
1174
|
-
handleOnMessage(data: any): Promise<void>;
|
|
1175
|
-
kill(): void;
|
|
1176
|
-
send(payload: any): void;
|
|
1177
|
-
request(method: string, params: any, _wait?: boolean, _others?: any): Promise<any>;
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
declare class WorkerThreadGatewayServer {
|
|
1181
|
-
server: Server;
|
|
1182
|
-
rpc: Map<string, WorkerThreadRpc>;
|
|
1183
|
-
register: any;
|
|
1184
|
-
constructor();
|
|
1185
|
-
start(path: string, register?: any): Promise<unknown>;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
declare class WorkerThreadGatewayClient {
|
|
1189
|
-
client: Client;
|
|
1190
|
-
rpc: WorkerThreadRpc;
|
|
1191
|
-
constructor();
|
|
1192
|
-
connect(path: string): Promise<unknown>;
|
|
1193
|
-
request(method: string, params: any, _wait?: boolean, _others?: any): Promise<any>;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
declare class WorkerThreadInit {
|
|
1197
|
-
argv: string[];
|
|
1198
|
-
id: number;
|
|
1199
|
-
pid: number;
|
|
1200
|
-
rpc: WorkerThreadRpc;
|
|
1201
|
-
parentPort: node_worker_threads.MessagePort | null;
|
|
1202
|
-
gatewayServer?: WorkerThreadGatewayServer;
|
|
1203
|
-
gatewayClients: Map<string, WorkerThreadGatewayClient>;
|
|
1204
|
-
gatewayClientLatest?: WorkerThreadGatewayClient;
|
|
1205
|
-
static gatewayServerPath?: string;
|
|
1206
|
-
gatewayServerPath: any;
|
|
1207
|
-
get gatewayClient(): WorkerThreadGatewayClient | undefined;
|
|
1208
|
-
static isMainThread: boolean;
|
|
1209
|
-
constructor();
|
|
1210
|
-
init(): void;
|
|
1211
|
-
handleOnMessage(data: any): void;
|
|
1212
|
-
send(payload: any): void;
|
|
1213
|
-
request(method: string, params: any, _wait?: boolean, _others?: any): Promise<any>;
|
|
1214
|
-
createGatewayServer(register?: any, path?: string): Promise<boolean>;
|
|
1215
|
-
createGatewayClient(serverPath: string): Promise<WorkerThreadGatewayClient>;
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
type WorkerThreadExportOpt<TWorker extends WorkerThreadInit, TMain extends WorkerThreadLaunch, TWrap> = {
|
|
1219
|
-
path: string;
|
|
1220
|
-
WTInit: new () => TWorker;
|
|
1221
|
-
WTLaunch?: new (path: string, argv?: any[]) => TMain;
|
|
1222
|
-
wrap?: (main: TMain) => TWrap;
|
|
1223
|
-
};
|
|
1224
|
-
type WorkerThreadGatewayProxy<T> = {
|
|
1225
|
-
[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;
|
|
1226
|
-
};
|
|
1227
|
-
type WorkerThreadAsyncMethods<T> = {
|
|
1228
|
-
[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;
|
|
1229
|
-
};
|
|
1230
|
-
declare class WorkerThreadExport {
|
|
1231
|
-
static launchGatewayClient<TWorker extends WorkerThreadInit>(path: string): WorkerThreadGatewayProxy<TWorker> & {
|
|
1232
|
-
new (owner: WorkerThreadInit): WorkerThreadAsyncMethods<TWorker>;
|
|
1233
|
-
};
|
|
1234
|
-
static init<TWorker extends WorkerThreadInit, TMain extends WorkerThreadLaunch, TWrap = Record<any, any>>(options: WorkerThreadExportOpt<TWorker, TMain, TWrap>): TWrap & WorkerThreadAsyncMethods<TWorker> & {
|
|
1235
|
-
launchWorker: (argv?: any[]) => Promise<TMain>;
|
|
1236
|
-
launchGatewayClient: (serverPath?: string) => WorkerThreadGatewayProxy<TWorker> & {
|
|
1237
|
-
new (owner: WorkerThreadInit): WorkerThreadAsyncMethods<TWorker>;
|
|
1238
|
-
};
|
|
1239
|
-
};
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
declare class WorkerThreadPool {
|
|
1243
|
-
thread: Map<number, WorkerThreadLaunch>;
|
|
1244
|
-
threadCount: number;
|
|
1245
|
-
constructor(instance: WorkerThreadLaunch[]);
|
|
1246
|
-
add(instance: WorkerThreadLaunch): void;
|
|
1247
|
-
addMany(instance: WorkerThreadLaunch[]): void;
|
|
1248
|
-
getInstance(threadId: number): WorkerThreadLaunch | undefined;
|
|
1249
|
-
kill(threadId: number): number | undefined;
|
|
1250
|
-
killAll(): void;
|
|
1251
|
-
broadcastRequest(method: string, params: any): Promise<any[]>;
|
|
1252
|
-
request(threadId: number, method: string, params: any, _wait?: boolean, _others?: any): Promise<any>;
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
1217
|
type ITMockTelegramJson = {
|
|
1256
1218
|
ok: boolean;
|
|
1257
1219
|
result: unknown;
|
|
@@ -1365,4 +1327,4 @@ declare class MockTelegramServer {
|
|
|
1365
1327
|
sendCallbackQuery(data: string, options?: ITMockTelegramCallbackQueryOptions): Promise<ITMockTelegramRequestRecord[]>;
|
|
1366
1328
|
}
|
|
1367
1329
|
|
|
1368
|
-
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 };
|