gramio 0.8.0 → 0.8.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 +38 -22
- package/dist/index.d.ts +38 -22
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -8,11 +8,11 @@ export * from '@gramio/files';
|
|
|
8
8
|
export * from '@gramio/format';
|
|
9
9
|
export * from '@gramio/keyboards';
|
|
10
10
|
import * as _gramio_types from '@gramio/types';
|
|
11
|
-
import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramReactionTypeEmojiEmoji, TelegramUser, APIMethodParams, APIMethodReturn, SetWebhookParams, TelegramUpdate,
|
|
11
|
+
import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramReactionTypeEmojiEmoji, TelegramUser, APIMethodParams, APIMethodReturn, TelegramBotCommandScope, 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,
|
|
15
|
-
export {
|
|
14
|
+
import { ComposerLike, MacroDefinitions, EventContextOf, EventComposer, MacroDef, Next, EventQueue, HandlerOptions, DeriveFromOptions } from '@gramio/composer';
|
|
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
|
/**
|
|
18
18
|
* Telegram Bot API top-level update type name.
|
|
@@ -174,7 +174,7 @@ type Ctx<K extends keyof ContextsMapping<AnyBot>> = InstanceType<ContextsMapping
|
|
|
174
174
|
type GramIOLike<T> = ComposerLike<T> & {
|
|
175
175
|
"~": {
|
|
176
176
|
macros: MacroDefinitions;
|
|
177
|
-
commandsMeta
|
|
177
|
+
commandsMeta?: Map<string, unknown>;
|
|
178
178
|
Derives?: Record<string, object>;
|
|
179
179
|
};
|
|
180
180
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): T;
|
|
@@ -348,7 +348,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
348
348
|
reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
349
349
|
"~": {
|
|
350
350
|
macros: MacroDefinitions;
|
|
351
|
-
commandsMeta
|
|
351
|
+
commandsMeta?: Map<string, unknown>;
|
|
352
352
|
Derives?: Record<string, object>;
|
|
353
353
|
};
|
|
354
354
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -356,7 +356,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
356
356
|
callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
357
357
|
"~": {
|
|
358
358
|
macros: MacroDefinitions;
|
|
359
|
-
commandsMeta
|
|
359
|
+
commandsMeta?: Map<string, unknown>;
|
|
360
360
|
Derives?: Record<string, object>;
|
|
361
361
|
};
|
|
362
362
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -366,7 +366,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
366
366
|
chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
367
367
|
"~": {
|
|
368
368
|
macros: MacroDefinitions;
|
|
369
|
-
commandsMeta
|
|
369
|
+
commandsMeta?: Map<string, unknown>;
|
|
370
370
|
Derives?: Record<string, object>;
|
|
371
371
|
};
|
|
372
372
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -376,7 +376,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
376
376
|
inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
377
377
|
"~": {
|
|
378
378
|
macros: MacroDefinitions;
|
|
379
|
-
commandsMeta
|
|
379
|
+
commandsMeta?: Map<string, unknown>;
|
|
380
380
|
Derives?: Record<string, object>;
|
|
381
381
|
};
|
|
382
382
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -390,7 +390,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
390
390
|
hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
391
391
|
"~": {
|
|
392
392
|
macros: MacroDefinitions;
|
|
393
|
-
commandsMeta
|
|
393
|
+
commandsMeta?: Map<string, unknown>;
|
|
394
394
|
Derives?: Record<string, object>;
|
|
395
395
|
};
|
|
396
396
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -400,19 +400,19 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
400
400
|
command<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
401
401
|
"~": {
|
|
402
402
|
macros: MacroDefinitions;
|
|
403
|
-
commandsMeta
|
|
403
|
+
commandsMeta?: Map<string, unknown>;
|
|
404
404
|
Derives?: Record<string, object>;
|
|
405
405
|
};
|
|
406
406
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
407
407
|
}>(this: TThis, command: MaybeArray<string>, handlerOrMeta: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
408
408
|
args: string | null;
|
|
409
|
-
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) |
|
|
409
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | CommandMeta, handlerOrOptions?: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
410
410
|
args: string | null;
|
|
411
411
|
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | Record<string, unknown>, macroOptions?: Record<string, unknown>): TThis;
|
|
412
412
|
startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
413
413
|
"~": {
|
|
414
414
|
macros: MacroDefinitions;
|
|
415
|
-
commandsMeta
|
|
415
|
+
commandsMeta?: Map<string, unknown>;
|
|
416
416
|
Derives?: Record<string, object>;
|
|
417
417
|
};
|
|
418
418
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -423,7 +423,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
423
423
|
reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
424
424
|
"~": {
|
|
425
425
|
macros: MacroDefinitions;
|
|
426
|
-
commandsMeta
|
|
426
|
+
commandsMeta?: Map<string, unknown>;
|
|
427
427
|
Derives?: Record<string, object>;
|
|
428
428
|
};
|
|
429
429
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -431,7 +431,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
431
431
|
callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
432
432
|
"~": {
|
|
433
433
|
macros: MacroDefinitions;
|
|
434
|
-
commandsMeta
|
|
434
|
+
commandsMeta?: Map<string, unknown>;
|
|
435
435
|
Derives?: Record<string, object>;
|
|
436
436
|
};
|
|
437
437
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -441,7 +441,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
441
441
|
chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
442
442
|
"~": {
|
|
443
443
|
macros: MacroDefinitions;
|
|
444
|
-
commandsMeta
|
|
444
|
+
commandsMeta?: Map<string, unknown>;
|
|
445
445
|
Derives?: Record<string, object>;
|
|
446
446
|
};
|
|
447
447
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -451,7 +451,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
451
451
|
inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
452
452
|
"~": {
|
|
453
453
|
macros: MacroDefinitions;
|
|
454
|
-
commandsMeta
|
|
454
|
+
commandsMeta?: Map<string, unknown>;
|
|
455
455
|
Derives?: Record<string, object>;
|
|
456
456
|
};
|
|
457
457
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -465,7 +465,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
465
465
|
hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
466
466
|
"~": {
|
|
467
467
|
macros: MacroDefinitions;
|
|
468
|
-
commandsMeta
|
|
468
|
+
commandsMeta?: Map<string, unknown>;
|
|
469
469
|
Derives?: Record<string, object>;
|
|
470
470
|
};
|
|
471
471
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -475,19 +475,19 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
475
475
|
command<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
476
476
|
"~": {
|
|
477
477
|
macros: MacroDefinitions;
|
|
478
|
-
commandsMeta
|
|
478
|
+
commandsMeta?: Map<string, unknown>;
|
|
479
479
|
Derives?: Record<string, object>;
|
|
480
480
|
};
|
|
481
481
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
482
482
|
}>(this: TThis, command: MaybeArray<string>, handlerOrMeta: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
483
483
|
args: string | null;
|
|
484
|
-
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) |
|
|
484
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | CommandMeta, handlerOrOptions?: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
485
485
|
args: string | null;
|
|
486
486
|
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | Record<string, unknown>, macroOptions?: Record<string, unknown>): TThis;
|
|
487
487
|
startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
488
488
|
"~": {
|
|
489
489
|
macros: MacroDefinitions;
|
|
490
|
-
commandsMeta
|
|
490
|
+
commandsMeta?: Map<string, unknown>;
|
|
491
491
|
Derives?: Record<string, object>;
|
|
492
492
|
};
|
|
493
493
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -1010,6 +1010,22 @@ interface PollingStartOptions {
|
|
|
1010
1010
|
dropPendingUpdates?: boolean;
|
|
1011
1011
|
deleteWebhookOnConflict?: boolean;
|
|
1012
1012
|
}
|
|
1013
|
+
/** Shorthand strings for common BotCommandScope types */
|
|
1014
|
+
type ScopeShorthand = "default" | "all_private_chats" | "all_group_chats" | "all_chat_administrators";
|
|
1015
|
+
/**
|
|
1016
|
+
* Metadata for a bot command, used by `syncCommands()` to push
|
|
1017
|
+
* descriptions, localized names, and visibility scopes to the Telegram API.
|
|
1018
|
+
*/
|
|
1019
|
+
interface CommandMeta {
|
|
1020
|
+
/** Command description shown in the Telegram menu (1-256 chars) */
|
|
1021
|
+
description: string;
|
|
1022
|
+
/** Localized descriptions keyed by IETF language tag */
|
|
1023
|
+
locales?: Record<string, string>;
|
|
1024
|
+
/** Where this command is visible. Default: `["default"]` */
|
|
1025
|
+
scopes?: (TelegramBotCommandScope | ScopeShorthand)[];
|
|
1026
|
+
/** Exclude this command from `syncCommands()`. The handler still works. @default false */
|
|
1027
|
+
hide?: boolean;
|
|
1028
|
+
}
|
|
1013
1029
|
/** Minimal key-value storage interface compatible with `@gramio/storage` */
|
|
1014
1030
|
interface SyncStorage {
|
|
1015
1031
|
get(key: string): string | undefined | Promise<string | undefined>;
|
|
@@ -1487,7 +1503,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
1487
1503
|
command<TOptions extends HandlerOptions<ContextType<typeof this, "message">, Macros> = {}>(command: MaybeArray<string>, handler: (context: ContextType<typeof this, "message"> & {
|
|
1488
1504
|
args: string | null;
|
|
1489
1505
|
} & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): typeof this;
|
|
1490
|
-
command<TOptions extends HandlerOptions<ContextType<typeof this, "message">, Macros> = {}>(command: MaybeArray<string>, meta: CommandMeta
|
|
1506
|
+
command<TOptions extends HandlerOptions<ContextType<typeof this, "message">, Macros> = {}>(command: MaybeArray<string>, meta: CommandMeta, handler: (context: ContextType<typeof this, "message"> & {
|
|
1491
1507
|
args: string | null;
|
|
1492
1508
|
} & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): typeof this;
|
|
1493
1509
|
/**
|
|
@@ -1929,4 +1945,4 @@ declare function webhookHandler<Framework extends keyof typeof frameworks>(bot:
|
|
|
1929
1945
|
} ? (...args: Parameters<(typeof frameworks)[Framework]>) => ReturnType<ReturnType<(typeof frameworks)[Framework]>["response"]> : (...args: Parameters<(typeof frameworks)[Framework]>) => void;
|
|
1930
1946
|
|
|
1931
1947
|
export { AllowedUpdatesFilter, Bot, Composer, ErrorKind, Hooks, OPT_IN_TYPES, Plugin, TelegramError, Updates, buildAllowedUpdates, detectOptInUpdates, filters, mapEventToAllowedUpdates, webhookHandler };
|
|
1932
|
-
export type { AllowedUpdateName, AllowedUpdates, AnyBot, AnyPlugin, BotOptions, BotStartOptions, BotStartOptionsLongPolling, BotStartOptionsWebhook, CallbackQueryShorthandContext, DeriveDefinitions, ErrorDefinitions, Filter, Handler, MaybePromise, MaybeSuppressedParams, MaybeSuppressedReturn, PollingStartOptions, Suppress, SuppressedAPIMethodParams, SuppressedAPIMethodReturn, SuppressedAPIMethods, SyncCommandsOptions, SyncStorage, WebhookHandlerOptions, WebhookHandlerOptionsShouldWait, WebhookHandlers };
|
|
1948
|
+
export type { AllowedUpdateName, AllowedUpdates, AnyBot, AnyPlugin, BotOptions, BotStartOptions, BotStartOptionsLongPolling, BotStartOptionsWebhook, CallbackQueryShorthandContext, CommandMeta, DeriveDefinitions, ErrorDefinitions, Filter, Handler, MaybePromise, MaybeSuppressedParams, MaybeSuppressedReturn, PollingStartOptions, ScopeShorthand, Suppress, SuppressedAPIMethodParams, SuppressedAPIMethodReturn, SuppressedAPIMethods, SyncCommandsOptions, SyncStorage, WebhookHandlerOptions, WebhookHandlerOptionsShouldWait, WebhookHandlers };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,11 +8,11 @@ export * from '@gramio/files';
|
|
|
8
8
|
export * from '@gramio/format';
|
|
9
9
|
export * from '@gramio/keyboards';
|
|
10
10
|
import * as _gramio_types from '@gramio/types';
|
|
11
|
-
import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramReactionTypeEmojiEmoji, TelegramUser, APIMethodParams, APIMethodReturn, SetWebhookParams, TelegramUpdate,
|
|
11
|
+
import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramReactionTypeEmojiEmoji, TelegramUser, APIMethodParams, APIMethodReturn, TelegramBotCommandScope, 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,
|
|
15
|
-
export {
|
|
14
|
+
import { ComposerLike, MacroDefinitions, EventContextOf, EventComposer, MacroDef, Next, EventQueue, HandlerOptions, DeriveFromOptions } from '@gramio/composer';
|
|
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
|
/**
|
|
18
18
|
* Telegram Bot API top-level update type name.
|
|
@@ -174,7 +174,7 @@ type Ctx<K extends keyof ContextsMapping<AnyBot>> = InstanceType<ContextsMapping
|
|
|
174
174
|
type GramIOLike<T> = ComposerLike<T> & {
|
|
175
175
|
"~": {
|
|
176
176
|
macros: MacroDefinitions;
|
|
177
|
-
commandsMeta
|
|
177
|
+
commandsMeta?: Map<string, unknown>;
|
|
178
178
|
Derives?: Record<string, object>;
|
|
179
179
|
};
|
|
180
180
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): T;
|
|
@@ -348,7 +348,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
348
348
|
reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
349
349
|
"~": {
|
|
350
350
|
macros: MacroDefinitions;
|
|
351
|
-
commandsMeta
|
|
351
|
+
commandsMeta?: Map<string, unknown>;
|
|
352
352
|
Derives?: Record<string, object>;
|
|
353
353
|
};
|
|
354
354
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -356,7 +356,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
356
356
|
callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
357
357
|
"~": {
|
|
358
358
|
macros: MacroDefinitions;
|
|
359
|
-
commandsMeta
|
|
359
|
+
commandsMeta?: Map<string, unknown>;
|
|
360
360
|
Derives?: Record<string, object>;
|
|
361
361
|
};
|
|
362
362
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -366,7 +366,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
366
366
|
chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
367
367
|
"~": {
|
|
368
368
|
macros: MacroDefinitions;
|
|
369
|
-
commandsMeta
|
|
369
|
+
commandsMeta?: Map<string, unknown>;
|
|
370
370
|
Derives?: Record<string, object>;
|
|
371
371
|
};
|
|
372
372
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -376,7 +376,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
376
376
|
inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
377
377
|
"~": {
|
|
378
378
|
macros: MacroDefinitions;
|
|
379
|
-
commandsMeta
|
|
379
|
+
commandsMeta?: Map<string, unknown>;
|
|
380
380
|
Derives?: Record<string, object>;
|
|
381
381
|
};
|
|
382
382
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -390,7 +390,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
390
390
|
hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
391
391
|
"~": {
|
|
392
392
|
macros: MacroDefinitions;
|
|
393
|
-
commandsMeta
|
|
393
|
+
commandsMeta?: Map<string, unknown>;
|
|
394
394
|
Derives?: Record<string, object>;
|
|
395
395
|
};
|
|
396
396
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -400,19 +400,19 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
400
400
|
command<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
401
401
|
"~": {
|
|
402
402
|
macros: MacroDefinitions;
|
|
403
|
-
commandsMeta
|
|
403
|
+
commandsMeta?: Map<string, unknown>;
|
|
404
404
|
Derives?: Record<string, object>;
|
|
405
405
|
};
|
|
406
406
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
407
407
|
}>(this: TThis, command: MaybeArray<string>, handlerOrMeta: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
408
408
|
args: string | null;
|
|
409
|
-
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) |
|
|
409
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | CommandMeta, handlerOrOptions?: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
410
410
|
args: string | null;
|
|
411
411
|
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | Record<string, unknown>, macroOptions?: Record<string, unknown>): TThis;
|
|
412
412
|
startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
413
413
|
"~": {
|
|
414
414
|
macros: MacroDefinitions;
|
|
415
|
-
commandsMeta
|
|
415
|
+
commandsMeta?: Map<string, unknown>;
|
|
416
416
|
Derives?: Record<string, object>;
|
|
417
417
|
};
|
|
418
418
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -423,7 +423,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
423
423
|
reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
424
424
|
"~": {
|
|
425
425
|
macros: MacroDefinitions;
|
|
426
|
-
commandsMeta
|
|
426
|
+
commandsMeta?: Map<string, unknown>;
|
|
427
427
|
Derives?: Record<string, object>;
|
|
428
428
|
};
|
|
429
429
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -431,7 +431,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
431
431
|
callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
432
432
|
"~": {
|
|
433
433
|
macros: MacroDefinitions;
|
|
434
|
-
commandsMeta
|
|
434
|
+
commandsMeta?: Map<string, unknown>;
|
|
435
435
|
Derives?: Record<string, object>;
|
|
436
436
|
};
|
|
437
437
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -441,7 +441,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
441
441
|
chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
442
442
|
"~": {
|
|
443
443
|
macros: MacroDefinitions;
|
|
444
|
-
commandsMeta
|
|
444
|
+
commandsMeta?: Map<string, unknown>;
|
|
445
445
|
Derives?: Record<string, object>;
|
|
446
446
|
};
|
|
447
447
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -451,7 +451,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
451
451
|
inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
452
452
|
"~": {
|
|
453
453
|
macros: MacroDefinitions;
|
|
454
|
-
commandsMeta
|
|
454
|
+
commandsMeta?: Map<string, unknown>;
|
|
455
455
|
Derives?: Record<string, object>;
|
|
456
456
|
};
|
|
457
457
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -465,7 +465,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
465
465
|
hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
466
466
|
"~": {
|
|
467
467
|
macros: MacroDefinitions;
|
|
468
|
-
commandsMeta
|
|
468
|
+
commandsMeta?: Map<string, unknown>;
|
|
469
469
|
Derives?: Record<string, object>;
|
|
470
470
|
};
|
|
471
471
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -475,19 +475,19 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
475
475
|
command<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
476
476
|
"~": {
|
|
477
477
|
macros: MacroDefinitions;
|
|
478
|
-
commandsMeta
|
|
478
|
+
commandsMeta?: Map<string, unknown>;
|
|
479
479
|
Derives?: Record<string, object>;
|
|
480
480
|
};
|
|
481
481
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
482
482
|
}>(this: TThis, command: MaybeArray<string>, handlerOrMeta: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
483
483
|
args: string | null;
|
|
484
|
-
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) |
|
|
484
|
+
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | CommandMeta, handlerOrOptions?: ((context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
|
|
485
485
|
args: string | null;
|
|
486
486
|
} & _gramio_composer.EventContextOf<TThis, "message">) => unknown) | Record<string, unknown>, macroOptions?: Record<string, unknown>): TThis;
|
|
487
487
|
startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
|
|
488
488
|
"~": {
|
|
489
489
|
macros: MacroDefinitions;
|
|
490
|
-
commandsMeta
|
|
490
|
+
commandsMeta?: Map<string, unknown>;
|
|
491
491
|
Derives?: Record<string, object>;
|
|
492
492
|
};
|
|
493
493
|
chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
|
|
@@ -1010,6 +1010,22 @@ interface PollingStartOptions {
|
|
|
1010
1010
|
dropPendingUpdates?: boolean;
|
|
1011
1011
|
deleteWebhookOnConflict?: boolean;
|
|
1012
1012
|
}
|
|
1013
|
+
/** Shorthand strings for common BotCommandScope types */
|
|
1014
|
+
type ScopeShorthand = "default" | "all_private_chats" | "all_group_chats" | "all_chat_administrators";
|
|
1015
|
+
/**
|
|
1016
|
+
* Metadata for a bot command, used by `syncCommands()` to push
|
|
1017
|
+
* descriptions, localized names, and visibility scopes to the Telegram API.
|
|
1018
|
+
*/
|
|
1019
|
+
interface CommandMeta {
|
|
1020
|
+
/** Command description shown in the Telegram menu (1-256 chars) */
|
|
1021
|
+
description: string;
|
|
1022
|
+
/** Localized descriptions keyed by IETF language tag */
|
|
1023
|
+
locales?: Record<string, string>;
|
|
1024
|
+
/** Where this command is visible. Default: `["default"]` */
|
|
1025
|
+
scopes?: (TelegramBotCommandScope | ScopeShorthand)[];
|
|
1026
|
+
/** Exclude this command from `syncCommands()`. The handler still works. @default false */
|
|
1027
|
+
hide?: boolean;
|
|
1028
|
+
}
|
|
1013
1029
|
/** Minimal key-value storage interface compatible with `@gramio/storage` */
|
|
1014
1030
|
interface SyncStorage {
|
|
1015
1031
|
get(key: string): string | undefined | Promise<string | undefined>;
|
|
@@ -1487,7 +1503,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
1487
1503
|
command<TOptions extends HandlerOptions<ContextType<typeof this, "message">, Macros> = {}>(command: MaybeArray<string>, handler: (context: ContextType<typeof this, "message"> & {
|
|
1488
1504
|
args: string | null;
|
|
1489
1505
|
} & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): typeof this;
|
|
1490
|
-
command<TOptions extends HandlerOptions<ContextType<typeof this, "message">, Macros> = {}>(command: MaybeArray<string>, meta: CommandMeta
|
|
1506
|
+
command<TOptions extends HandlerOptions<ContextType<typeof this, "message">, Macros> = {}>(command: MaybeArray<string>, meta: CommandMeta, handler: (context: ContextType<typeof this, "message"> & {
|
|
1491
1507
|
args: string | null;
|
|
1492
1508
|
} & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): typeof this;
|
|
1493
1509
|
/**
|
|
@@ -1929,4 +1945,4 @@ declare function webhookHandler<Framework extends keyof typeof frameworks>(bot:
|
|
|
1929
1945
|
} ? (...args: Parameters<(typeof frameworks)[Framework]>) => ReturnType<ReturnType<(typeof frameworks)[Framework]>["response"]> : (...args: Parameters<(typeof frameworks)[Framework]>) => void;
|
|
1930
1946
|
|
|
1931
1947
|
export { AllowedUpdatesFilter, Bot, Composer, ErrorKind, Hooks, OPT_IN_TYPES, Plugin, TelegramError, Updates, buildAllowedUpdates, detectOptInUpdates, filters, mapEventToAllowedUpdates, webhookHandler };
|
|
1932
|
-
export type { AllowedUpdateName, AllowedUpdates, AnyBot, AnyPlugin, BotOptions, BotStartOptions, BotStartOptionsLongPolling, BotStartOptionsWebhook, CallbackQueryShorthandContext, DeriveDefinitions, ErrorDefinitions, Filter, Handler, MaybePromise, MaybeSuppressedParams, MaybeSuppressedReturn, PollingStartOptions, Suppress, SuppressedAPIMethodParams, SuppressedAPIMethodReturn, SuppressedAPIMethods, SyncCommandsOptions, SyncStorage, WebhookHandlerOptions, WebhookHandlerOptionsShouldWait, WebhookHandlers };
|
|
1948
|
+
export type { AllowedUpdateName, AllowedUpdates, AnyBot, AnyPlugin, BotOptions, BotStartOptions, BotStartOptionsLongPolling, BotStartOptionsWebhook, CallbackQueryShorthandContext, CommandMeta, DeriveDefinitions, ErrorDefinitions, Filter, Handler, MaybePromise, MaybeSuppressedParams, MaybeSuppressedReturn, PollingStartOptions, ScopeShorthand, Suppress, SuppressedAPIMethodParams, SuppressedAPIMethodReturn, SuppressedAPIMethods, SyncCommandsOptions, SyncStorage, WebhookHandlerOptions, WebhookHandlerOptionsShouldWait, WebhookHandlers };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gramio",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@gramio/callback-data": "^0.1.0",
|
|
68
|
-
"@gramio/composer": "
|
|
68
|
+
"@gramio/composer": "0.4.1",
|
|
69
69
|
"@gramio/contexts": "^0.5.0",
|
|
70
70
|
"@gramio/files": "^0.3.2",
|
|
71
71
|
"@gramio/format": "^0.5.0",
|