grammy 1.27.0 → 1.28.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 CHANGED
@@ -10,14 +10,14 @@
10
10
 
11
11
  <!-- deno-fmt-ignore-start -->
12
12
 
13
- [![Bot API](https://img.shields.io/badge/Bot%20API-7.7-blue?logo=telegram&style=flat&labelColor=000&color=3b82f6)](https://core.telegram.org/bots/api)
13
+ [![Bot API](https://img.shields.io/badge/Bot%20API-7.8-blue?logo=telegram&style=flat&labelColor=000&color=3b82f6)](https://core.telegram.org/bots/api)
14
14
  [![Deno](https://shield.deno.dev/x/grammy)](https://deno.land/x/grammy)
15
15
  [![npm](https://img.shields.io/npm/v/grammy?logo=npm&style=flat&labelColor=000&color=3b82f6)](https://www.npmjs.org/package/grammy)
16
16
  [![All Contributors](https://img.shields.io/github/all-contributors/grammyjs/grammy?style=flat&labelColor=000&color=3b82f6)](#contributors-)
17
17
 
18
18
  <!-- deno-fmt-ignore-end -->
19
19
 
20
- ## _[docs.](https://grammy.dev) [reference.](https://deno.land/x/grammy/mod.ts) [chat.](https://telegram.me/grammyjs) [news.](https://telegram.me/grammyjs_news)_
20
+ ## _[docs.](https://grammy.dev) [reference.](https://grammy.dev/ref) [chat.](https://telegram.me/grammyjs) [news.](https://telegram.me/grammyjs_news)_
21
21
 
22
22
  </div>
23
23
 
@@ -68,7 +68,7 @@ Congrats! You just wrote a Telegram bot :)
68
68
 
69
69
  ## Going Further
70
70
 
71
- grammY has an excellent [documentation](https://grammy.dev), and an [API Reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts). It even integrates with your code editor, e.g. [VS Code](https://code.visualstudio.com/). You can hover over any element of grammY to get a detailed description of what that thing does or means.
71
+ grammY has an excellent [documentation](https://grammy.dev), and an [API Reference](https://grammy.dev/ref). It even integrates with your code editor, e.g. [VS Code](https://code.visualstudio.com/). You can hover over any element of grammY to get a detailed description of what that thing does or means.
72
72
 
73
73
  If you are still stuck, just join the [Telegram chat](https://t.me/grammyjs) and ask for help. People are nice there and we appreciate your question, no matter what it is :)
74
74
 
@@ -81,7 +81,7 @@ Here are some more resources to support you:
81
81
  —main project website and documentation.
82
82
  Gets you started and explains all concepts.
83
83
 
84
- ### [grammY API reference](https://doc.deno.land/https://deno.land/x/grammy/mod.ts)
84
+ ### [grammY API reference](https://grammy.dev/ref)
85
85
 
86
86
  —reference of everything that grammY exports.
87
87
  Useful to look up descriptions about any element of grammY.
@@ -302,6 +302,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
302
302
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/SunsetTechuila"><img src="https://avatars.githubusercontent.com/u/115353812?v=4?s=100" width="100px;" alt="Grigory"/><br /><sub><b>Grigory</b></sub></a><br /><a href="#ideas-SunsetTechuila" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/grammyjs/grammY/commits?author=SunsetTechuila" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/commits?author=SunsetTechuila" title="Documentation">📖</a></td>
303
303
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/aleveha"><img src="https://avatars.githubusercontent.com/u/63300936?v=4?s=100" width="100px;" alt="aleveha"/><br /><sub><b>aleveha</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=aleveha" title="Code">💻</a></td>
304
304
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/barinbritva"><img src="https://avatars.githubusercontent.com/u/4758362?v=4?s=100" width="100px;" alt="barinbritva"/><br /><sub><b>barinbritva</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Abarinbritva" title="Reviewed Pull Requests">👀</a></td>
305
+ <td align="center" valign="top" width="11.11%"><a href="https://github.com/flmel"><img src="https://avatars.githubusercontent.com/u/55487633?v=4?s=100" width="100px;" alt="Lyudmil Ivanov"/><br /><sub><b>Lyudmil Ivanov</b></sub></a><br /><a href="#example-flmel" title="Examples">💡</a></td>
306
+ <td align="center" valign="top" width="11.11%"><a href="https://consortiumkey.com/"><img src="https://avatars.githubusercontent.com/u/95214604?v=4?s=100" width="100px;" alt="lexomis"/><br /><sub><b>lexomis</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Alexomis" title="Reviewed Pull Requests">👀</a></td>
307
+ <td align="center" valign="top" width="11.11%"><a href="https://github.com/asologor"><img src="https://avatars.githubusercontent.com/u/97506048?v=4?s=100" width="100px;" alt="Andrew Sologor"/><br /><sub><b>Andrew Sologor</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Aandrew-sol" title="Reviewed Pull Requests">👀</a></td>
305
308
  </tr>
306
309
  </tbody>
307
310
  </table>
package/out/bot.d.ts CHANGED
@@ -199,7 +199,7 @@ export declare class Bot<C extends Context = Context, A extends Api = Api> exten
199
199
  * your bot will handle.
200
200
  *
201
201
  * If you're writing a library on top of grammY, check out the
202
- * [documentation](https://grammy.dev/plugins/runner.html) of the runner
202
+ * [documentation](https://grammy.dev/plugins/runner) of the runner
203
203
  * plugin for an example that uses this method.
204
204
  *
205
205
  * @param update An update from the Telegram Bot API
@@ -235,7 +235,7 @@ export declare class Bot<C extends Context = Context, A extends Api = Api> exten
235
235
  * will impact the responsiveness negatively, so it makes sense to use the
236
236
  * `@grammyjs/runner` package even if you receive much fewer messages. If
237
237
  * you worry about how much load your bot can handle, check out the grammY
238
- * [documentation](https://grammy.dev/advanced/scaling.html) about scaling
238
+ * [documentation](https://grammy.dev/advanced/scaling) about scaling
239
239
  * up.
240
240
  *
241
241
  * @param options Options to use for simple long polling
package/out/bot.js CHANGED
@@ -208,7 +208,7 @@ class Bot extends composer_js_1.Composer {
208
208
  * your bot will handle.
209
209
  *
210
210
  * If you're writing a library on top of grammY, check out the
211
- * [documentation](https://grammy.dev/plugins/runner.html) of the runner
211
+ * [documentation](https://grammy.dev/plugins/runner) of the runner
212
212
  * plugin for an example that uses this method.
213
213
  *
214
214
  * @param update An update from the Telegram Bot API
@@ -267,7 +267,7 @@ a known bot info object.");
267
267
  * will impact the responsiveness negatively, so it makes sense to use the
268
268
  * `@grammyjs/runner` package even if you receive much fewer messages. If
269
269
  * you worry about how much load your bot can handle, check out the grammY
270
- * [documentation](https://grammy.dev/advanced/scaling.html) about scaling
270
+ * [documentation](https://grammy.dev/advanced/scaling) about scaling
271
271
  * up.
272
272
  *
273
273
  * @param options Options to use for simple long polling
package/out/composer.d.ts CHANGED
@@ -65,7 +65,7 @@ export interface MiddlewareObj<C extends Context = Context> {
65
65
  * Middleware is an extremely powerful concept and this short explanation only
66
66
  * scratched the surface of what is possible with grammY. If you want to know
67
67
  * more advanced things about middleware, check out the
68
- * [documentation](https://grammy.dev/guide/middleware.html) on the website.
68
+ * [documentation](https://grammy.dev/guide/middleware) on the website.
69
69
  */
70
70
  export type Middleware<C extends Context = Context> = MiddlewareFn<C> | MiddlewareObj<C>;
71
71
  /**
@@ -96,7 +96,7 @@ export declare function run<C extends Context>(middleware: MiddlewareFn<C>, ctx:
96
96
  *
97
97
  * On the other hand, if you want to dig deeper into how grammY implements
98
98
  * middleware, check out the
99
- * [documentation](https://grammy.dev/advanced/middleware.html) on the website.
99
+ * [documentation](https://grammy.dev/advanced/middleware) on the website.
100
100
  */
101
101
  export declare class Composer<C extends Context> implements MiddlewareObj<C> {
102
102
  private handler;
@@ -121,7 +121,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
121
121
  *
122
122
  * This method returns a new instance of composer. The returned instance can
123
123
  * be further extended, and all changes will be regarded here. Confer the
124
- * [documentation](https://grammy.dev/advanced/middleware.html) on the
124
+ * [documentation](https://grammy.dev/advanced/middleware) on the
125
125
  * website if you want to know more about how the middleware system in
126
126
  * grammY works, especially when it comes to chaining the method calls
127
127
  * (`use( ... ).use( ... ).use( ... )`).
@@ -157,7 +157,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
157
157
  *
158
158
  * You can use autocomplete in VS Code to see all available filter queries.
159
159
  * Check out the
160
- * [documentation](https://grammy.dev/guide/filter-queries.html) on the
160
+ * [documentation](https://grammy.dev/guide/filter-queries) on the
161
161
  * website to learn more about filter queries in grammY.
162
162
  *
163
163
  * It is possible to pass multiple filter queries in an array, i.e.
@@ -320,7 +320,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
320
320
  * // Groups and supergroups only
321
321
  * bot.chatType(["group", "supergroup"], ctx => { ... });
322
322
  * ```
323
- * [Remember](https://grammy.dev/guide/context.html#shortcuts) also that you
323
+ * [Remember](https://grammy.dev/guide/context#shortcuts) also that you
324
324
  * can access the chat type via `ctx.chat.type`.
325
325
  *
326
326
  * @param chatType The chat type
@@ -663,7 +663,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
663
663
  * ```
664
664
  *
665
665
  * Check out the
666
- * [documentation](https://grammy.dev/guide/errors.html#error-boundaries) on
666
+ * [documentation](https://grammy.dev/guide/errors#error-boundaries) on
667
667
  * the website to learn more about error boundaries.
668
668
  *
669
669
  * @param errorHandler The error handler to use
package/out/composer.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Composer = exports.run = exports.BotError = void 0;
3
+ exports.Composer = exports.BotError = void 0;
4
+ exports.run = run;
4
5
  const context_js_1 = require("./context.js");
5
6
  // === Middleware errors
6
7
  /**
@@ -75,7 +76,6 @@ const leaf = () => Promise.resolve();
75
76
  async function run(middleware, ctx) {
76
77
  await middleware(ctx, leaf);
77
78
  }
78
- exports.run = run;
79
79
  // === Composer
80
80
  /**
81
81
  * The composer is the heart of the middleware system in grammY. It is also the
@@ -88,7 +88,7 @@ exports.run = run;
88
88
  *
89
89
  * On the other hand, if you want to dig deeper into how grammY implements
90
90
  * middleware, check out the
91
- * [documentation](https://grammy.dev/advanced/middleware.html) on the website.
91
+ * [documentation](https://grammy.dev/advanced/middleware) on the website.
92
92
  */
93
93
  class Composer {
94
94
  /**
@@ -118,7 +118,7 @@ class Composer {
118
118
  *
119
119
  * This method returns a new instance of composer. The returned instance can
120
120
  * be further extended, and all changes will be regarded here. Confer the
121
- * [documentation](https://grammy.dev/advanced/middleware.html) on the
121
+ * [documentation](https://grammy.dev/advanced/middleware) on the
122
122
  * website if you want to know more about how the middleware system in
123
123
  * grammY works, especially when it comes to chaining the method calls
124
124
  * (`use( ... ).use( ... ).use( ... )`).
@@ -158,7 +158,7 @@ class Composer {
158
158
  *
159
159
  * You can use autocomplete in VS Code to see all available filter queries.
160
160
  * Check out the
161
- * [documentation](https://grammy.dev/guide/filter-queries.html) on the
161
+ * [documentation](https://grammy.dev/guide/filter-queries) on the
162
162
  * website to learn more about filter queries in grammY.
163
163
  *
164
164
  * It is possible to pass multiple filter queries in an array, i.e.
@@ -329,7 +329,7 @@ class Composer {
329
329
  * // Groups and supergroups only
330
330
  * bot.chatType(["group", "supergroup"], ctx => { ... });
331
331
  * ```
332
- * [Remember](https://grammy.dev/guide/context.html#shortcuts) also that you
332
+ * [Remember](https://grammy.dev/guide/context#shortcuts) also that you
333
333
  * can access the chat type via `ctx.chat.type`.
334
334
  *
335
335
  * @param chatType The chat type
@@ -676,7 +676,7 @@ class Composer {
676
676
  * ```
677
677
  *
678
678
  * Check out the
679
- * [documentation](https://grammy.dev/guide/errors.html#error-boundaries) on
679
+ * [documentation](https://grammy.dev/guide/errors#error-boundaries) on
680
680
  * the website to learn more about error boundaries.
681
681
  *
682
682
  * @param errorHandler The error handler to use
package/out/context.d.ts CHANGED
@@ -135,7 +135,7 @@ interface StaticHas {
135
135
  * methods to keep information about how a regular expression was matched.
136
136
  *
137
137
  * Read up about middleware on the
138
- * [website](https://grammy.dev/guide/context.html) if you want to know more
138
+ * [website](https://grammy.dev/guide/context) if you want to know more
139
139
  * about the powerful opportunities that lie in context objects, and about how
140
140
  * grammY implements them.
141
141
  */
package/out/context.js CHANGED
@@ -198,7 +198,7 @@ const checker = {
198
198
  * methods to keep information about how a regular expression was matched.
199
199
  *
200
200
  * Read up about middleware on the
201
- * [website](https://grammy.dev/guide/context.html) if you want to know more
201
+ * [website](https://grammy.dev/guide/context) if you want to know more
202
202
  * about the powerful opportunities that lie in context objects, and about how
203
203
  * grammY implements them.
204
204
  */
@@ -163,7 +163,7 @@ export declare const InlineQueryResultBuilder: {
163
163
  * @param options Remaining options
164
164
  */
165
165
  game(id: string, game_short_name: string, options?: InlineQueryResultOptions<InlineQueryResultGame, "game_short_name">): {
166
- reply_markup?: import("@grammyjs/types/markup.js").InlineKeyboardMarkup | undefined;
166
+ reply_markup?: import("@grammyjs/types/markup.js").InlineKeyboardMarkup;
167
167
  type: string;
168
168
  id: string;
169
169
  game_short_name: string;
@@ -37,7 +37,7 @@ type KeyboardSource = KeyboardButtonSource[][] | Keyboard;
37
37
  * ```
38
38
  *
39
39
  * Be sure to check out the
40
- * [documentation](https://grammy.dev/plugins/keyboard.html#custom-keyboards) on
40
+ * [documentation](https://grammy.dev/plugins/keyboard#custom-keyboards) on
41
41
  * custom keyboards in grammY.
42
42
  */
43
43
  export declare class Keyboard {
@@ -221,7 +221,7 @@ export declare class Keyboard {
221
221
  static webApp(text: string, url: string): KeyboardButton.WebAppButton;
222
222
  /**
223
223
  * Make the current keyboard persistent. See
224
- * https://grammy.dev/plugins/keyboard.html#persistent-keyboards for more
224
+ * https://grammy.dev/plugins/keyboard#persistent-keyboards for more
225
225
  * details.
226
226
  *
227
227
  * Keyboards are not persistent by default, use this function to enable it
@@ -233,7 +233,7 @@ export declare class Keyboard {
233
233
  persistent(isEnabled?: boolean): this;
234
234
  /**
235
235
  * Make the current keyboard selective. See
236
- * https://grammy.dev/plugins/keyboard.html#selectively-send-custom-keyboards
236
+ * https://grammy.dev/plugins/keyboard#selectively-send-custom-keyboards
237
237
  * for more details.
238
238
  *
239
239
  * Keyboards are non-selective by default, use this function to enable it
@@ -245,7 +245,7 @@ export declare class Keyboard {
245
245
  selected(isEnabled?: boolean): this;
246
246
  /**
247
247
  * Make the current keyboard one-time. See
248
- * https://grammy.dev/plugins/keyboard.html#one-time-custom-keyboards for
248
+ * https://grammy.dev/plugins/keyboard#one-time-custom-keyboards for
249
249
  * more details.
250
250
  *
251
251
  * Keyboards are non-one-time by default, use this function to enable it
@@ -257,7 +257,7 @@ export declare class Keyboard {
257
257
  oneTime(isEnabled?: boolean): this;
258
258
  /**
259
259
  * Make the current keyboard resized. See
260
- * https://grammy.dev/plugins/keyboard.html#resize-custom-keyboard for more
260
+ * https://grammy.dev/plugins/keyboard#resize-custom-keyboard for more
261
261
  * details.
262
262
  *
263
263
  * Keyboards are non-resized by default, use this function to enable it
@@ -269,7 +269,7 @@ export declare class Keyboard {
269
269
  resized(isEnabled?: boolean): this;
270
270
  /**
271
271
  * Set the current keyboard's input field placeholder. See
272
- * https://grammy.dev/plugins/keyboard.html#input-field-placeholder for more
272
+ * https://grammy.dev/plugins/keyboard#input-field-placeholder for more
273
273
  * details.
274
274
  *
275
275
  * @param value The placeholder text
@@ -401,7 +401,7 @@ type InlineKeyboardSource = InlineKeyboardButton[][] | InlineKeyboard;
401
401
  * ```
402
402
  *
403
403
  * Be sure to to check the
404
- * [documentation](https://grammy.dev/plugins/keyboard.html#inline-keyboards) on
404
+ * [documentation](https://grammy.dev/plugins/keyboard#inline-keyboards) on
405
405
  * inline keyboards in grammY.
406
406
  */
407
407
  export declare class InlineKeyboard {
@@ -37,7 +37,7 @@ exports.InlineKeyboard = exports.Keyboard = void 0;
37
37
  * ```
38
38
  *
39
39
  * Be sure to check out the
40
- * [documentation](https://grammy.dev/plugins/keyboard.html#custom-keyboards) on
40
+ * [documentation](https://grammy.dev/plugins/keyboard#custom-keyboards) on
41
41
  * custom keyboards in grammY.
42
42
  */
43
43
  class Keyboard {
@@ -237,7 +237,7 @@ class Keyboard {
237
237
  }
238
238
  /**
239
239
  * Make the current keyboard persistent. See
240
- * https://grammy.dev/plugins/keyboard.html#persistent-keyboards for more
240
+ * https://grammy.dev/plugins/keyboard#persistent-keyboards for more
241
241
  * details.
242
242
  *
243
243
  * Keyboards are not persistent by default, use this function to enable it
@@ -252,7 +252,7 @@ class Keyboard {
252
252
  }
253
253
  /**
254
254
  * Make the current keyboard selective. See
255
- * https://grammy.dev/plugins/keyboard.html#selectively-send-custom-keyboards
255
+ * https://grammy.dev/plugins/keyboard#selectively-send-custom-keyboards
256
256
  * for more details.
257
257
  *
258
258
  * Keyboards are non-selective by default, use this function to enable it
@@ -267,7 +267,7 @@ class Keyboard {
267
267
  }
268
268
  /**
269
269
  * Make the current keyboard one-time. See
270
- * https://grammy.dev/plugins/keyboard.html#one-time-custom-keyboards for
270
+ * https://grammy.dev/plugins/keyboard#one-time-custom-keyboards for
271
271
  * more details.
272
272
  *
273
273
  * Keyboards are non-one-time by default, use this function to enable it
@@ -282,7 +282,7 @@ class Keyboard {
282
282
  }
283
283
  /**
284
284
  * Make the current keyboard resized. See
285
- * https://grammy.dev/plugins/keyboard.html#resize-custom-keyboard for more
285
+ * https://grammy.dev/plugins/keyboard#resize-custom-keyboard for more
286
286
  * details.
287
287
  *
288
288
  * Keyboards are non-resized by default, use this function to enable it
@@ -297,7 +297,7 @@ class Keyboard {
297
297
  }
298
298
  /**
299
299
  * Set the current keyboard's input field placeholder. See
300
- * https://grammy.dev/plugins/keyboard.html#input-field-placeholder for more
300
+ * https://grammy.dev/plugins/keyboard#input-field-placeholder for more
301
301
  * details.
302
302
  *
303
303
  * @param value The placeholder text
@@ -463,7 +463,7 @@ exports.Keyboard = Keyboard;
463
463
  * ```
464
464
  *
465
465
  * Be sure to to check the
466
- * [documentation](https://grammy.dev/plugins/keyboard.html#inline-keyboards) on
466
+ * [documentation](https://grammy.dev/plugins/keyboard#inline-keyboards) on
467
467
  * inline keyboards in grammY.
468
468
  */
469
469
  class InlineKeyboard {
@@ -8,9 +8,9 @@ type MaybePromise<T> = Promise<T> | T;
8
8
  * Session middleware will load the session data of a specific chat from your
9
9
  * storage solution, and make it available to you on the context object. Check
10
10
  * out the
11
- * [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/session)
11
+ * [documentation](https://grammy.dev/ref/core/session)
12
12
  * on session middleware to know more, and read the section about sessions on
13
- * the [website](https://grammy.dev/plugins/session.html).
13
+ * the [website](https://grammy.dev/plugins/session).
14
14
  */
15
15
  export interface SessionFlavor<S> {
16
16
  /**
@@ -37,10 +37,10 @@ export interface SessionFlavor<S> {
37
37
  * object. Once you access `ctx.session`, the storage will be queried and the
38
38
  * session data becomes available. If you access `ctx.session` again for the
39
39
  * same context object, the cached value will be used. Check out the
40
- * [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/lazySession)
40
+ * [documentation](https://grammy.dev/ref/core/lazysession)
41
41
  * on lazy session middleware to know more, and read the section about lazy
42
42
  * sessions on the
43
- * [website](https://grammy.dev/plugins/session.html#lazy-sessions).
43
+ * [website](https://grammy.dev/plugins/session#lazy-sessions).
44
44
  */
45
45
  export interface LazySessionFlavor<S> {
46
46
  /**
@@ -115,7 +115,7 @@ export interface SessionOptions<S, C extends Context = Context> {
115
115
  * This option lets you generate your own session keys per context object.
116
116
  * The session key determines how to map the different session objects to
117
117
  * your chats and users. Check out the
118
- * [documentation](https://grammy.dev/plugins/session.html#how-to-use-sessions)
118
+ * [documentation](https://grammy.dev/plugins/session#how-to-use-sessions)
119
119
  * on the website about how to use session middleware to know how session
120
120
  * keys are used.
121
121
  *
@@ -128,7 +128,7 @@ export interface SessionOptions<S, C extends Context = Context> {
128
128
  * delete access to the session middleware.
129
129
  *
130
130
  * Consider using a [known storage
131
- * adapter](https://grammy.dev/plugins/session.html#known-storage-adapters)
131
+ * adapter](https://grammy.dev/plugins/session#known-storage-adapters)
132
132
  * instead of rolling your own implementation of this.
133
133
  *
134
134
  * The default implementation will store session in memory. The data will be
@@ -188,7 +188,7 @@ type MultiSessionOptionsRecord<S extends Record<string, unknown>, C extends Cont
188
188
  * You can delete the session data by setting `ctx.session` to `null` or
189
189
  * `undefined`.
190
190
  *
191
- * Check out the [documentation](https://grammy.dev/plugins/session.html) on the
191
+ * Check out the [documentation](https://grammy.dev/plugins/session) on the
192
192
  * website to know more about how sessions work in grammY.
193
193
  *
194
194
  * @param options Optional configuration to pass to the session middleware
@@ -221,7 +221,7 @@ export declare function session<S, C extends Context>(options?: SessionOptions<S
221
221
  * ```
222
222
  *
223
223
  * Check out the
224
- * [documentation](https://grammy.dev/plugins/session.html#lazy-sessions) on the
224
+ * [documentation](https://grammy.dev/plugins/session#lazy-sessions) on the
225
225
  * website to know more about how lazy sessions work in grammY.
226
226
  *
227
227
  * @param options Optional configuration to pass to the session middleware
@@ -314,7 +314,7 @@ export declare class MemorySessionStorage<S> implements StorageAdapter<S> {
314
314
  */
315
315
  protected readonly storage: Map<string, {
316
316
  session: S;
317
- expires?: number | undefined;
317
+ expires?: number;
318
318
  }>;
319
319
  /**
320
320
  * Constructs a new memory session storage with the given time to live. Note
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MemorySessionStorage = exports.enhanceStorage = exports.lazySession = exports.session = void 0;
3
+ exports.MemorySessionStorage = void 0;
4
+ exports.session = session;
5
+ exports.lazySession = lazySession;
6
+ exports.enhanceStorage = enhanceStorage;
4
7
  const platform_node_js_1 = require("../platform.node.js");
5
8
  const debug = (0, platform_node_js_1.debug)("grammy:session");
6
9
  /**
@@ -45,7 +48,7 @@ const debug = (0, platform_node_js_1.debug)("grammy:session");
45
48
  * You can delete the session data by setting `ctx.session` to `null` or
46
49
  * `undefined`.
47
50
  *
48
- * Check out the [documentation](https://grammy.dev/plugins/session.html) on the
51
+ * Check out the [documentation](https://grammy.dev/plugins/session) on the
49
52
  * website to know more about how sessions work in grammY.
50
53
  *
51
54
  * @param options Optional configuration to pass to the session middleware
@@ -55,7 +58,6 @@ function session(options = {}) {
55
58
  ? strictMultiSession(options)
56
59
  : strictSingleSession(options);
57
60
  }
58
- exports.session = session;
59
61
  function strictSingleSession(options) {
60
62
  const { initial, storage, getSessionKey, custom } = fillDefaults(options);
61
63
  return async (ctx, next) => {
@@ -113,7 +115,7 @@ function strictMultiSession(options) {
113
115
  * ```
114
116
  *
115
117
  * Check out the
116
- * [documentation](https://grammy.dev/plugins/session.html#lazy-sessions) on the
118
+ * [documentation](https://grammy.dev/plugins/session#lazy-sessions) on the
117
119
  * website to know more about how lazy sessions work in grammY.
118
120
  *
119
121
  * @param options Optional configuration to pass to the session middleware
@@ -133,7 +135,6 @@ function lazySession(options = {}) {
133
135
  await propSession.finish();
134
136
  };
135
137
  }
136
- exports.lazySession = lazySession;
137
138
  /**
138
139
  * Internal class that manages a single property on the session. Can be used
139
140
  * both in a strict and a lazy way. Works by using `Object.defineProperty` to
@@ -286,7 +287,6 @@ function enhanceStorage(options) {
286
287
  }
287
288
  return wrapStorage(storage);
288
289
  }
289
- exports.enhanceStorage = enhanceStorage;
290
290
  function compatStorage(storage) {
291
291
  return {
292
292
  read: async (k) => {
@@ -45,7 +45,7 @@ type ResolveName<A extends FrameworkAdapter | AdapterNames> = A extends AdapterN
45
45
  * ```
46
46
  *
47
47
  * Confer the grammY
48
- * [documentation](https://grammy.dev/guide/deployment-types.html) to read more
48
+ * [documentation](https://grammy.dev/guide/deployment-types) to read more
49
49
  * about how to run your bot with webhooks.
50
50
  *
51
51
  * @param bot The bot for which to create a callback
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.webhookCallback = void 0;
3
+ exports.webhookCallback = webhookCallback;
4
4
  const platform_node_js_1 = require("../platform.node.js");
5
5
  const frameworks_js_1 = require("./frameworks.js");
6
6
  const debugErr = (0, platform_node_js_1.debug)("grammy:error");
@@ -45,12 +45,12 @@ function webhookCallback(bot, adapter = platform_node_js_1.defaultAdapter, onTim
45
45
  return handlerReturn;
46
46
  };
47
47
  }
48
- exports.webhookCallback = webhookCallback;
49
48
  function timeoutIfNecessary(task, onTimeout, timeout) {
50
49
  if (timeout === Infinity)
51
50
  return task;
52
51
  return new Promise((resolve, reject) => {
53
52
  const handle = setTimeout(() => {
53
+ debugErr(`Request timed out after ${timeout} ms`);
54
54
  if (onTimeout === "throw") {
55
55
  reject(new Error(`Request timed out after ${timeout} ms`));
56
56
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node-fetch" />
2
1
  import { type ApiMethods as Telegram, type ApiResponse, type Opts } from "../types.js";
3
2
  export type Methods<R extends RawApi> = string & keyof R;
4
3
  /**
@@ -30,7 +29,7 @@ type ApiCallResult<M extends Methods<R>, R extends RawApi> = R[M] extends (...ar
30
29
  * implement rate limiting or other things against the Telegram Bot API.
31
30
  *
32
31
  * Confer the grammY
33
- * [documentation](https://grammy.dev/advanced/transformers.html) to read more
32
+ * [documentation](https://grammy.dev/advanced/transformers) to read more
34
33
  * about how to use transformers.
35
34
  */
36
35
  export type Transformer<R extends RawApi = RawApi> = <M extends Methods<R>>(prev: ApiCallFn<R>, method: M, payload: Payload<M, R>, signal?: AbortSignal) => Promise<ApiResponse<ApiCallResult<M, R>>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRawApi = void 0;
3
+ exports.createRawApi = createRawApi;
4
4
  const platform_node_js_1 = require("../platform.node.js");
5
5
  const error_js_1 = require("./error.js");
6
6
  const payload_js_1 = require("./payload.js");
@@ -125,7 +125,6 @@ function createRawApi(token, options, webhookReplyEnvelope) {
125
125
  };
126
126
  return api;
127
127
  }
128
- exports.createRawApi = createRawApi;
129
128
  const defaultBuildUrl = (root, token, method, env) => {
130
129
  const prefix = env === "test" ? "test/" : "";
131
130
  return `${root}/bot${token}/${prefix}${method}`;
@@ -39,7 +39,7 @@ export declare function toGrammyError(err: ApiError, method: string, payload: Re
39
39
  * request failed.
40
40
  *
41
41
  * If an [API transformer
42
- * function](https://grammy.dev/advanced/transformers.html) throws an error,
42
+ * function](https://grammy.dev/advanced/transformers) throws an error,
43
43
  * grammY will regard this as if the network request failed. The contained error
44
44
  * will then be the error that was thrown by the transformer function.
45
45
  */
package/out/core/error.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toHttpError = exports.HttpError = exports.toGrammyError = exports.GrammyError = void 0;
3
+ exports.HttpError = exports.GrammyError = void 0;
4
+ exports.toGrammyError = toGrammyError;
5
+ exports.toHttpError = toHttpError;
4
6
  const platform_node_js_1 = require("../platform.node.js");
5
7
  const debug = (0, platform_node_js_1.debug)("grammy:warn");
6
8
  /**
@@ -44,7 +46,6 @@ function toGrammyError(err, method, payload) {
44
46
  }
45
47
  return new GrammyError(`Call to '${method}' failed!`, err, method, payload);
46
48
  }
47
- exports.toGrammyError = toGrammyError;
48
49
  /**
49
50
  * This class represents errors that are thrown by grammY because an HTTP call
50
51
  * to the Telegram Bot API failed.
@@ -54,7 +55,7 @@ exports.toGrammyError = toGrammyError;
54
55
  * request failed.
55
56
  *
56
57
  * If an [API transformer
57
- * function](https://grammy.dev/advanced/transformers.html) throws an error,
58
+ * function](https://grammy.dev/advanced/transformers) throws an error,
58
59
  * grammY will regard this as if the network request failed. The contained error
59
60
  * will then be the error that was thrown by the transformer function.
60
61
  */
@@ -84,4 +85,3 @@ function toHttpError(method, sensitiveLogs) {
84
85
  throw new HttpError(msg, err);
85
86
  };
86
87
  }
87
- exports.toHttpError = toHttpError;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * Determines for a given payload if it may be sent as JSON, or if it has to be
4
3
  * uploaded via multipart/form-data. Returns `true` in the latter case and
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createFormDataPayload = exports.createJsonPayload = exports.requiresFormDataUpload = void 0;
3
+ exports.requiresFormDataUpload = requiresFormDataUpload;
4
+ exports.createJsonPayload = createJsonPayload;
5
+ exports.createFormDataPayload = createFormDataPayload;
4
6
  const platform_node_js_1 = require("../platform.node.js");
5
7
  const types_js_1 = require("../types.js");
6
8
  // === Payload types (JSON vs. form data)
@@ -18,7 +20,6 @@ function requiresFormDataUpload(payload) {
18
20
  ? v.some(requiresFormDataUpload)
19
21
  : v instanceof types_js_1.InputFile || requiresFormDataUpload(v)));
20
22
  }
21
- exports.requiresFormDataUpload = requiresFormDataUpload;
22
23
  /**
23
24
  * Calls `JSON.stringify` but removes `null` values from objects before
24
25
  * serialization
@@ -46,7 +47,6 @@ function createJsonPayload(payload) {
46
47
  body: str(payload),
47
48
  };
48
49
  }
49
- exports.createJsonPayload = createJsonPayload;
50
50
  async function* protectItr(itr, onError) {
51
51
  try {
52
52
  yield* itr;
@@ -77,7 +77,6 @@ function createFormDataPayload(payload, onError) {
77
77
  body: stream,
78
78
  };
79
79
  }
80
- exports.createFormDataPayload = createFormDataPayload;
81
80
  // === Form data creation
82
81
  function createBoundary() {
83
82
  // Taken from Deno std lib
package/out/filter.d.ts CHANGED
@@ -17,9 +17,9 @@ type FilterFunction<C extends Context, D extends C> = (ctx: C) => ctx is D;
17
17
  * ```
18
18
  *
19
19
  * Check out the
20
- * [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/Composer)
20
+ * [documentation](https://grammy.dev/ref/core/composer#on)
21
21
  * of `bot.on` for examples. In addition, the
22
- * [website](https://grammy.dev/guide/filter-queries.html) contains more
22
+ * [website](https://grammy.dev/guide/filter-queries) contains more
23
23
  * information about how filter queries work in grammY.
24
24
  *
25
25
  * @param filter A filter query or an array of filter queries
@@ -771,7 +771,7 @@ type ComputeFilterQueryList = InjectShortcuts;
771
771
  /**
772
772
  * Represents a filter query that can be passed to `bot.on`. There are three
773
773
  * different kinds of filter queries: Level 1, Level 2, and Level 3. Check out
774
- * the [website](https://grammy.dev/guide/filter-queries.html) to read about how
774
+ * the [website](https://grammy.dev/guide/filter-queries) to read about how
775
775
  * filter queries work in grammY, and how to use them.
776
776
  *
777
777
  * Here are three brief examples:
package/out/filter.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.preprocess = exports.parse = exports.matchFilter = void 0;
3
+ exports.matchFilter = matchFilter;
4
+ exports.parse = parse;
5
+ exports.preprocess = preprocess;
4
6
  const filterQueryCache = new Map();
5
7
  // === Obtain O(1) filter function from query
6
8
  /**
@@ -19,9 +21,9 @@ const filterQueryCache = new Map();
19
21
  * ```
20
22
  *
21
23
  * Check out the
22
- * [documentation](https://doc.deno.land/https://deno.land/x/grammy/mod.ts/~/Composer)
24
+ * [documentation](https://grammy.dev/ref/core/composer#on)
23
25
  * of `bot.on` for examples. In addition, the
24
- * [website](https://grammy.dev/guide/filter-queries.html) contains more
26
+ * [website](https://grammy.dev/guide/filter-queries) contains more
25
27
  * information about how filter queries work in grammY.
26
28
  *
27
29
  * @param filter A filter query or an array of filter queries
@@ -38,13 +40,11 @@ function matchFilter(filter) {
38
40
  })();
39
41
  return (ctx) => predicate(ctx);
40
42
  }
41
- exports.matchFilter = matchFilter;
42
43
  function parse(filter) {
43
44
  return Array.isArray(filter)
44
45
  ? filter.map((q) => q.split(":"))
45
46
  : [filter.split(":")];
46
47
  }
47
- exports.parse = parse;
48
48
  function compile(parsed) {
49
49
  const preprocessed = parsed.flatMap((q) => check(q, preprocess(q)));
50
50
  const ltree = treeify(preprocessed);
@@ -98,7 +98,6 @@ function preprocess(filter) {
98
98
  }
99
99
  return expanded;
100
100
  }
101
- exports.preprocess = preprocess;
102
101
  function check(original, preprocessed) {
103
102
  if (preprocessed.length === 0)
104
103
  throw new Error("Empty filter query given");
@@ -1,6 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
1
  import { Agent as HttpAgent } from "http";
5
2
  import { Agent as HttpsAgent } from "https";
6
3
  import { Readable } from "stream";
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultAdapter = exports.baseFetchConfig = exports.itrToStream = exports.debug = void 0;
3
+ exports.defaultAdapter = exports.itrToStream = exports.debug = void 0;
4
+ exports.baseFetchConfig = baseFetchConfig;
4
5
  // === Needed imports
5
6
  const http_1 = require("http");
6
7
  const https_1 = require("https");
@@ -38,6 +39,5 @@ function baseFetchConfig(apiRoot) {
38
39
  else
39
40
  return {};
40
41
  }
41
- exports.baseFetchConfig = baseFetchConfig;
42
42
  // === Default webhook adapter
43
43
  exports.defaultAdapter = "express";
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { type ApiMethods as ApiMethodsF, type InputMedia as InputMediaF, type InputMediaAnimation as InputMediaAnimationF, type InputMediaAudio as InputMediaAudioF, type InputMediaDocument as InputMediaDocumentF, type InputMediaPhoto as InputMediaPhotoF, type InputMediaVideo as InputMediaVideoF, type InputPaidMedia as InputPaidMediaF, type InputPaidMediaPhoto as InputPaidMediaPhotoF, type InputPaidMediaVideo as InputPaidMediaVideoF, type InputSticker as InputStickerF, type Opts as OptsF } from "@grammyjs/types";
3
2
  import { type ReadStream } from "fs";
4
3
  export * from "@grammyjs/types";
@@ -14,7 +13,7 @@ interface URLLike {
14
13
  }
15
14
  /**
16
15
  * An `InputFile` wraps a number of different sources for [sending
17
- * files](https://grammy.dev/guide/files.html#uploading-your-own-file).
16
+ * files](https://grammy.dev/guide/files#uploading-your-own-files).
18
17
  *
19
18
  * It corresponds to the `InputFile` type in the [Telegram Bot API
20
19
  * Reference](https://core.telegram.org/bots/api#inputfile).
@@ -26,7 +25,7 @@ export declare class InputFile {
26
25
  * Optional name of the constructed `InputFile` instance.
27
26
  *
28
27
  * Check out the
29
- * [documentation](https://grammy.dev/guide/files.html#uploading-your-own-file)
28
+ * [documentation](https://grammy.dev/guide/files#uploading-your-own-files)
30
29
  * on sending files with `InputFile`.
31
30
  */
32
31
  readonly filename?: string;
package/out/types.node.js CHANGED
@@ -25,7 +25,7 @@ __exportStar(require("@grammyjs/types"), exports);
25
25
  // === InputFile handling and File augmenting
26
26
  /**
27
27
  * An `InputFile` wraps a number of different sources for [sending
28
- * files](https://grammy.dev/guide/files.html#uploading-your-own-file).
28
+ * files](https://grammy.dev/guide/files#uploading-your-own-files).
29
29
  *
30
30
  * It corresponds to the `InputFile` type in the [Telegram Bot API
31
31
  * Reference](https://core.telegram.org/bots/api#inputfile).
package/out/web.mjs CHANGED
@@ -4889,6 +4889,7 @@ function timeoutIfNecessary(task, onTimeout, timeout) {
4889
4889
  if (timeout === Infinity) return task;
4890
4890
  return new Promise((resolve, reject)=>{
4891
4891
  const handle = setTimeout(()=>{
4892
+ debugErr1(`Request timed out after ${timeout} ms`);
4892
4893
  if (onTimeout === "throw") {
4893
4894
  reject(new Error(`Request timed out after ${timeout} ms`));
4894
4895
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grammy",
3
3
  "description": "The Telegram Bot Framework.",
4
- "version": "1.27.0",
4
+ "version": "1.28.0",
5
5
  "author": "KnorpelSenf",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -17,7 +17,7 @@
17
17
  "backport": "deno2node tsconfig.json"
18
18
  },
19
19
  "dependencies": {
20
- "@grammyjs/types": "3.11.0",
20
+ "@grammyjs/types": "3.12.0",
21
21
  "abort-controller": "^3.0.0",
22
22
  "debug": "^4.3.4",
23
23
  "node-fetch": "^2.7.0"