gramstax 0.8.24 → 0.10.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 +306 -249
- package/dist/src/index.d.ts +306 -249
- package/dist/src/index.js +7 -7
- package/package.json +5 -5
package/dist/src/index.d.cts
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,83 @@ type ITMediaBlock = {
|
|
|
68
65
|
};
|
|
69
66
|
declare class TemplateEngine {
|
|
70
67
|
static MAX_MEDIA_GROUP_ITEMS: number;
|
|
68
|
+
static BOT_API_VERSION: string;
|
|
69
|
+
static ALLOWED_BLOCKS_TELEGRAM_LEGACY: string[];
|
|
70
|
+
static ALLOWED_BLOCKS_TELEGRAM_RICH: string[];
|
|
71
|
+
static ALLOWED_BLOCKS_TELEGRAM: string[];
|
|
72
|
+
static ALLOWED_BLOCKS_PAGE: string[];
|
|
71
73
|
static ALLOWED_BLOCKS: string[];
|
|
74
|
+
static _extractBlockNames(blocks: string[]): Set<string>;
|
|
75
|
+
static _TELEGRAM_REQUIRED_ATTRS: Record<string, string[] | {
|
|
76
|
+
oneOf: string[][];
|
|
77
|
+
}>;
|
|
78
|
+
static _TELEGRAM_ATTR_VALUE_VALIDATORS: Record<string, Record<string, (value: string) => string | null>>;
|
|
79
|
+
static _PAGE_REQUIRED_ATTRS: Record<string, string[] | {
|
|
80
|
+
oneOf: string[][];
|
|
81
|
+
}>;
|
|
82
|
+
static _PAGE_ATTR_VALUE_VALIDATORS: Record<string, Record<string, (value: string) => string | null>>;
|
|
72
83
|
static ALLOWED_SCOPE: string[];
|
|
73
84
|
static _escape(str: string): string;
|
|
74
85
|
static _processScopeVariables(template: string): string;
|
|
75
86
|
static _processScopeExec(template: string): string;
|
|
76
|
-
static
|
|
77
|
-
[
|
|
87
|
+
static _processGBaseBlocks(template: string): {
|
|
88
|
+
[AGBaseId: string]: string;
|
|
78
89
|
};
|
|
79
|
-
static
|
|
80
|
-
static
|
|
81
|
-
static
|
|
82
|
-
static
|
|
83
|
-
static
|
|
84
|
-
static
|
|
90
|
+
static _processGScriptBlocks(template: string): string;
|
|
91
|
+
static _processGSpaceBlocks(template: string): string;
|
|
92
|
+
static _processGDivBlocks(template: string): string;
|
|
93
|
+
static _processGSwitchBlocks(template: string): string;
|
|
94
|
+
static _processGMapBlocks(template: string): string;
|
|
95
|
+
static _processGMediaBlocks(template: string): {
|
|
85
96
|
[lang: string]: ITMediaBlock;
|
|
86
97
|
};
|
|
87
98
|
static _splitMediaSrcList(src: string): string[];
|
|
88
|
-
static
|
|
99
|
+
static _processGMediaGroupBlocks(template: string): {
|
|
89
100
|
[lang: string]: ITMediaBlock;
|
|
90
101
|
};
|
|
91
102
|
private static _processMediaGroupItems;
|
|
92
|
-
static
|
|
103
|
+
static _processGMessageBlocks(template: string): {
|
|
93
104
|
[lang: string]: string;
|
|
94
105
|
};
|
|
95
|
-
static
|
|
106
|
+
static _processGDescriptionBlocks(template: string): {
|
|
96
107
|
[lang: string]: {
|
|
97
108
|
[scope: string]: string;
|
|
98
109
|
};
|
|
99
110
|
};
|
|
100
|
-
static
|
|
111
|
+
static _processGKeyboardBlocks(template: string): {
|
|
101
112
|
[lang: string]: {
|
|
102
113
|
inline?: string;
|
|
103
114
|
bottom?: string;
|
|
104
115
|
};
|
|
105
116
|
};
|
|
106
117
|
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
|
-
[
|
|
118
|
+
static compileBlockGMedia(template: string, baseBlocks?: ReturnType<typeof TemplateEngine._processGBaseBlocks>): {
|
|
119
|
+
[AGBaseId: string]: {
|
|
120
|
+
[ALang: string]: (data?: Record<string, any>) => ITMediaBlock;
|
|
110
121
|
};
|
|
111
122
|
};
|
|
112
|
-
static
|
|
113
|
-
[
|
|
114
|
-
[
|
|
123
|
+
static compileBlockGMessage(template: string, baseBlocks?: ReturnType<typeof TemplateEngine._processGBaseBlocks>): {
|
|
124
|
+
[AGBaseId: string]: {
|
|
125
|
+
[ALang: string]: (data?: Record<string, any>) => string;
|
|
115
126
|
};
|
|
116
127
|
};
|
|
117
|
-
static
|
|
118
|
-
[
|
|
119
|
-
[
|
|
120
|
-
[
|
|
128
|
+
static compileBlockGDescription(template: string, gBaseBlocks?: ReturnType<typeof TemplateEngine._processGBaseBlocks>): {
|
|
129
|
+
[AGBaseId: string]: {
|
|
130
|
+
[AScope: string]: {
|
|
131
|
+
[ALang: string]: (data?: Record<string, any>) => string;
|
|
121
132
|
};
|
|
122
133
|
};
|
|
123
134
|
};
|
|
124
|
-
static
|
|
125
|
-
[
|
|
126
|
-
[
|
|
135
|
+
static compileBlockGKeyboards(template: string, gBaseBlocks?: ReturnType<typeof TemplateEngine._processGBaseBlocks>): {
|
|
136
|
+
[AGBaseId: string]: {
|
|
137
|
+
[ALang: string]: {
|
|
127
138
|
inline?: (data?: Record<string, any>) => string[];
|
|
128
139
|
bottom?: (data?: Record<string, any>) => string[];
|
|
129
140
|
};
|
|
130
141
|
};
|
|
131
142
|
};
|
|
132
|
-
static _extractBlock(content: string, blocks?: string | string[],
|
|
133
|
-
static
|
|
143
|
+
static _extractBlock(content: string, blocks?: string | string[], AGBaseId?: string, section?: `all` | `value`, lang?: string): string;
|
|
144
|
+
static _processGImportBlocks(template: string): {
|
|
134
145
|
processed: string;
|
|
135
146
|
imports: {
|
|
136
147
|
src: string;
|
|
@@ -141,7 +152,7 @@ declare class TemplateEngine {
|
|
|
141
152
|
indent: string;
|
|
142
153
|
}[];
|
|
143
154
|
};
|
|
144
|
-
static
|
|
155
|
+
static processGImportBlocks(template: string, resolver: (src: string) => string | null, depth?: number, importCache?: Map<string, string>): string;
|
|
145
156
|
static validateNamesBlock(template: string): {
|
|
146
157
|
valid: boolean;
|
|
147
158
|
errors: Array<{
|
|
@@ -171,35 +182,79 @@ declare class TemplateEngine {
|
|
|
171
182
|
}>;
|
|
172
183
|
};
|
|
173
184
|
private static _validateBlockAttributes;
|
|
174
|
-
static
|
|
185
|
+
static _validateTelegramTagAttributes(template: string): Array<{
|
|
186
|
+
line: number;
|
|
187
|
+
message: string;
|
|
188
|
+
}>;
|
|
189
|
+
static validateTelegramAttributesBlock(template: string): {
|
|
190
|
+
valid: boolean;
|
|
191
|
+
errors: Array<{
|
|
192
|
+
line: number;
|
|
193
|
+
message: string;
|
|
194
|
+
}>;
|
|
195
|
+
};
|
|
196
|
+
static _validateTelegramTagAttributeValues(template: string): Array<{
|
|
197
|
+
line: number;
|
|
198
|
+
message: string;
|
|
199
|
+
}>;
|
|
200
|
+
static validateTelegramAttributeValuesBlock(template: string): {
|
|
201
|
+
valid: boolean;
|
|
202
|
+
errors: Array<{
|
|
203
|
+
line: number;
|
|
204
|
+
message: string;
|
|
205
|
+
}>;
|
|
206
|
+
};
|
|
207
|
+
static _validatePageTagAttributes(template: string): Array<{
|
|
208
|
+
line: number;
|
|
209
|
+
message: string;
|
|
210
|
+
}>;
|
|
211
|
+
static validatePageAttributesBlock(template: string): {
|
|
212
|
+
valid: boolean;
|
|
213
|
+
errors: Array<{
|
|
214
|
+
line: number;
|
|
215
|
+
message: string;
|
|
216
|
+
}>;
|
|
217
|
+
};
|
|
218
|
+
static _validatePageTagAttributeValues(template: string): Array<{
|
|
219
|
+
line: number;
|
|
220
|
+
message: string;
|
|
221
|
+
}>;
|
|
222
|
+
static validatePageAttributeValuesBlock(template: string): {
|
|
223
|
+
valid: boolean;
|
|
224
|
+
errors: Array<{
|
|
225
|
+
line: number;
|
|
226
|
+
message: string;
|
|
227
|
+
}>;
|
|
228
|
+
};
|
|
229
|
+
static validateBlockGBaseAttributes(template: string): {
|
|
175
230
|
valid: boolean;
|
|
176
231
|
errors: Array<{
|
|
177
232
|
line: number;
|
|
178
233
|
message: string;
|
|
179
234
|
}>;
|
|
180
235
|
};
|
|
181
|
-
static
|
|
236
|
+
static validateBlockGMessageAttributes(template: string): {
|
|
182
237
|
valid: boolean;
|
|
183
238
|
errors: Array<{
|
|
184
239
|
line: number;
|
|
185
240
|
message: string;
|
|
186
241
|
}>;
|
|
187
242
|
};
|
|
188
|
-
static
|
|
243
|
+
static validateBlockGKeyboardAttributes(template: string): {
|
|
189
244
|
valid: boolean;
|
|
190
245
|
errors: Array<{
|
|
191
246
|
line: number;
|
|
192
247
|
message: string;
|
|
193
248
|
}>;
|
|
194
249
|
};
|
|
195
|
-
static
|
|
250
|
+
static validateBlockGMediaAttributes(template: string): {
|
|
196
251
|
valid: boolean;
|
|
197
252
|
errors: Array<{
|
|
198
253
|
line: number;
|
|
199
254
|
message: string;
|
|
200
255
|
}>;
|
|
201
256
|
};
|
|
202
|
-
static
|
|
257
|
+
static validateBlockGMediaGroupAttributes(template: string): {
|
|
203
258
|
valid: boolean;
|
|
204
259
|
errors: Array<{
|
|
205
260
|
line: number;
|
|
@@ -207,63 +262,77 @@ declare class TemplateEngine {
|
|
|
207
262
|
}>;
|
|
208
263
|
};
|
|
209
264
|
private static _validateMediaGroupItems;
|
|
210
|
-
static
|
|
265
|
+
static validateBlockGDescriptionAttributes(template: string): {
|
|
266
|
+
valid: boolean;
|
|
267
|
+
errors: Array<{
|
|
268
|
+
line: number;
|
|
269
|
+
message: string;
|
|
270
|
+
}>;
|
|
271
|
+
};
|
|
272
|
+
static validateBlockGScriptAttributes(template: string): {
|
|
211
273
|
valid: boolean;
|
|
212
274
|
errors: Array<{
|
|
213
275
|
line: number;
|
|
214
276
|
message: string;
|
|
215
277
|
}>;
|
|
216
278
|
};
|
|
217
|
-
static
|
|
279
|
+
static validateBlockGSwitchAttributes(template: string): {
|
|
218
280
|
valid: boolean;
|
|
219
281
|
errors: Array<{
|
|
220
282
|
line: number;
|
|
221
283
|
message: string;
|
|
222
284
|
}>;
|
|
223
285
|
};
|
|
224
|
-
static
|
|
286
|
+
static validateBlockGCaseAttributes(template: string): {
|
|
225
287
|
valid: boolean;
|
|
226
288
|
errors: Array<{
|
|
227
289
|
line: number;
|
|
228
290
|
message: string;
|
|
229
291
|
}>;
|
|
230
292
|
};
|
|
231
|
-
static
|
|
293
|
+
static validateBlockGDefaultAttributes(template: string): {
|
|
232
294
|
valid: boolean;
|
|
233
295
|
errors: Array<{
|
|
234
296
|
line: number;
|
|
235
297
|
message: string;
|
|
236
298
|
}>;
|
|
237
299
|
};
|
|
238
|
-
static
|
|
300
|
+
static validateBlockGMapAttributes(template: string): {
|
|
239
301
|
valid: boolean;
|
|
240
302
|
errors: Array<{
|
|
241
303
|
line: number;
|
|
242
304
|
message: string;
|
|
243
305
|
}>;
|
|
244
306
|
};
|
|
245
|
-
static
|
|
307
|
+
static validateBlockGDivAttributes(template: string): {
|
|
246
308
|
valid: boolean;
|
|
247
309
|
errors: Array<{
|
|
248
310
|
line: number;
|
|
249
311
|
message: string;
|
|
250
312
|
}>;
|
|
251
313
|
};
|
|
252
|
-
static
|
|
314
|
+
static validateBlockGImportAttributes(template: string): {
|
|
253
315
|
valid: boolean;
|
|
254
316
|
errors: Array<{
|
|
255
317
|
line: number;
|
|
256
318
|
message: string;
|
|
257
319
|
}>;
|
|
258
320
|
};
|
|
259
|
-
static
|
|
321
|
+
static validateBlockGSpaceAttributes(template: string): {
|
|
260
322
|
valid: boolean;
|
|
261
323
|
errors: Array<{
|
|
262
324
|
line: number;
|
|
263
325
|
message: string;
|
|
264
326
|
}>;
|
|
265
327
|
};
|
|
266
|
-
static
|
|
328
|
+
static validateBlockGMessageRich(html: string): {
|
|
329
|
+
valid: boolean;
|
|
330
|
+
errors: Array<{
|
|
331
|
+
line: number;
|
|
332
|
+
message: string;
|
|
333
|
+
}>;
|
|
334
|
+
};
|
|
335
|
+
static _validateBlockGMessageRichInTemplate(template: string): {
|
|
267
336
|
valid: boolean;
|
|
268
337
|
errors: Array<{
|
|
269
338
|
line: number;
|
|
@@ -280,10 +349,10 @@ declare class TemplateEngine {
|
|
|
280
349
|
}
|
|
281
350
|
|
|
282
351
|
type ITCompiledTemplate = {
|
|
283
|
-
media: ReturnType<typeof TemplateEngine.
|
|
284
|
-
message: ReturnType<typeof TemplateEngine.
|
|
285
|
-
keyboard: ReturnType<typeof TemplateEngine.
|
|
286
|
-
description: ReturnType<typeof TemplateEngine.
|
|
352
|
+
media: ReturnType<typeof TemplateEngine.compileBlockGMedia>;
|
|
353
|
+
message: ReturnType<typeof TemplateEngine.compileBlockGMessage>;
|
|
354
|
+
keyboard: ReturnType<typeof TemplateEngine.compileBlockGKeyboards>;
|
|
355
|
+
description: ReturnType<typeof TemplateEngine.compileBlockGDescription>;
|
|
287
356
|
};
|
|
288
357
|
type ITTemplateOptions = {
|
|
289
358
|
path: string[];
|
|
@@ -311,21 +380,21 @@ declare class TemplateManager {
|
|
|
311
380
|
_getExtension(filename: string): string;
|
|
312
381
|
_readTemplateFile(filename: string): string | null;
|
|
313
382
|
_isValidFile(filename: string): boolean;
|
|
314
|
-
|
|
315
|
-
|
|
383
|
+
_getGBaseAtLine(template: string, line: number): {
|
|
384
|
+
AGBaseId: string | null;
|
|
316
385
|
hasId: boolean;
|
|
317
386
|
} | null;
|
|
318
|
-
_validateTemplate(
|
|
387
|
+
_validateTemplate(AGBaseId: string, template: string, filename?: string): void;
|
|
319
388
|
_getKey(filename: string): string;
|
|
320
389
|
_compile(key: string, template: string, keepIfExist?: Partial<{
|
|
321
390
|
[K in keyof ITCompiledTemplate]: boolean;
|
|
322
391
|
}>, importCache?: Map<string, string>, rawCache?: Map<string, string>, filename?: string): void;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
392
|
+
getGMedia(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): ReturnType<ITCompiledTemplate[`media`][`default`][`default`]>;
|
|
393
|
+
getGMessage(key: string, AGBaseId?: string, ALang?: string, data?: Record<string, any>): string;
|
|
394
|
+
getGDescription(key: string, AGBaseId?: string, ALang?: string, AScope?: string, data?: Record<string, any>): string;
|
|
395
|
+
getAGDescriptionLang(key: string, AGBaseId?: string, AScope?: string): string[];
|
|
396
|
+
getAGDescriptionScopes(key: string, AGBaseId?: string): string[];
|
|
397
|
+
getGKeyboard(key: string, AGBaseId?: string, ALang?: string, AType?: `inline` | `bottom`, data?: Record<string, any>): string[];
|
|
329
398
|
write(filename: string, template: string): Promise<boolean | null>;
|
|
330
399
|
has(key: string): boolean;
|
|
331
400
|
destroy(): Promise<void>;
|
|
@@ -335,6 +404,8 @@ type ITInlineKb = InlineKeyboard;
|
|
|
335
404
|
type ITBottomKb = Keyboard;
|
|
336
405
|
type ITInBoKb = ITBottomKb | ITInlineKb;
|
|
337
406
|
type ITCt = Context;
|
|
407
|
+
type ITCtMiddleware<C extends ITCt = ITCt> = Middleware<C>;
|
|
408
|
+
type ITOptReplyRich = Parameters<Context[`replyWithRichMessage`]>;
|
|
338
409
|
type ITOptReply = Parameters<Context[`reply`]>[1];
|
|
339
410
|
type ITOptReplyPhoto = Parameters<Context[`replyWithPhoto`]>[1];
|
|
340
411
|
type ITOptReplyVideo = Parameters<Context[`replyWithVideo`]>[1];
|
|
@@ -352,12 +423,12 @@ type ITOptEditMedia2 = Parameters<Context[`editMessageMedia`]>[1];
|
|
|
352
423
|
type ITReplyAction = Parameters<Context[`replyWithChatAction`]>[0];
|
|
353
424
|
type ITData = Record<string, any>;
|
|
354
425
|
type ITBottomKbParams = {
|
|
355
|
-
|
|
426
|
+
AGBaseId?: string;
|
|
356
427
|
data?: ITData;
|
|
357
428
|
cache?: boolean;
|
|
358
429
|
};
|
|
359
430
|
type ITInlineKbParams = {
|
|
360
|
-
|
|
431
|
+
AGBaseId?: string;
|
|
361
432
|
data?: ITData;
|
|
362
433
|
cache?: boolean;
|
|
363
434
|
};
|
|
@@ -438,55 +509,65 @@ declare class Ctx {
|
|
|
438
509
|
constructor(params: ITCtxParams);
|
|
439
510
|
hookBeforeRoute?(): Promise<boolean>;
|
|
440
511
|
hookAfterRoute?(): Promise<void>;
|
|
441
|
-
broadcast(ids: number[], languageCode: string[], keyboard?: ITInBoKb, data?: ITData,
|
|
512
|
+
broadcast(ids: number[], languageCode: string[], keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReply, throwError?: boolean): Promise<{
|
|
442
513
|
successCount: number;
|
|
443
514
|
failedCount: number;
|
|
444
515
|
totalCount: number;
|
|
445
516
|
}>;
|
|
446
|
-
broadcastMedia(ids: number[], languageCode: string[], keyboard?: ITInBoKb, data?: ITData,
|
|
517
|
+
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
518
|
successCount: number;
|
|
448
519
|
failedCount: number;
|
|
449
520
|
totalCount: number;
|
|
450
521
|
}>;
|
|
451
|
-
reply(keyboard?: ITInBoKb, data?: ITData,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
522
|
+
reply(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReply): Promise<grammy_types.Message.TextMessage>;
|
|
523
|
+
replyRich(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options1?: ITOptReplyRich[0] | null, options2?: ITOptReplyRich[1]): Promise<grammy_types.Message.RichMessageMessage>;
|
|
524
|
+
editRich(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options1?: ITOptReplyRich[0] | null, options2?: ITOptEdit, fallbackReply?: boolean): Promise<true | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
|
|
525
|
+
text: string;
|
|
526
|
+
} & Partial<{
|
|
527
|
+
entities: grammy_types.MessageEntity[];
|
|
528
|
+
}>) | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
|
|
529
|
+
rich_message: grammy_types.RichMessage;
|
|
530
|
+
}) | undefined>;
|
|
531
|
+
replyMedia<T extends Exclude<ITMediaBlock[`type`], `group`>>(type: T, keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: T extends `photo` ? ITOptReplyPhoto : T extends `video` ? ITOptReplyVideo : T extends `audio` ? ITOptReplyAudio : T extends `document` ? ITOptReplyDocument : T extends `animation` ? ITOptReplyAnimation : T extends `voice` ? ITOptReplyVoice : T extends `video_note` ? ITOptReplyVideoNote : T extends `sticker` ? ITOptReplySticker : T extends `location` ? ITOptReplyLocation : T extends `contact` ? ITOptReplyContact : undefined): Promise<grammy_types.Message.LocationMessage | grammy_types.Message.ContactMessage | grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.VoiceMessage | grammy_types.Message.VideoNoteMessage | grammy_types.Message.StickerMessage | undefined>;
|
|
532
|
+
replyMediaGroup(type?: ITMediaGroupType, data?: ITData, AGBaseId?: string, options?: ITOptReplyPhoto | ITOptReplyVideo | ITOptReplyAudio | ITOptReplyDocument): Promise<(grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.LivePhotoMessage)[]>;
|
|
533
|
+
replyPhoto(keyboard?: ITInBoKb, data?: ITData, AGBaseId?: string, options?: ITOptReplyPhoto): Promise<grammy_types.Message.LocationMessage | grammy_types.Message.ContactMessage | grammy_types.Message.PhotoMessage | grammy_types.Message.VideoMessage | grammy_types.Message.AudioMessage | grammy_types.Message.DocumentMessage | grammy_types.Message.VoiceMessage | grammy_types.Message.VideoNoteMessage | grammy_types.Message.StickerMessage | undefined>;
|
|
534
|
+
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)[]>;
|
|
535
|
+
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>;
|
|
536
|
+
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)[]>;
|
|
537
|
+
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>;
|
|
538
|
+
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)[]>;
|
|
539
|
+
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>;
|
|
540
|
+
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)[]>;
|
|
541
|
+
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>;
|
|
542
|
+
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>;
|
|
543
|
+
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>;
|
|
544
|
+
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>;
|
|
545
|
+
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>;
|
|
546
|
+
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
547
|
replyAction(type: ITReplyAction): Promise<true>;
|
|
469
|
-
edit(keyboardInline?: ITInlineKb, data?: ITData,
|
|
548
|
+
edit(keyboardInline?: ITInlineKb, data?: ITData, AGBaseId?: string, options?: ITOptEdit, fallbackReply?: boolean): Promise<true | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
|
|
470
549
|
text: string;
|
|
471
550
|
} & Partial<{
|
|
472
551
|
entities: grammy_types.MessageEntity[];
|
|
473
|
-
}>) |
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
552
|
+
}>) | (grammy_types.Update.Edited & grammy_types.Message.CommonMessage & {
|
|
553
|
+
rich_message: grammy_types.RichMessage;
|
|
554
|
+
}) | undefined>;
|
|
555
|
+
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>;
|
|
556
|
+
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>;
|
|
557
|
+
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>;
|
|
558
|
+
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>;
|
|
559
|
+
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>;
|
|
560
|
+
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)[]>;
|
|
561
|
+
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)[]>;
|
|
562
|
+
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)[]>;
|
|
563
|
+
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)[]>;
|
|
564
|
+
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)[]>;
|
|
565
|
+
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>;
|
|
566
|
+
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>;
|
|
567
|
+
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>;
|
|
568
|
+
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>;
|
|
569
|
+
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>;
|
|
570
|
+
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
571
|
delete(): Promise<true>;
|
|
491
572
|
callbackQueryAnswer(options?: Parameters<typeof Ctx.prototype.ct.answerCallbackQuery>[0]): Promise<true | null>;
|
|
492
573
|
setSession(method: string | string[], params: any, moreRoot?: Record<any, any>): Promise<boolean | null>;
|
|
@@ -497,8 +578,8 @@ declare class Ctx {
|
|
|
497
578
|
static buildData(options: ITBuildDataOptions): ITPageData<[]>;
|
|
498
579
|
static buildData(): ITPageData<[]>;
|
|
499
580
|
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,
|
|
581
|
+
bottomKeyboardT(layout?: ITKbCols, AGBaseId?: string | null, data?: Record<any, any>): Keyboard;
|
|
582
|
+
inlineKeyboardT(PageDest: ITKbDest[], layout?: ITKbCols, AGBaseId?: string | null, data?: ITData): InlineKeyboard;
|
|
502
583
|
inlineKeyboard(callback: (k: ITInlineKb, l: string[]) => ITInlineKb, params?: ITInlineKbParams): ITInlineKb;
|
|
503
584
|
bottomKeyboard(callback: (k: ITBottomKb, l: string[]) => ITBottomKb, params?: ITBottomKbParams): ITBottomKb;
|
|
504
585
|
getSeperatorTag(mtd?: `space` | `colon`): " " | ":";
|
|
@@ -713,6 +794,96 @@ declare class WebhookQueue<T = unknown> {
|
|
|
713
794
|
dequeue(): Promise<T>;
|
|
714
795
|
}
|
|
715
796
|
|
|
797
|
+
type ITE2eUser = {
|
|
798
|
+
id?: number;
|
|
799
|
+
username?: string;
|
|
800
|
+
first_name?: string;
|
|
801
|
+
last_name?: string;
|
|
802
|
+
language_code?: string;
|
|
803
|
+
is_bot?: boolean;
|
|
804
|
+
};
|
|
805
|
+
type ITE2eChat = {
|
|
806
|
+
id?: number;
|
|
807
|
+
type?: `private` | `group` | `supergroup` | `channel`;
|
|
808
|
+
first_name?: string;
|
|
809
|
+
last_name?: string;
|
|
810
|
+
username?: string;
|
|
811
|
+
title?: string;
|
|
812
|
+
};
|
|
813
|
+
type ITE2eUpdateOptions = {
|
|
814
|
+
user?: ITE2eUser;
|
|
815
|
+
chat?: ITE2eChat;
|
|
816
|
+
date?: number;
|
|
817
|
+
message_id?: number;
|
|
818
|
+
};
|
|
819
|
+
type ITE2eMediaOptions = ITE2eUpdateOptions & {
|
|
820
|
+
caption?: string;
|
|
821
|
+
};
|
|
822
|
+
type ITE2eLocationOptions = ITE2eUpdateOptions & {
|
|
823
|
+
latitude?: number;
|
|
824
|
+
longitude?: number;
|
|
825
|
+
};
|
|
826
|
+
type ITE2eContactOptions = ITE2eUpdateOptions & {
|
|
827
|
+
phone_number?: string;
|
|
828
|
+
first_name?: string;
|
|
829
|
+
last_name?: string;
|
|
830
|
+
user_id?: number;
|
|
831
|
+
};
|
|
832
|
+
type ITE2eCallbackQueryOptions = ITE2eUpdateOptions & {
|
|
833
|
+
id?: string;
|
|
834
|
+
messageText?: string;
|
|
835
|
+
};
|
|
836
|
+
type ITE2eDiceOptions = ITE2eUpdateOptions & {
|
|
837
|
+
emoji?: `🎲` | `🎯` | `🏀` | `⚽` | `🎰` | `🎳`;
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
type ITE2eApiCall = {
|
|
841
|
+
method: string;
|
|
842
|
+
body: any;
|
|
843
|
+
timestamp: number;
|
|
844
|
+
};
|
|
845
|
+
declare class E2eHelper {
|
|
846
|
+
private bot;
|
|
847
|
+
calls: ITE2eApiCall[];
|
|
848
|
+
private _nextUpdateId;
|
|
849
|
+
private _nextMessageId;
|
|
850
|
+
private _nextApiMsgId;
|
|
851
|
+
constructor(bot: Gramstax);
|
|
852
|
+
private _initialized;
|
|
853
|
+
private _ensureInit;
|
|
854
|
+
lastCall(method?: string): ITE2eApiCall | undefined;
|
|
855
|
+
clearCalls(): void;
|
|
856
|
+
gmsg(page: string, aGBaseId: string, data?: Record<string, any>, aLang?: string): string;
|
|
857
|
+
gkb(page: string, aGBaseId: string, aType?: `inline` | `bottom`, data?: Record<string, any>, aLang?: string): string[];
|
|
858
|
+
gmedia(page: string, aGBaseId: string, data?: Record<string, any>, aLang?: string): Record<string, any>;
|
|
859
|
+
extractText(call: ITE2eApiCall): string | undefined;
|
|
860
|
+
extractButtonLabels(call: ITE2eApiCall): string[];
|
|
861
|
+
private _defaultUser;
|
|
862
|
+
private _defaultChat;
|
|
863
|
+
private _nextIds;
|
|
864
|
+
private _buildMessageUpdate;
|
|
865
|
+
handleUpdate(update: Record<string, unknown>): Promise<ITE2eApiCall[]>;
|
|
866
|
+
sendText(text: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
|
|
867
|
+
sendPhoto(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
|
|
868
|
+
sendVideo(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
|
|
869
|
+
sendAudio(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
|
|
870
|
+
sendDocument(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
|
|
871
|
+
sendAnimation(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
|
|
872
|
+
sendVoice(options?: ITE2eMediaOptions): Promise<ITE2eApiCall[]>;
|
|
873
|
+
sendVideoNote(options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
|
|
874
|
+
sendSticker(options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
|
|
875
|
+
sendLocation(options?: ITE2eLocationOptions): Promise<ITE2eApiCall[]>;
|
|
876
|
+
sendContact(options?: ITE2eContactOptions): Promise<ITE2eApiCall[]>;
|
|
877
|
+
sendCallbackQuery(data: string, options?: ITE2eCallbackQueryOptions): Promise<ITE2eApiCall[]>;
|
|
878
|
+
sendDice(options?: ITE2eDiceOptions): Promise<ITE2eApiCall[]>;
|
|
879
|
+
sendEditedText(text: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
|
|
880
|
+
sendNewChatMembers(options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
|
|
881
|
+
sendChannelPost(text: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
|
|
882
|
+
sendPollAnswer(pollId: string, optionIds: number[], options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
|
|
883
|
+
sendInlineQuery(query: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
|
|
884
|
+
sendChosenInlineResult(resultId: string, query: string, options?: ITE2eUpdateOptions): Promise<ITE2eApiCall[]>;
|
|
885
|
+
}
|
|
886
|
+
|
|
716
887
|
declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
717
888
|
templateManager: TemplateManager;
|
|
718
889
|
cacheKeyboard: Map<any, any>;
|
|
@@ -723,7 +894,7 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
723
894
|
};
|
|
724
895
|
log: LoggingHelper | undefined;
|
|
725
896
|
bot: Bot;
|
|
726
|
-
botConfig?: BotConfig<
|
|
897
|
+
botConfig?: BotConfig<ITCt>;
|
|
727
898
|
webhookQueue?: ITWebhookQueueConfig;
|
|
728
899
|
protected webhookQueueInstance?: WebhookQueue<any>;
|
|
729
900
|
protected webhookServer?: {
|
|
@@ -731,27 +902,33 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
731
902
|
};
|
|
732
903
|
handlerBotUpdate: any;
|
|
733
904
|
deployType: `polling` | `webhook` | `serverless` | `test`;
|
|
905
|
+
e2e?: E2eHelper;
|
|
734
906
|
constructor(params: ITGramstaxParams);
|
|
735
907
|
stop(): Promise<void>;
|
|
736
|
-
_onCatch(error: BotError<
|
|
908
|
+
_onCatch(error: BotError<ITCt>): void;
|
|
909
|
+
_onStart(botInfo: UserFromGetMe, method: `polling` | `webhook` | `serverless`, data: string | null): Promise<void>;
|
|
737
910
|
hookBeforeStart?(): Promise<any>;
|
|
738
911
|
hookAfterStart?(): Promise<any>;
|
|
739
|
-
hookBeforeRoute?(ctx: ICtx, data
|
|
912
|
+
hookBeforeRoute?(ctx: ICtx, data?: {
|
|
740
913
|
listenerName: string;
|
|
914
|
+
isEdit: boolean;
|
|
741
915
|
}): Promise<boolean>;
|
|
742
|
-
hookAfterRoute?(ctx: ICtx, data
|
|
916
|
+
hookAfterRoute?(ctx: ICtx, data?: {
|
|
743
917
|
listenerName: string;
|
|
744
|
-
|
|
918
|
+
state: `matched` | `no-match` | `no-handler` | `blocked` | `error` | `notfound`;
|
|
919
|
+
isEdit: boolean;
|
|
745
920
|
}): Promise<void>;
|
|
746
|
-
hookErrorPage?(ctx: ICtx, data
|
|
921
|
+
hookErrorPage?(ctx: ICtx, data?: {
|
|
747
922
|
listenerName: string;
|
|
748
923
|
error: any;
|
|
749
924
|
isEdit: boolean;
|
|
750
925
|
}): Promise<void>;
|
|
751
|
-
hookErrorInputNotFoundPage?(ctx: ICtx
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
926
|
+
hookErrorInputNotFoundPage?(ctx: ICtx, data?: {
|
|
927
|
+
listenerName: string;
|
|
928
|
+
isEdit: boolean;
|
|
929
|
+
}): Promise<void>;
|
|
930
|
+
createBot(token: string): Bot<grammy.Context, grammy.Api<grammy.RawApi>>;
|
|
931
|
+
createCtx(ct: ITCt): ICtx;
|
|
755
932
|
_runPolling(): void;
|
|
756
933
|
_runWebhook(fullUrl: string): Promise<void>;
|
|
757
934
|
_startWebhookWorker(queue: WebhookQueue<any>, acquireChat: (chatId: any) => Promise<() => void>, getChatId: (update: any) => any): void;
|
|
@@ -771,7 +948,7 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
771
948
|
_pageBuildData(Page: typeof Ctx, filePath: string): void;
|
|
772
949
|
_pageSorts(Page: typeof Ctx, pages: typeof Gramstax.prototype.pages, indexPage: number): void;
|
|
773
950
|
executeSyncBlocksDescription(pages: typeof Gramstax.prototype.pages): Promise<void>;
|
|
774
|
-
_pageLoads(): {
|
|
951
|
+
_pageLoads(pagesPath?: string): {
|
|
775
952
|
all: Record<string, typeof Ctx>;
|
|
776
953
|
routeDynamic: string[];
|
|
777
954
|
routeDynamicSpesific: {
|
|
@@ -1113,39 +1290,29 @@ declare class Gramstax<ICtx extends Ctx = Ctx> {
|
|
|
1113
1290
|
listRouteStatic: readonly ["handleCallbackData", "handleText", "handleCommandText", "handleCaptionPhoto", "handleCommandCaptionPhoto", "handleCaptionVideo", "handleCommandCaptionVideo", "handleCaptionAudio", "handleCommandCaptionAudio", "handleCaptionDocument", "handleCommandCaptionDocument", "handleCaptionAnimation", "handleCommandCaptionAnimation", "handleCaptionVoice", "handleCommandCaptionVoice"];
|
|
1114
1291
|
listRouteStaticIntent: readonly ["handleArgsCallbackData", "handleArgsText", "handleCommandArgsText", "handleCaptionArgsPhoto", "handleCommandCaptionArgsPhoto", "handleCaptionArgsVideo", "handleCommandCaptionArgsVideo", "handleCaptionArgsAudio", "handleCommandCaptionArgsAudio", "handleCaptionArgsDocument", "handleCommandCaptionArgsDocument", "handleCaptionArgsAnimation", "handleCommandCaptionArgsAnimation", "handleCaptionArgsVoice", "handleCommandCaptionArgsVoice"];
|
|
1115
1292
|
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"];
|
|
1293
|
+
listRouteDynamicSpesific: readonly ["handleFreeText", "handleFreePhoto", "handleFreeVideo", "handleFreeAudio", "handleFreeDocument", "handleFreeAnimation", "handleFreeVoice", "handleFreeVideoNote", "handleFreeSticker", "handleFreeLocation", "handleFreeContact"];
|
|
1116
1294
|
lenListRouteStatic: 15;
|
|
1117
1295
|
lenListRouteStaticIntent: 15;
|
|
1118
1296
|
lenListRouteStaticSession: number;
|
|
1297
|
+
lenListRouteDynamicSpesific: 11;
|
|
1119
1298
|
};
|
|
1120
1299
|
_pageRoutes(ctx: ICtx, fromListener: `callbackdata` | keyof typeof Gramstax.prototype.pages.routeDynamicSpesific): Promise<{
|
|
1121
|
-
|
|
1300
|
+
state: `matched` | `no-match` | `no-handler` | `blocked`;
|
|
1122
1301
|
}>;
|
|
1123
|
-
_onHandle(ct:
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
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;
|
|
1302
|
+
_onHandle(ct: ITCt, listenerName: Parameters<Gramstax[`_pageRoutes`]>[1], shouldCheckNotFound?: boolean): Promise<void>;
|
|
1303
|
+
registerLowPlugin?(): Array<ITCtMiddleware<ITCt>>;
|
|
1304
|
+
registerLowOnCallbackData(): void;
|
|
1305
|
+
registerLowOnMessageText(): void;
|
|
1306
|
+
registerLowOnMessagePhoto(): void;
|
|
1307
|
+
registerLowOnMessageVideo(): void;
|
|
1308
|
+
registerLowOnMessageAudio(): void;
|
|
1309
|
+
registerLowOnMessageDocument(): void;
|
|
1310
|
+
registerLowOnMessageAnimation(): void;
|
|
1311
|
+
registerLowOnMessageVoice(): void;
|
|
1312
|
+
registerLowOnMessageVideoNote(): void;
|
|
1313
|
+
registerLowOnMessageSticker(): void;
|
|
1314
|
+
registerLowOnMessageLocation(): void;
|
|
1315
|
+
registerLowOnMessageContact(): void;
|
|
1149
1316
|
}
|
|
1150
1317
|
|
|
1151
1318
|
declare class LabelKeyboard {
|
|
@@ -1158,116 +1325,6 @@ declare class BlockKeyboard {
|
|
|
1158
1325
|
static _build(key: string, lang?: string, type?: string, reverse?: boolean): string;
|
|
1159
1326
|
}
|
|
1160
1327
|
|
|
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
1328
|
type ITMockTelegramJson = {
|
|
1272
1329
|
ok: boolean;
|
|
1273
1330
|
result: unknown;
|
|
@@ -1381,4 +1438,4 @@ declare class MockTelegramServer {
|
|
|
1381
1438
|
sendCallbackQuery(data: string, options?: ITMockTelegramCallbackQueryOptions): Promise<ITMockTelegramRequestRecord[]>;
|
|
1382
1439
|
}
|
|
1383
1440
|
|
|
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
|
|
1441
|
+
export { BlockKeyboard, CacheExternal, Ctx, E2eHelper, Gramstax, type ITBottomKb, type ITBottomKbParams, type ITBuildDataOptions, type ITCacheRpc, type ITCompiledTemplate, type ITCt, type ITCtMiddleware, type ITCtxParams, type ITData, type ITE2eApiCall, type ITE2eCallbackQueryOptions, type ITE2eChat, type ITE2eContactOptions, type ITE2eDiceOptions, type ITE2eLocationOptions, type ITE2eMediaOptions, type ITE2eUpdateOptions, type ITE2eUser, type ITGramstaxParams, type ITInBoKb, type ITInlineKb, type ITInlineKbParams, type ITKbCols, type ITKbDest, type ITMediaBlock, type ITMockTelegramCallbackQueryOptions, type ITMockTelegramChat, type ITMockTelegramContactOptions, type ITMockTelegramHandler, type ITMockTelegramJson, type ITMockTelegramLocationOptions, type ITMockTelegramMediaOptions, type ITMockTelegramRequestRecord, type ITMockTelegramServerOptions, type ITMockTelegramUpdateOptions, type ITMockTelegramUser, type ITOptEdit, type ITOptEditMedia1, type ITOptEditMedia2, type ITOptReply, type ITOptReplyAnimation, type ITOptReplyAudio, type ITOptReplyContact, type ITOptReplyDocument, type ITOptReplyLocation, type ITOptReplyPhoto, type ITOptReplyRich, type ITOptReplySticker, type ITOptReplyVideo, type ITOptReplyVideoNote, type ITOptReplyVoice, type ITPageData, type ITReplyAction, type ITTemp, type ITTemplateOptions, type ITWebhookQueueConfig, LabelKeyboard, LoggingHelper, MockTelegramServer, PageManager, TemplateEngine, TemplateManager, WebhookQueue, log };
|