gramio 0.4.2 → 0.4.3
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 +13 -13
- package/dist/index.d.ts +13 -13
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CallbackData } from '@gramio/callback-data';
|
|
2
2
|
export * from '@gramio/callback-data';
|
|
3
|
-
import { Context, UpdateName, ContextType,
|
|
3
|
+
import { Context, UpdateName, ContextType, BotLike, Attachment } from '@gramio/contexts';
|
|
4
4
|
export * from '@gramio/contexts';
|
|
5
5
|
import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramUser, APIMethodParams, APIMethodReturn, SetWebhookParams, TelegramUpdate, TelegramReactionTypeEmojiEmoji, SetMyCommandsParams, TelegramBotCommand } from '@gramio/types';
|
|
6
6
|
export * from '@gramio/types';
|
|
@@ -111,11 +111,11 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
111
111
|
/** Composer */
|
|
112
112
|
composer: Composer;
|
|
113
113
|
/** Store plugin preRequests hooks */
|
|
114
|
-
preRequests: [Hooks.PreRequest<any>, MaybeArray
|
|
114
|
+
preRequests: [Hooks.PreRequest<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
115
115
|
/** Store plugin onResponses hooks */
|
|
116
|
-
onResponses: [Hooks.OnResponse<any>, MaybeArray
|
|
116
|
+
onResponses: [Hooks.OnResponse<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
117
117
|
/** Store plugin onResponseErrors hooks */
|
|
118
|
-
onResponseErrors: [Hooks.OnResponseError<any>, MaybeArray
|
|
118
|
+
onResponseErrors: [Hooks.OnResponseError<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
119
119
|
/**
|
|
120
120
|
* Store plugin groups
|
|
121
121
|
*
|
|
@@ -147,11 +147,11 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
147
147
|
/** Composer */
|
|
148
148
|
composer: Composer;
|
|
149
149
|
/** Store plugin preRequests hooks */
|
|
150
|
-
preRequests: [Hooks.PreRequest<any>, MaybeArray
|
|
150
|
+
preRequests: [Hooks.PreRequest<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
151
151
|
/** Store plugin onResponses hooks */
|
|
152
|
-
onResponses: [Hooks.OnResponse<any>, MaybeArray
|
|
152
|
+
onResponses: [Hooks.OnResponse<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
153
153
|
/** Store plugin onResponseErrors hooks */
|
|
154
|
-
onResponseErrors: [Hooks.OnResponseError<any>, MaybeArray
|
|
154
|
+
onResponseErrors: [Hooks.OnResponseError<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
155
155
|
/**
|
|
156
156
|
* Store plugin groups
|
|
157
157
|
*
|
|
@@ -203,7 +203,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
203
203
|
derive<Handler extends Hooks.Derive<Context<BotLike> & Derives["global"]>>(handler: Handler): Plugin<Errors, Derives & {
|
|
204
204
|
global: Awaited<ReturnType<Handler>>;
|
|
205
205
|
}>;
|
|
206
|
-
derive<Update extends UpdateName, Handler extends Hooks.Derive<ContextType<BotLike, Update> & Derives["global"] & Derives[Update]>>(updateName: MaybeArray
|
|
206
|
+
derive<Update extends UpdateName, Handler extends Hooks.Derive<ContextType<BotLike, Update> & Derives["global"] & Derives[Update]>>(updateName: MaybeArray<Update>, handler: Handler): Plugin<Errors, Derives & {
|
|
207
207
|
[K in Update]: Awaited<ReturnType<Handler>>;
|
|
208
208
|
}>;
|
|
209
209
|
decorate<Value extends Record<string, any>>(value: Value): Plugin<Errors, Derives & {
|
|
@@ -217,7 +217,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
217
217
|
};
|
|
218
218
|
}>;
|
|
219
219
|
/** Register handler to one or many Updates */
|
|
220
|
-
on<T extends UpdateName>(updateName: MaybeArray
|
|
220
|
+
on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<BotLike, T> & Derives["global"] & Derives[T]>): this;
|
|
221
221
|
/** Register handler to any Updates */
|
|
222
222
|
use(handler: Handler<Context<BotLike> & Derives["global"]>): this;
|
|
223
223
|
/**
|
|
@@ -240,21 +240,21 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
240
240
|
*
|
|
241
241
|
* [Documentation](https://gramio.dev/hooks/pre-request.html)
|
|
242
242
|
* */
|
|
243
|
-
preRequest<Methods extends keyof APIMethods, Handler extends Hooks.PreRequest<Methods>>(methods: MaybeArray
|
|
243
|
+
preRequest<Methods extends keyof APIMethods, Handler extends Hooks.PreRequest<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
|
|
244
244
|
preRequest(handler: Hooks.PreRequest): this;
|
|
245
245
|
/**
|
|
246
246
|
* This hook called when API return successful response
|
|
247
247
|
*
|
|
248
248
|
* [Documentation](https://gramio.dev/hooks/on-response.html)
|
|
249
249
|
* */
|
|
250
|
-
onResponse<Methods extends keyof APIMethods, Handler extends Hooks.OnResponse<Methods>>(methods: MaybeArray
|
|
250
|
+
onResponse<Methods extends keyof APIMethods, Handler extends Hooks.OnResponse<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
|
|
251
251
|
onResponse(handler: Hooks.OnResponse): this;
|
|
252
252
|
/**
|
|
253
253
|
* This hook called when API return an error
|
|
254
254
|
*
|
|
255
255
|
* [Documentation](https://gramio.dev/hooks/on-response-error.html)
|
|
256
256
|
* */
|
|
257
|
-
onResponseError<Methods extends keyof APIMethods, Handler extends Hooks.OnResponseError<Methods>>(methods: MaybeArray
|
|
257
|
+
onResponseError<Methods extends keyof APIMethods, Handler extends Hooks.OnResponseError<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
|
|
258
258
|
onResponseError(handler: Hooks.OnResponseError): this;
|
|
259
259
|
/**
|
|
260
260
|
* This hook called when the bot is `started`.
|
|
@@ -307,7 +307,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
307
307
|
* })
|
|
308
308
|
* ```
|
|
309
309
|
*/
|
|
310
|
-
onError<T extends UpdateName>(updateName: MaybeArray
|
|
310
|
+
onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<BotLike, T> & Derives["global"] & Derives[T]>): this;
|
|
311
311
|
onError(handler: Hooks.OnError<Errors, Context<BotLike> & Derives["global"]>): this;
|
|
312
312
|
/**
|
|
313
313
|
* ! ** At the moment, it can only pick up types** */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CallbackData } from '@gramio/callback-data';
|
|
2
2
|
export * from '@gramio/callback-data';
|
|
3
|
-
import { Context, UpdateName, ContextType,
|
|
3
|
+
import { Context, UpdateName, ContextType, BotLike, Attachment } from '@gramio/contexts';
|
|
4
4
|
export * from '@gramio/contexts';
|
|
5
5
|
import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramUser, APIMethodParams, APIMethodReturn, SetWebhookParams, TelegramUpdate, TelegramReactionTypeEmojiEmoji, SetMyCommandsParams, TelegramBotCommand } from '@gramio/types';
|
|
6
6
|
export * from '@gramio/types';
|
|
@@ -111,11 +111,11 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
111
111
|
/** Composer */
|
|
112
112
|
composer: Composer;
|
|
113
113
|
/** Store plugin preRequests hooks */
|
|
114
|
-
preRequests: [Hooks.PreRequest<any>, MaybeArray
|
|
114
|
+
preRequests: [Hooks.PreRequest<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
115
115
|
/** Store plugin onResponses hooks */
|
|
116
|
-
onResponses: [Hooks.OnResponse<any>, MaybeArray
|
|
116
|
+
onResponses: [Hooks.OnResponse<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
117
117
|
/** Store plugin onResponseErrors hooks */
|
|
118
|
-
onResponseErrors: [Hooks.OnResponseError<any>, MaybeArray
|
|
118
|
+
onResponseErrors: [Hooks.OnResponseError<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
119
119
|
/**
|
|
120
120
|
* Store plugin groups
|
|
121
121
|
*
|
|
@@ -147,11 +147,11 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
147
147
|
/** Composer */
|
|
148
148
|
composer: Composer;
|
|
149
149
|
/** Store plugin preRequests hooks */
|
|
150
|
-
preRequests: [Hooks.PreRequest<any>, MaybeArray
|
|
150
|
+
preRequests: [Hooks.PreRequest<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
151
151
|
/** Store plugin onResponses hooks */
|
|
152
|
-
onResponses: [Hooks.OnResponse<any>, MaybeArray
|
|
152
|
+
onResponses: [Hooks.OnResponse<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
153
153
|
/** Store plugin onResponseErrors hooks */
|
|
154
|
-
onResponseErrors: [Hooks.OnResponseError<any>, MaybeArray
|
|
154
|
+
onResponseErrors: [Hooks.OnResponseError<any>, MaybeArray<keyof APIMethods> | undefined][];
|
|
155
155
|
/**
|
|
156
156
|
* Store plugin groups
|
|
157
157
|
*
|
|
@@ -203,7 +203,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
203
203
|
derive<Handler extends Hooks.Derive<Context<BotLike> & Derives["global"]>>(handler: Handler): Plugin<Errors, Derives & {
|
|
204
204
|
global: Awaited<ReturnType<Handler>>;
|
|
205
205
|
}>;
|
|
206
|
-
derive<Update extends UpdateName, Handler extends Hooks.Derive<ContextType<BotLike, Update> & Derives["global"] & Derives[Update]>>(updateName: MaybeArray
|
|
206
|
+
derive<Update extends UpdateName, Handler extends Hooks.Derive<ContextType<BotLike, Update> & Derives["global"] & Derives[Update]>>(updateName: MaybeArray<Update>, handler: Handler): Plugin<Errors, Derives & {
|
|
207
207
|
[K in Update]: Awaited<ReturnType<Handler>>;
|
|
208
208
|
}>;
|
|
209
209
|
decorate<Value extends Record<string, any>>(value: Value): Plugin<Errors, Derives & {
|
|
@@ -217,7 +217,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
217
217
|
};
|
|
218
218
|
}>;
|
|
219
219
|
/** Register handler to one or many Updates */
|
|
220
|
-
on<T extends UpdateName>(updateName: MaybeArray
|
|
220
|
+
on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<BotLike, T> & Derives["global"] & Derives[T]>): this;
|
|
221
221
|
/** Register handler to any Updates */
|
|
222
222
|
use(handler: Handler<Context<BotLike> & Derives["global"]>): this;
|
|
223
223
|
/**
|
|
@@ -240,21 +240,21 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
240
240
|
*
|
|
241
241
|
* [Documentation](https://gramio.dev/hooks/pre-request.html)
|
|
242
242
|
* */
|
|
243
|
-
preRequest<Methods extends keyof APIMethods, Handler extends Hooks.PreRequest<Methods>>(methods: MaybeArray
|
|
243
|
+
preRequest<Methods extends keyof APIMethods, Handler extends Hooks.PreRequest<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
|
|
244
244
|
preRequest(handler: Hooks.PreRequest): this;
|
|
245
245
|
/**
|
|
246
246
|
* This hook called when API return successful response
|
|
247
247
|
*
|
|
248
248
|
* [Documentation](https://gramio.dev/hooks/on-response.html)
|
|
249
249
|
* */
|
|
250
|
-
onResponse<Methods extends keyof APIMethods, Handler extends Hooks.OnResponse<Methods>>(methods: MaybeArray
|
|
250
|
+
onResponse<Methods extends keyof APIMethods, Handler extends Hooks.OnResponse<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
|
|
251
251
|
onResponse(handler: Hooks.OnResponse): this;
|
|
252
252
|
/**
|
|
253
253
|
* This hook called when API return an error
|
|
254
254
|
*
|
|
255
255
|
* [Documentation](https://gramio.dev/hooks/on-response-error.html)
|
|
256
256
|
* */
|
|
257
|
-
onResponseError<Methods extends keyof APIMethods, Handler extends Hooks.OnResponseError<Methods>>(methods: MaybeArray
|
|
257
|
+
onResponseError<Methods extends keyof APIMethods, Handler extends Hooks.OnResponseError<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
|
|
258
258
|
onResponseError(handler: Hooks.OnResponseError): this;
|
|
259
259
|
/**
|
|
260
260
|
* This hook called when the bot is `started`.
|
|
@@ -307,7 +307,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
|
|
|
307
307
|
* })
|
|
308
308
|
* ```
|
|
309
309
|
*/
|
|
310
|
-
onError<T extends UpdateName>(updateName: MaybeArray
|
|
310
|
+
onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<BotLike, T> & Derives["global"] & Derives[T]>): this;
|
|
311
311
|
onError(handler: Hooks.OnError<Errors, Context<BotLike> & Derives["global"]>): this;
|
|
312
312
|
/**
|
|
313
313
|
* ! ** At the moment, it can only pick up types** */
|