gramio 0.6.0 → 0.6.1
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/index.d.cts +40 -25
- package/dist/index.d.ts +40 -25
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -11,7 +11,7 @@ import * as _gramio_types from '@gramio/types';
|
|
|
11
11
|
import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramReactionTypeEmojiEmoji, TelegramUser, APIMethodParams, APIMethodReturn, SetWebhookParams, TelegramUpdate, TelegramMessageEntity } from '@gramio/types';
|
|
12
12
|
export * from '@gramio/types';
|
|
13
13
|
import * as _gramio_composer from '@gramio/composer';
|
|
14
|
-
import { ComposerLike, MacroDefinitions,
|
|
14
|
+
import { ComposerLike, MacroDefinitions, EventContextOf, EventComposer, MacroDef, Next, EventQueue, HandlerOptions, DeriveFromOptions } from '@gramio/composer';
|
|
15
15
|
export { ContextCallback, DeriveFromOptions, EventComposer, EventQueue, HandlerOptions, MacroDef, MacroDefinitions, MacroDeriveType, MacroHooks, MacroOptionType, Middleware, Next, WithCtx, buildFromOptions, compose, noopNext, skip, stop } from '@gramio/composer';
|
|
16
16
|
|
|
17
17
|
/** Symbol to determine which error kind is it */
|
|
@@ -44,6 +44,7 @@ type Ctx<K extends keyof ContextsMapping<AnyBot>> = InstanceType<ContextsMapping
|
|
|
44
44
|
type GramIOLike<T> = ComposerLike<T> & {
|
|
45
45
|
"~": {
|
|
46
46
|
macros: MacroDefinitions;
|
|
47
|
+
Derives?: Record<string, object>;
|
|
47
48
|
};
|
|
48
49
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): T;
|
|
49
50
|
};
|
|
@@ -54,29 +55,29 @@ declare module "@gramio/composer" {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
declare const Composer: _gramio_composer.EventComposerConstructor<Context<AnyBot>, TelegramEventMap, {
|
|
57
|
-
reaction<TThis extends GramIOLike<TThis>>(this: TThis, trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: Ctx<"message_reaction"> &
|
|
58
|
+
reaction<TThis extends GramIOLike<TThis>>(this: TThis, trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: Ctx<"message_reaction"> & EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
58
59
|
callbackQuery<TThis extends GramIOLike<TThis>, Trigger extends CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: Ctx<"callback_query"> & {
|
|
59
60
|
queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
|
|
60
|
-
} &
|
|
61
|
+
} & EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
61
62
|
chosenInlineResult<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | string | ((context: Ctx<"chosen_inline_result">) => boolean), handler: (context: Ctx<"chosen_inline_result"> & {
|
|
62
63
|
args: RegExpMatchArray | null;
|
|
63
|
-
} &
|
|
64
|
+
} & EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
64
65
|
inlineQuery<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | string | ((context: Ctx<"inline_query">) => boolean), handler: (context: Ctx<"inline_query"> & {
|
|
65
66
|
args: RegExpMatchArray | null;
|
|
66
|
-
} &
|
|
67
|
+
} & EventContextOf<TThis, "inline_query">) => unknown, options?: {
|
|
67
68
|
onResult?: (context: Ctx<"chosen_inline_result"> & {
|
|
68
69
|
args: RegExpMatchArray | null;
|
|
69
|
-
} &
|
|
70
|
+
} & EventContextOf<TThis, "chosen_inline_result">) => unknown;
|
|
70
71
|
} & Record<string, unknown>): TThis;
|
|
71
72
|
hears<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: Ctx<"message">) => boolean), handler: (context: Ctx<"message"> & {
|
|
72
73
|
args: RegExpMatchArray | null;
|
|
73
|
-
} &
|
|
74
|
+
} & EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
74
75
|
command<TThis extends GramIOLike<TThis>>(this: TThis, command: MaybeArray<string>, handler: (context: Ctx<"message"> & {
|
|
75
76
|
args: string | null;
|
|
76
|
-
} &
|
|
77
|
+
} & EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
77
78
|
startParameter<TThis extends GramIOLike<TThis>>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<Ctx<"message"> & {
|
|
78
79
|
rawStartPayload: string;
|
|
79
|
-
} &
|
|
80
|
+
} & EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
|
|
80
81
|
}>;
|
|
81
82
|
|
|
82
83
|
/**
|
|
@@ -213,120 +214,134 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
213
214
|
reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
214
215
|
"~": {
|
|
215
216
|
macros: MacroDefinitions;
|
|
217
|
+
Derives?: Record<string, object>;
|
|
216
218
|
};
|
|
217
219
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
218
|
-
}>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.
|
|
220
|
+
}>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
219
221
|
callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
220
222
|
"~": {
|
|
221
223
|
macros: MacroDefinitions;
|
|
224
|
+
Derives?: Record<string, object>;
|
|
222
225
|
};
|
|
223
226
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
224
227
|
}, Trigger extends _gramio_callback_data.CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.CallbackQueryContext<AnyBot> & {
|
|
225
228
|
queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
|
|
226
|
-
} & _gramio_composer.
|
|
229
|
+
} & _gramio_composer.EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
227
230
|
chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
228
231
|
"~": {
|
|
229
232
|
macros: MacroDefinitions;
|
|
233
|
+
Derives?: Record<string, object>;
|
|
230
234
|
};
|
|
231
235
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
232
236
|
}>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
|
|
233
237
|
args: RegExpMatchArray | null;
|
|
234
|
-
} & _gramio_composer.
|
|
238
|
+
} & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
235
239
|
inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
236
240
|
"~": {
|
|
237
241
|
macros: MacroDefinitions;
|
|
242
|
+
Derives?: Record<string, object>;
|
|
238
243
|
};
|
|
239
244
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
240
245
|
}>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
|
|
241
246
|
args: RegExpMatchArray | null;
|
|
242
|
-
} & _gramio_composer.
|
|
247
|
+
} & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown, options?: {
|
|
243
248
|
onResult?: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
|
|
244
249
|
args: RegExpMatchArray | null;
|
|
245
|
-
} & _gramio_composer.
|
|
250
|
+
} & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown;
|
|
246
251
|
} & Record<string, unknown>): TThis;
|
|
247
252
|
hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
248
253
|
"~": {
|
|
249
254
|
macros: MacroDefinitions;
|
|
255
|
+
Derives?: Record<string, object>;
|
|
250
256
|
};
|
|
251
257
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
252
258
|
}>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
253
259
|
args: RegExpMatchArray | null;
|
|
254
|
-
} & _gramio_composer.
|
|
260
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
255
261
|
command<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
256
262
|
"~": {
|
|
257
263
|
macros: MacroDefinitions;
|
|
264
|
+
Derives?: Record<string, object>;
|
|
258
265
|
};
|
|
259
266
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
260
267
|
}>(this: TThis, command: MaybeArray<string>, handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
261
268
|
args: string | null;
|
|
262
|
-
} & _gramio_composer.
|
|
269
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
263
270
|
startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
264
271
|
"~": {
|
|
265
272
|
macros: MacroDefinitions;
|
|
273
|
+
Derives?: Record<string, object>;
|
|
266
274
|
};
|
|
267
275
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
268
276
|
}>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
269
277
|
rawStartPayload: string;
|
|
270
|
-
} & _gramio_composer.
|
|
278
|
+
} & _gramio_composer.EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
|
|
271
279
|
}, {}> & {
|
|
272
280
|
reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
273
281
|
"~": {
|
|
274
282
|
macros: MacroDefinitions;
|
|
283
|
+
Derives?: Record<string, object>;
|
|
275
284
|
};
|
|
276
285
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
277
|
-
}>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.
|
|
286
|
+
}>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
278
287
|
callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
279
288
|
"~": {
|
|
280
289
|
macros: MacroDefinitions;
|
|
290
|
+
Derives?: Record<string, object>;
|
|
281
291
|
};
|
|
282
292
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
283
293
|
}, Trigger extends _gramio_callback_data.CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.CallbackQueryContext<AnyBot> & {
|
|
284
294
|
queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
|
|
285
|
-
} & _gramio_composer.
|
|
295
|
+
} & _gramio_composer.EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
286
296
|
chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
287
297
|
"~": {
|
|
288
298
|
macros: MacroDefinitions;
|
|
299
|
+
Derives?: Record<string, object>;
|
|
289
300
|
};
|
|
290
301
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
291
302
|
}>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
|
|
292
303
|
args: RegExpMatchArray | null;
|
|
293
|
-
} & _gramio_composer.
|
|
304
|
+
} & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
294
305
|
inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
295
306
|
"~": {
|
|
296
307
|
macros: MacroDefinitions;
|
|
308
|
+
Derives?: Record<string, object>;
|
|
297
309
|
};
|
|
298
310
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
299
311
|
}>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
|
|
300
312
|
args: RegExpMatchArray | null;
|
|
301
|
-
} & _gramio_composer.
|
|
313
|
+
} & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown, options?: {
|
|
302
314
|
onResult?: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
|
|
303
315
|
args: RegExpMatchArray | null;
|
|
304
|
-
} & _gramio_composer.
|
|
316
|
+
} & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown;
|
|
305
317
|
} & Record<string, unknown>): TThis;
|
|
306
318
|
hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
307
319
|
"~": {
|
|
308
320
|
macros: MacroDefinitions;
|
|
321
|
+
Derives?: Record<string, object>;
|
|
309
322
|
};
|
|
310
323
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
311
324
|
}>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
312
325
|
args: RegExpMatchArray | null;
|
|
313
|
-
} & _gramio_composer.
|
|
326
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
314
327
|
command<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
315
328
|
"~": {
|
|
316
329
|
macros: MacroDefinitions;
|
|
330
|
+
Derives?: Record<string, object>;
|
|
317
331
|
};
|
|
318
332
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
319
333
|
}>(this: TThis, command: MaybeArray<string>, handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
320
334
|
args: string | null;
|
|
321
|
-
} & _gramio_composer.
|
|
335
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
322
336
|
startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
323
337
|
"~": {
|
|
324
338
|
macros: MacroDefinitions;
|
|
339
|
+
Derives?: Record<string, object>;
|
|
325
340
|
};
|
|
326
341
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
327
342
|
}>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
328
343
|
rawStartPayload: string;
|
|
329
|
-
} & _gramio_composer.
|
|
344
|
+
} & _gramio_composer.EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
|
|
330
345
|
};
|
|
331
346
|
/** Store plugin preRequests hooks */
|
|
332
347
|
preRequests: [Hooks.PreRequest<any>, MaybeArray<keyof APIMethods> | undefined][];
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import * as _gramio_types from '@gramio/types';
|
|
|
11
11
|
import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramReactionTypeEmojiEmoji, TelegramUser, APIMethodParams, APIMethodReturn, SetWebhookParams, TelegramUpdate, TelegramMessageEntity } from '@gramio/types';
|
|
12
12
|
export * from '@gramio/types';
|
|
13
13
|
import * as _gramio_composer from '@gramio/composer';
|
|
14
|
-
import { ComposerLike, MacroDefinitions,
|
|
14
|
+
import { ComposerLike, MacroDefinitions, EventContextOf, EventComposer, MacroDef, Next, EventQueue, HandlerOptions, DeriveFromOptions } from '@gramio/composer';
|
|
15
15
|
export { ContextCallback, DeriveFromOptions, EventComposer, EventQueue, HandlerOptions, MacroDef, MacroDefinitions, MacroDeriveType, MacroHooks, MacroOptionType, Middleware, Next, WithCtx, buildFromOptions, compose, noopNext, skip, stop } from '@gramio/composer';
|
|
16
16
|
|
|
17
17
|
/** Symbol to determine which error kind is it */
|
|
@@ -44,6 +44,7 @@ type Ctx<K extends keyof ContextsMapping<AnyBot>> = InstanceType<ContextsMapping
|
|
|
44
44
|
type GramIOLike<T> = ComposerLike<T> & {
|
|
45
45
|
"~": {
|
|
46
46
|
macros: MacroDefinitions;
|
|
47
|
+
Derives?: Record<string, object>;
|
|
47
48
|
};
|
|
48
49
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): T;
|
|
49
50
|
};
|
|
@@ -54,29 +55,29 @@ declare module "@gramio/composer" {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
declare const Composer: _gramio_composer.EventComposerConstructor<Context<AnyBot>, TelegramEventMap, {
|
|
57
|
-
reaction<TThis extends GramIOLike<TThis>>(this: TThis, trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: Ctx<"message_reaction"> &
|
|
58
|
+
reaction<TThis extends GramIOLike<TThis>>(this: TThis, trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: Ctx<"message_reaction"> & EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
58
59
|
callbackQuery<TThis extends GramIOLike<TThis>, Trigger extends CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: Ctx<"callback_query"> & {
|
|
59
60
|
queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
|
|
60
|
-
} &
|
|
61
|
+
} & EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
61
62
|
chosenInlineResult<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | string | ((context: Ctx<"chosen_inline_result">) => boolean), handler: (context: Ctx<"chosen_inline_result"> & {
|
|
62
63
|
args: RegExpMatchArray | null;
|
|
63
|
-
} &
|
|
64
|
+
} & EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
64
65
|
inlineQuery<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | string | ((context: Ctx<"inline_query">) => boolean), handler: (context: Ctx<"inline_query"> & {
|
|
65
66
|
args: RegExpMatchArray | null;
|
|
66
|
-
} &
|
|
67
|
+
} & EventContextOf<TThis, "inline_query">) => unknown, options?: {
|
|
67
68
|
onResult?: (context: Ctx<"chosen_inline_result"> & {
|
|
68
69
|
args: RegExpMatchArray | null;
|
|
69
|
-
} &
|
|
70
|
+
} & EventContextOf<TThis, "chosen_inline_result">) => unknown;
|
|
70
71
|
} & Record<string, unknown>): TThis;
|
|
71
72
|
hears<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: Ctx<"message">) => boolean), handler: (context: Ctx<"message"> & {
|
|
72
73
|
args: RegExpMatchArray | null;
|
|
73
|
-
} &
|
|
74
|
+
} & EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
74
75
|
command<TThis extends GramIOLike<TThis>>(this: TThis, command: MaybeArray<string>, handler: (context: Ctx<"message"> & {
|
|
75
76
|
args: string | null;
|
|
76
|
-
} &
|
|
77
|
+
} & EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
77
78
|
startParameter<TThis extends GramIOLike<TThis>>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<Ctx<"message"> & {
|
|
78
79
|
rawStartPayload: string;
|
|
79
|
-
} &
|
|
80
|
+
} & EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
|
|
80
81
|
}>;
|
|
81
82
|
|
|
82
83
|
/**
|
|
@@ -213,120 +214,134 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
213
214
|
reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
214
215
|
"~": {
|
|
215
216
|
macros: MacroDefinitions;
|
|
217
|
+
Derives?: Record<string, object>;
|
|
216
218
|
};
|
|
217
219
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
218
|
-
}>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.
|
|
220
|
+
}>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
219
221
|
callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
220
222
|
"~": {
|
|
221
223
|
macros: MacroDefinitions;
|
|
224
|
+
Derives?: Record<string, object>;
|
|
222
225
|
};
|
|
223
226
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
224
227
|
}, Trigger extends _gramio_callback_data.CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.CallbackQueryContext<AnyBot> & {
|
|
225
228
|
queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
|
|
226
|
-
} & _gramio_composer.
|
|
229
|
+
} & _gramio_composer.EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
227
230
|
chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
228
231
|
"~": {
|
|
229
232
|
macros: MacroDefinitions;
|
|
233
|
+
Derives?: Record<string, object>;
|
|
230
234
|
};
|
|
231
235
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
232
236
|
}>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
|
|
233
237
|
args: RegExpMatchArray | null;
|
|
234
|
-
} & _gramio_composer.
|
|
238
|
+
} & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
235
239
|
inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
236
240
|
"~": {
|
|
237
241
|
macros: MacroDefinitions;
|
|
242
|
+
Derives?: Record<string, object>;
|
|
238
243
|
};
|
|
239
244
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
240
245
|
}>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
|
|
241
246
|
args: RegExpMatchArray | null;
|
|
242
|
-
} & _gramio_composer.
|
|
247
|
+
} & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown, options?: {
|
|
243
248
|
onResult?: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
|
|
244
249
|
args: RegExpMatchArray | null;
|
|
245
|
-
} & _gramio_composer.
|
|
250
|
+
} & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown;
|
|
246
251
|
} & Record<string, unknown>): TThis;
|
|
247
252
|
hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
248
253
|
"~": {
|
|
249
254
|
macros: MacroDefinitions;
|
|
255
|
+
Derives?: Record<string, object>;
|
|
250
256
|
};
|
|
251
257
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
252
258
|
}>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
253
259
|
args: RegExpMatchArray | null;
|
|
254
|
-
} & _gramio_composer.
|
|
260
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
255
261
|
command<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
256
262
|
"~": {
|
|
257
263
|
macros: MacroDefinitions;
|
|
264
|
+
Derives?: Record<string, object>;
|
|
258
265
|
};
|
|
259
266
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
260
267
|
}>(this: TThis, command: MaybeArray<string>, handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
261
268
|
args: string | null;
|
|
262
|
-
} & _gramio_composer.
|
|
269
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
263
270
|
startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
264
271
|
"~": {
|
|
265
272
|
macros: MacroDefinitions;
|
|
273
|
+
Derives?: Record<string, object>;
|
|
266
274
|
};
|
|
267
275
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
268
276
|
}>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
269
277
|
rawStartPayload: string;
|
|
270
|
-
} & _gramio_composer.
|
|
278
|
+
} & _gramio_composer.EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
|
|
271
279
|
}, {}> & {
|
|
272
280
|
reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
273
281
|
"~": {
|
|
274
282
|
macros: MacroDefinitions;
|
|
283
|
+
Derives?: Record<string, object>;
|
|
275
284
|
};
|
|
276
285
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
277
|
-
}>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.
|
|
286
|
+
}>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
278
287
|
callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
279
288
|
"~": {
|
|
280
289
|
macros: MacroDefinitions;
|
|
290
|
+
Derives?: Record<string, object>;
|
|
281
291
|
};
|
|
282
292
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
283
293
|
}, Trigger extends _gramio_callback_data.CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.CallbackQueryContext<AnyBot> & {
|
|
284
294
|
queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
|
|
285
|
-
} & _gramio_composer.
|
|
295
|
+
} & _gramio_composer.EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
286
296
|
chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
287
297
|
"~": {
|
|
288
298
|
macros: MacroDefinitions;
|
|
299
|
+
Derives?: Record<string, object>;
|
|
289
300
|
};
|
|
290
301
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
291
302
|
}>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
|
|
292
303
|
args: RegExpMatchArray | null;
|
|
293
|
-
} & _gramio_composer.
|
|
304
|
+
} & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
294
305
|
inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
295
306
|
"~": {
|
|
296
307
|
macros: MacroDefinitions;
|
|
308
|
+
Derives?: Record<string, object>;
|
|
297
309
|
};
|
|
298
310
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
299
311
|
}>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
|
|
300
312
|
args: RegExpMatchArray | null;
|
|
301
|
-
} & _gramio_composer.
|
|
313
|
+
} & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown, options?: {
|
|
302
314
|
onResult?: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
|
|
303
315
|
args: RegExpMatchArray | null;
|
|
304
|
-
} & _gramio_composer.
|
|
316
|
+
} & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown;
|
|
305
317
|
} & Record<string, unknown>): TThis;
|
|
306
318
|
hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
307
319
|
"~": {
|
|
308
320
|
macros: MacroDefinitions;
|
|
321
|
+
Derives?: Record<string, object>;
|
|
309
322
|
};
|
|
310
323
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
311
324
|
}>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
312
325
|
args: RegExpMatchArray | null;
|
|
313
|
-
} & _gramio_composer.
|
|
326
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
314
327
|
command<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
315
328
|
"~": {
|
|
316
329
|
macros: MacroDefinitions;
|
|
330
|
+
Derives?: Record<string, object>;
|
|
317
331
|
};
|
|
318
332
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
319
333
|
}>(this: TThis, command: MaybeArray<string>, handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
320
334
|
args: string | null;
|
|
321
|
-
} & _gramio_composer.
|
|
335
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
|
|
322
336
|
startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
323
337
|
"~": {
|
|
324
338
|
macros: MacroDefinitions;
|
|
339
|
+
Derives?: Record<string, object>;
|
|
325
340
|
};
|
|
326
341
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
327
342
|
}>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
328
343
|
rawStartPayload: string;
|
|
329
|
-
} & _gramio_composer.
|
|
344
|
+
} & _gramio_composer.EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
|
|
330
345
|
};
|
|
331
346
|
/** Store plugin preRequests hooks */
|
|
332
347
|
preRequests: [Hooks.PreRequest<any>, MaybeArray<keyof APIMethods> | undefined][];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gramio",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"description": "Powerful, extensible and really type-safe Telegram Bot API framework",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@biomejs/biome": "2.4.4",
|
|
59
|
-
"@gramio/test": "^0.3.
|
|
59
|
+
"@gramio/test": "^0.3.1",
|
|
60
60
|
"@types/bun": "^1.3.9",
|
|
61
61
|
"@types/debug": "^4.1.12",
|
|
62
62
|
"expect-type": "^1.3.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@gramio/callback-data": "^0.1.0",
|
|
68
|
-
"@gramio/composer": "^0.3.
|
|
68
|
+
"@gramio/composer": "^0.3.3",
|
|
69
69
|
"@gramio/contexts": "^0.4.0",
|
|
70
70
|
"@gramio/files": "^0.3.0",
|
|
71
71
|
"@gramio/format": "^0.4.0",
|