gramio 0.2.6 → 0.3.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/README.md +1 -1
- package/dist/index.cjs +0 -80
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +0 -80
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/package.json +13 -9
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
[](https://core.telegram.org/bots/api)
|
|
6
6
|
[](https://www.npmjs.org/package/gramio)
|
|
7
7
|
[](https://www.npmjs.org/package/gramio)
|
|
8
8
|
[](https://jsr.io/@gramio/core)
|
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,6 @@ var contexts = require('@gramio/contexts');
|
|
|
7
7
|
var files = require('@gramio/files');
|
|
8
8
|
var format = require('@gramio/format');
|
|
9
9
|
var debug = require('debug');
|
|
10
|
-
var inspectable = require('inspectable');
|
|
11
10
|
var utils = require('./utils-BbVj3DtT.cjs');
|
|
12
11
|
var middlewareIo = require('middleware-io');
|
|
13
12
|
var keyboards = require('@gramio/keyboards');
|
|
@@ -79,44 +78,6 @@ class Composer {
|
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
var __create$1 = Object.create;
|
|
83
|
-
var __defProp$1 = Object.defineProperty;
|
|
84
|
-
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
85
|
-
var __knownSymbol$1 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
86
|
-
var __typeError$1 = (msg) => {
|
|
87
|
-
throw TypeError(msg);
|
|
88
|
-
};
|
|
89
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
90
|
-
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
91
|
-
var __decoratorStart$1 = (base) => [, , , __create$1(null)];
|
|
92
|
-
var __decoratorStrings$1 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
93
|
-
var __expectFn$1 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$1("Function expected") : fn;
|
|
94
|
-
var __decoratorContext$1 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$1[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$1("Already initialized") : fns.push(__expectFn$1(fn || null)) });
|
|
95
|
-
var __decoratorMetadata$1 = (array, target) => __defNormalProp$1(target, __knownSymbol$1("metadata"), array[3]);
|
|
96
|
-
var __runInitializers$1 = (array, flags, self, value) => {
|
|
97
|
-
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) fns[i].call(self) ;
|
|
98
|
-
return value;
|
|
99
|
-
};
|
|
100
|
-
var __decorateElement$1 = (array, flags, name, decorators, target, extra) => {
|
|
101
|
-
var it, done, ctx, k = flags & 7, p = false;
|
|
102
|
-
var j = 0;
|
|
103
|
-
var extraInitializers = array[j] || (array[j] = []);
|
|
104
|
-
var desc = k && ((target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc$1(target , name));
|
|
105
|
-
__name$1(target, name);
|
|
106
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
107
|
-
ctx = __decoratorContext$1(k, name, done = {}, array[3], extraInitializers);
|
|
108
|
-
it = (0, decorators[i])(target, ctx), done._ = 1;
|
|
109
|
-
__expectFn$1(it) && (target = it);
|
|
110
|
-
}
|
|
111
|
-
return __decoratorMetadata$1(array, target), desc && __defProp$1(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
112
|
-
};
|
|
113
|
-
var _Plugin_decorators, _init$1;
|
|
114
|
-
_Plugin_decorators = [inspectable.Inspectable({
|
|
115
|
-
serialize: (plugin) => ({
|
|
116
|
-
name: plugin._.name,
|
|
117
|
-
dependencies: plugin._.dependencies
|
|
118
|
-
})
|
|
119
|
-
})];
|
|
120
81
|
class Plugin {
|
|
121
82
|
/**
|
|
122
83
|
* @internal
|
|
@@ -291,9 +252,6 @@ class Plugin {
|
|
|
291
252
|
return this;
|
|
292
253
|
}
|
|
293
254
|
}
|
|
294
|
-
_init$1 = __decoratorStart$1();
|
|
295
|
-
Plugin = __decorateElement$1(_init$1, 0, "Plugin", _Plugin_decorators, Plugin);
|
|
296
|
-
__runInitializers$1(_init$1, 1, Plugin);
|
|
297
255
|
|
|
298
256
|
class UpdateQueue {
|
|
299
257
|
updateQueue = [];
|
|
@@ -413,43 +371,8 @@ class Updates {
|
|
|
413
371
|
}
|
|
414
372
|
}
|
|
415
373
|
|
|
416
|
-
var __create = Object.create;
|
|
417
|
-
var __defProp = Object.defineProperty;
|
|
418
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
419
|
-
var __knownSymbol = (name2, symbol) => (symbol = Symbol[name2]) ? symbol : Symbol.for("Symbol." + name2);
|
|
420
|
-
var __typeError = (msg) => {
|
|
421
|
-
throw TypeError(msg);
|
|
422
|
-
};
|
|
423
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
424
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
425
|
-
var __decoratorStart = (base) => [, , , __create(null)];
|
|
426
|
-
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
427
|
-
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
428
|
-
var __decoratorContext = (kind, name2, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name: name2, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
429
|
-
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
430
|
-
var __runInitializers = (array, flags, self, value) => {
|
|
431
|
-
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) fns[i].call(self) ;
|
|
432
|
-
return value;
|
|
433
|
-
};
|
|
434
|
-
var __decorateElement = (array, flags, name2, decorators, target, extra) => {
|
|
435
|
-
var it, done, ctx, k = flags & 7, p = false;
|
|
436
|
-
var j = 0;
|
|
437
|
-
var extraInitializers = array[j] || (array[j] = []);
|
|
438
|
-
var desc = k && ((target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(target , name2));
|
|
439
|
-
__name(target, name2);
|
|
440
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
441
|
-
ctx = __decoratorContext(k, name2, done = {}, array[3], extraInitializers);
|
|
442
|
-
it = (0, decorators[i])(target, ctx), done._ = 1;
|
|
443
|
-
__expectFn(it) && (target = it);
|
|
444
|
-
}
|
|
445
|
-
return __decoratorMetadata(array, target), desc && __defProp(target, name2, desc), p ? k ^ 4 ? extra : desc : target;
|
|
446
|
-
};
|
|
447
|
-
var _Bot_decorators, _init;
|
|
448
374
|
const $debugger = debug("gramio");
|
|
449
375
|
const debug$api = $debugger.extend("api");
|
|
450
|
-
_Bot_decorators = [inspectable.Inspectable({
|
|
451
|
-
serialize: () => ({})
|
|
452
|
-
})];
|
|
453
376
|
class Bot {
|
|
454
377
|
/** @deprecated use `~` instead*/
|
|
455
378
|
_ = {
|
|
@@ -1142,9 +1065,6 @@ class Bot {
|
|
|
1142
1065
|
});
|
|
1143
1066
|
}
|
|
1144
1067
|
}
|
|
1145
|
-
_init = __decoratorStart();
|
|
1146
|
-
Bot = __decorateElement(_init, 0, "Bot", _Bot_decorators, Bot);
|
|
1147
|
-
__runInitializers(_init, 1, Bot);
|
|
1148
1068
|
|
|
1149
1069
|
const SECRET_TOKEN_HEADER = "X-Telegram-Bot-Api-Secret-Token";
|
|
1150
1070
|
const WRONG_TOKEN_ERROR = "secret token is invalid";
|
package/dist/index.d.cts
CHANGED
|
@@ -713,7 +713,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
713
713
|
* })
|
|
714
714
|
* ```
|
|
715
715
|
*/
|
|
716
|
-
onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<typeof this, T
|
|
716
|
+
onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<typeof this, T>>): this;
|
|
717
717
|
onError(handler: Hooks.OnError<Errors, Context<typeof this> & Derives["global"]>): this;
|
|
718
718
|
/**
|
|
719
719
|
* Derive some data to handlers
|
|
@@ -822,7 +822,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
822
822
|
onResponseError<Methods extends keyof APIMethods, Handler extends Hooks.OnResponseError<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
|
|
823
823
|
onResponseError(handler: Hooks.OnResponseError): this;
|
|
824
824
|
/** Register handler to one or many Updates */
|
|
825
|
-
on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<typeof this, T
|
|
825
|
+
on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<typeof this, T>>): this;
|
|
826
826
|
/** Register handler to any Updates */
|
|
827
827
|
use(handler: Handler<Context<typeof this> & Derives["global"]>): this;
|
|
828
828
|
/**
|
|
@@ -867,7 +867,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
867
867
|
* });
|
|
868
868
|
* ```
|
|
869
869
|
* */
|
|
870
|
-
reaction(trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: ContextType<typeof this, "message_reaction">
|
|
870
|
+
reaction(trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: ContextType<typeof this, "message_reaction">) => unknown): this;
|
|
871
871
|
/**
|
|
872
872
|
* Register handler to `callback_query` event
|
|
873
873
|
*
|
|
@@ -893,7 +893,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
893
893
|
*/
|
|
894
894
|
callbackQuery<Trigger extends CallbackData | string | RegExp>(trigger: Trigger, handler: (context: CallbackQueryShorthandContext<typeof this, Trigger>) => unknown): this;
|
|
895
895
|
/** Register handler to `chosen_inline_result` update */
|
|
896
|
-
chosenInlineResult<Ctx = ContextType<typeof this, "chosen_inline_result"
|
|
896
|
+
chosenInlineResult<Ctx = ContextType<typeof this, "chosen_inline_result">>(trigger: RegExp | string | ((context: Ctx) => boolean), handler: (context: Ctx & {
|
|
897
897
|
args: RegExpMatchArray | null;
|
|
898
898
|
}) => unknown): this;
|
|
899
899
|
/**
|
|
@@ -931,10 +931,10 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
931
931
|
* );
|
|
932
932
|
* ```
|
|
933
933
|
* */
|
|
934
|
-
inlineQuery<Ctx = ContextType<typeof this, "inline_query"
|
|
934
|
+
inlineQuery<Ctx = ContextType<typeof this, "inline_query">>(trigger: RegExp | string | ((context: Ctx) => boolean), handler: (context: Ctx & {
|
|
935
935
|
args: RegExpMatchArray | null;
|
|
936
936
|
}) => unknown, options?: {
|
|
937
|
-
onResult?: (context: ContextType<Bot, "chosen_inline_result"> &
|
|
937
|
+
onResult?: (context: ContextType<Bot, "chosen_inline_result"> & {
|
|
938
938
|
args: RegExpMatchArray | null;
|
|
939
939
|
}) => unknown;
|
|
940
940
|
}): this;
|
|
@@ -945,7 +945,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
945
945
|
* if (context.args) await context.send(`Params ${context.args[1]}`);
|
|
946
946
|
* });
|
|
947
947
|
*/
|
|
948
|
-
hears<Ctx = ContextType<typeof this, "message"
|
|
948
|
+
hears<Ctx = ContextType<typeof this, "message">, Trigger extends RegExp | string | ((context: Ctx) => boolean) = RegExp | string | ((context: Ctx) => boolean)>(trigger: Trigger, handler: (context: Ctx & {
|
|
949
949
|
args: RegExpMatchArray | null;
|
|
950
950
|
}) => unknown): this;
|
|
951
951
|
/**
|
|
@@ -955,7 +955,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
955
955
|
* return context.send(`You message is /start ${context.args}`);
|
|
956
956
|
* });
|
|
957
957
|
*/
|
|
958
|
-
command(command: string, handler: (context: ContextType<typeof this, "message"> &
|
|
958
|
+
command(command: string, handler: (context: ContextType<typeof this, "message"> & {
|
|
959
959
|
args: string | null;
|
|
960
960
|
}) => unknown, options?: Omit<SetMyCommandsParams, "commands"> & Omit<TelegramBotCommand, "command">): this;
|
|
961
961
|
/** Currently not isolated!!! */
|
package/dist/index.d.ts
CHANGED
|
@@ -713,7 +713,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
713
713
|
* })
|
|
714
714
|
* ```
|
|
715
715
|
*/
|
|
716
|
-
onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<typeof this, T
|
|
716
|
+
onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<typeof this, T>>): this;
|
|
717
717
|
onError(handler: Hooks.OnError<Errors, Context<typeof this> & Derives["global"]>): this;
|
|
718
718
|
/**
|
|
719
719
|
* Derive some data to handlers
|
|
@@ -822,7 +822,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
822
822
|
onResponseError<Methods extends keyof APIMethods, Handler extends Hooks.OnResponseError<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
|
|
823
823
|
onResponseError(handler: Hooks.OnResponseError): this;
|
|
824
824
|
/** Register handler to one or many Updates */
|
|
825
|
-
on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<typeof this, T
|
|
825
|
+
on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<typeof this, T>>): this;
|
|
826
826
|
/** Register handler to any Updates */
|
|
827
827
|
use(handler: Handler<Context<typeof this> & Derives["global"]>): this;
|
|
828
828
|
/**
|
|
@@ -867,7 +867,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
867
867
|
* });
|
|
868
868
|
* ```
|
|
869
869
|
* */
|
|
870
|
-
reaction(trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: ContextType<typeof this, "message_reaction">
|
|
870
|
+
reaction(trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: ContextType<typeof this, "message_reaction">) => unknown): this;
|
|
871
871
|
/**
|
|
872
872
|
* Register handler to `callback_query` event
|
|
873
873
|
*
|
|
@@ -893,7 +893,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
893
893
|
*/
|
|
894
894
|
callbackQuery<Trigger extends CallbackData | string | RegExp>(trigger: Trigger, handler: (context: CallbackQueryShorthandContext<typeof this, Trigger>) => unknown): this;
|
|
895
895
|
/** Register handler to `chosen_inline_result` update */
|
|
896
|
-
chosenInlineResult<Ctx = ContextType<typeof this, "chosen_inline_result"
|
|
896
|
+
chosenInlineResult<Ctx = ContextType<typeof this, "chosen_inline_result">>(trigger: RegExp | string | ((context: Ctx) => boolean), handler: (context: Ctx & {
|
|
897
897
|
args: RegExpMatchArray | null;
|
|
898
898
|
}) => unknown): this;
|
|
899
899
|
/**
|
|
@@ -931,10 +931,10 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
931
931
|
* );
|
|
932
932
|
* ```
|
|
933
933
|
* */
|
|
934
|
-
inlineQuery<Ctx = ContextType<typeof this, "inline_query"
|
|
934
|
+
inlineQuery<Ctx = ContextType<typeof this, "inline_query">>(trigger: RegExp | string | ((context: Ctx) => boolean), handler: (context: Ctx & {
|
|
935
935
|
args: RegExpMatchArray | null;
|
|
936
936
|
}) => unknown, options?: {
|
|
937
|
-
onResult?: (context: ContextType<Bot, "chosen_inline_result"> &
|
|
937
|
+
onResult?: (context: ContextType<Bot, "chosen_inline_result"> & {
|
|
938
938
|
args: RegExpMatchArray | null;
|
|
939
939
|
}) => unknown;
|
|
940
940
|
}): this;
|
|
@@ -945,7 +945,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
945
945
|
* if (context.args) await context.send(`Params ${context.args[1]}`);
|
|
946
946
|
* });
|
|
947
947
|
*/
|
|
948
|
-
hears<Ctx = ContextType<typeof this, "message"
|
|
948
|
+
hears<Ctx = ContextType<typeof this, "message">, Trigger extends RegExp | string | ((context: Ctx) => boolean) = RegExp | string | ((context: Ctx) => boolean)>(trigger: Trigger, handler: (context: Ctx & {
|
|
949
949
|
args: RegExpMatchArray | null;
|
|
950
950
|
}) => unknown): this;
|
|
951
951
|
/**
|
|
@@ -955,7 +955,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
|
|
|
955
955
|
* return context.send(`You message is /start ${context.args}`);
|
|
956
956
|
* });
|
|
957
957
|
*/
|
|
958
|
-
command(command: string, handler: (context: ContextType<typeof this, "message"> &
|
|
958
|
+
command(command: string, handler: (context: ContextType<typeof this, "message"> & {
|
|
959
959
|
args: string | null;
|
|
960
960
|
}) => unknown, options?: Omit<SetMyCommandsParams, "commands"> & Omit<TelegramBotCommand, "command">): this;
|
|
961
961
|
/** Currently not isolated!!! */
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@ export * from '@gramio/files';
|
|
|
9
9
|
import { FormattableMap } from '@gramio/format';
|
|
10
10
|
export * from '@gramio/format';
|
|
11
11
|
import debug from 'debug';
|
|
12
|
-
import { Inspectable } from 'inspectable';
|
|
13
12
|
import { E as ErrorKind, s as sleep, T as TelegramError, I as IS_BUN, a as simplifyObject, w as withRetries } from './utils-DTFsIb2X.js';
|
|
14
13
|
import { Composer as Composer$1, noopNext } from 'middleware-io';
|
|
15
14
|
export * from '@gramio/keyboards';
|
|
@@ -81,44 +80,6 @@ class Composer {
|
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
var __create$1 = Object.create;
|
|
85
|
-
var __defProp$1 = Object.defineProperty;
|
|
86
|
-
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
87
|
-
var __knownSymbol$1 = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
88
|
-
var __typeError$1 = (msg) => {
|
|
89
|
-
throw TypeError(msg);
|
|
90
|
-
};
|
|
91
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
92
|
-
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
93
|
-
var __decoratorStart$1 = (base) => [, , , __create$1(null)];
|
|
94
|
-
var __decoratorStrings$1 = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
95
|
-
var __expectFn$1 = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError$1("Function expected") : fn;
|
|
96
|
-
var __decoratorContext$1 = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings$1[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError$1("Already initialized") : fns.push(__expectFn$1(fn || null)) });
|
|
97
|
-
var __decoratorMetadata$1 = (array, target) => __defNormalProp$1(target, __knownSymbol$1("metadata"), array[3]);
|
|
98
|
-
var __runInitializers$1 = (array, flags, self, value) => {
|
|
99
|
-
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) fns[i].call(self) ;
|
|
100
|
-
return value;
|
|
101
|
-
};
|
|
102
|
-
var __decorateElement$1 = (array, flags, name, decorators, target, extra) => {
|
|
103
|
-
var it, done, ctx, k = flags & 7, p = false;
|
|
104
|
-
var j = 0;
|
|
105
|
-
var extraInitializers = array[j] || (array[j] = []);
|
|
106
|
-
var desc = k && ((target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc$1(target , name));
|
|
107
|
-
__name$1(target, name);
|
|
108
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
109
|
-
ctx = __decoratorContext$1(k, name, done = {}, array[3], extraInitializers);
|
|
110
|
-
it = (0, decorators[i])(target, ctx), done._ = 1;
|
|
111
|
-
__expectFn$1(it) && (target = it);
|
|
112
|
-
}
|
|
113
|
-
return __decoratorMetadata$1(array, target), desc && __defProp$1(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
114
|
-
};
|
|
115
|
-
var _Plugin_decorators, _init$1;
|
|
116
|
-
_Plugin_decorators = [Inspectable({
|
|
117
|
-
serialize: (plugin) => ({
|
|
118
|
-
name: plugin._.name,
|
|
119
|
-
dependencies: plugin._.dependencies
|
|
120
|
-
})
|
|
121
|
-
})];
|
|
122
83
|
class Plugin {
|
|
123
84
|
/**
|
|
124
85
|
* @internal
|
|
@@ -293,9 +254,6 @@ class Plugin {
|
|
|
293
254
|
return this;
|
|
294
255
|
}
|
|
295
256
|
}
|
|
296
|
-
_init$1 = __decoratorStart$1();
|
|
297
|
-
Plugin = __decorateElement$1(_init$1, 0, "Plugin", _Plugin_decorators, Plugin);
|
|
298
|
-
__runInitializers$1(_init$1, 1, Plugin);
|
|
299
257
|
|
|
300
258
|
class UpdateQueue {
|
|
301
259
|
updateQueue = [];
|
|
@@ -415,43 +373,8 @@ class Updates {
|
|
|
415
373
|
}
|
|
416
374
|
}
|
|
417
375
|
|
|
418
|
-
var __create = Object.create;
|
|
419
|
-
var __defProp = Object.defineProperty;
|
|
420
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
421
|
-
var __knownSymbol = (name2, symbol) => (symbol = Symbol[name2]) ? symbol : Symbol.for("Symbol." + name2);
|
|
422
|
-
var __typeError = (msg) => {
|
|
423
|
-
throw TypeError(msg);
|
|
424
|
-
};
|
|
425
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
426
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
427
|
-
var __decoratorStart = (base) => [, , , __create(null)];
|
|
428
|
-
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
429
|
-
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
430
|
-
var __decoratorContext = (kind, name2, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name: name2, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
431
|
-
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
432
|
-
var __runInitializers = (array, flags, self, value) => {
|
|
433
|
-
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) fns[i].call(self) ;
|
|
434
|
-
return value;
|
|
435
|
-
};
|
|
436
|
-
var __decorateElement = (array, flags, name2, decorators, target, extra) => {
|
|
437
|
-
var it, done, ctx, k = flags & 7, p = false;
|
|
438
|
-
var j = 0;
|
|
439
|
-
var extraInitializers = array[j] || (array[j] = []);
|
|
440
|
-
var desc = k && ((target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(target , name2));
|
|
441
|
-
__name(target, name2);
|
|
442
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
443
|
-
ctx = __decoratorContext(k, name2, done = {}, array[3], extraInitializers);
|
|
444
|
-
it = (0, decorators[i])(target, ctx), done._ = 1;
|
|
445
|
-
__expectFn(it) && (target = it);
|
|
446
|
-
}
|
|
447
|
-
return __decoratorMetadata(array, target), desc && __defProp(target, name2, desc), p ? k ^ 4 ? extra : desc : target;
|
|
448
|
-
};
|
|
449
|
-
var _Bot_decorators, _init;
|
|
450
376
|
const $debugger = debug("gramio");
|
|
451
377
|
const debug$api = $debugger.extend("api");
|
|
452
|
-
_Bot_decorators = [Inspectable({
|
|
453
|
-
serialize: () => ({})
|
|
454
|
-
})];
|
|
455
378
|
class Bot {
|
|
456
379
|
/** @deprecated use `~` instead*/
|
|
457
380
|
_ = {
|
|
@@ -1144,9 +1067,6 @@ class Bot {
|
|
|
1144
1067
|
});
|
|
1145
1068
|
}
|
|
1146
1069
|
}
|
|
1147
|
-
_init = __decoratorStart();
|
|
1148
|
-
Bot = __decorateElement(_init, 0, "Bot", _Bot_decorators, Bot);
|
|
1149
|
-
__runInitializers(_init, 1, Bot);
|
|
1150
1070
|
|
|
1151
1071
|
const SECRET_TOKEN_HEADER = "X-Telegram-Bot-Api-Secret-Token";
|
|
1152
1072
|
const WRONG_TOKEN_ERROR = "secret token is invalid";
|
package/dist/utils.d.cts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Pack of useful utilities for Telegram Bot API and GramIO
|
|
5
5
|
*/
|
|
6
|
-
declare function withRetries<Result
|
|
6
|
+
declare function withRetries<Result>(resultPromise: () => Promise<Result>): Promise<Result>;
|
|
7
7
|
|
|
8
8
|
export { withRetries };
|
package/dist/utils.d.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Pack of useful utilities for Telegram Bot API and GramIO
|
|
5
5
|
*/
|
|
6
|
-
declare function withRetries<Result
|
|
6
|
+
declare function withRetries<Result>(resultPromise: () => Promise<Result>): Promise<Result>;
|
|
7
7
|
|
|
8
8
|
export { withRetries };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gramio",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
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",
|
|
@@ -37,7 +37,12 @@
|
|
|
37
37
|
"types",
|
|
38
38
|
"client",
|
|
39
39
|
"webhook",
|
|
40
|
-
"long-polling"
|
|
40
|
+
"long-polling",
|
|
41
|
+
"files",
|
|
42
|
+
"plugins",
|
|
43
|
+
"format",
|
|
44
|
+
"contexts",
|
|
45
|
+
"files"
|
|
41
46
|
],
|
|
42
47
|
"scripts": {
|
|
43
48
|
"type": "tsc --noEmit",
|
|
@@ -51,20 +56,19 @@
|
|
|
51
56
|
"license": "MIT",
|
|
52
57
|
"devDependencies": {
|
|
53
58
|
"@biomejs/biome": "1.9.4",
|
|
54
|
-
"@types/bun": "^1.2.
|
|
59
|
+
"@types/bun": "^1.2.9",
|
|
55
60
|
"@types/debug": "^4.1.12",
|
|
56
61
|
"pkgroll": "^2.12.1",
|
|
57
62
|
"typescript": "^5.8.3"
|
|
58
63
|
},
|
|
59
64
|
"dependencies": {
|
|
60
65
|
"@gramio/callback-data": "^0.0.3",
|
|
61
|
-
"@gramio/contexts": "^0.
|
|
62
|
-
"@gramio/files": "^0.
|
|
63
|
-
"@gramio/format": "^0.
|
|
64
|
-
"@gramio/keyboards": "^1.1
|
|
65
|
-
"@gramio/types": "^
|
|
66
|
+
"@gramio/contexts": "^0.2.0",
|
|
67
|
+
"@gramio/files": "^0.3.0",
|
|
68
|
+
"@gramio/format": "^0.2.0",
|
|
69
|
+
"@gramio/keyboards": "^1.2.1",
|
|
70
|
+
"@gramio/types": "^9.0.1",
|
|
66
71
|
"debug": "^4.4.0",
|
|
67
|
-
"inspectable": "^3.0.2",
|
|
68
72
|
"middleware-io": "^2.8.1"
|
|
69
73
|
},
|
|
70
74
|
"files": ["dist"]
|