grammy 1.11.0 → 1.11.2

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,7 +10,7 @@
10
10
 
11
11
  <!-- deno-fmt-ignore-start -->
12
12
 
13
- [![Bot API](https://img.shields.io/badge/Bot%20API-6.1-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-6.2-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-)
@@ -91,6 +91,11 @@ Useful to look up descriptions about any element of grammY.
91
91
  —repository full of example bots.
92
92
  Includes a setup to easily run any of them.
93
93
 
94
+ ### [Awesome grammY](https://github.com/grammyjs/awesome-grammY)
95
+
96
+ —list of awesome projects built with grammY.
97
+ Helpful if you want to see some real-world usage.
98
+
94
99
  ### [grammY Telegram Chat](https://t.me/grammyjs)
95
100
 
96
101
  —Telegram chat where you can ask any question about grammY or bots in general.
@@ -137,7 +142,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
137
142
  <table>
138
143
  <tr>
139
144
  <td align="center"><a href="https://github.com/KnorpelSenf"><img src="https://avatars.githubusercontent.com/u/12952387?v=4?s=100" width="100px;" alt=""/><br /><sub><b>KnorpelSenf</b></sub></a><br /><a href="#ideas-KnorpelSenf" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/grammyjs/grammY/commits?author=KnorpelSenf" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/commits?author=KnorpelSenf" title="Documentation">📖</a> <a href="#design-KnorpelSenf" title="Design">🎨</a> <a href="#example-KnorpelSenf" title="Examples">💡</a> <a href="https://github.com/grammyjs/grammY/commits?author=KnorpelSenf" title="Tests">⚠️</a> <a href="#plugin-KnorpelSenf" title="Plugin/utility libraries">🔌</a> <a href="#platform-KnorpelSenf" title="Packaging/porting to new platform">📦</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AKnorpelSenf" title="Reviewed Pull Requests">👀</a> <a href="#mentoring-KnorpelSenf" title="Mentoring">🧑‍🏫</a> <a href="#projectManagement-KnorpelSenf" title="Project Management">📆</a> <a href="#infra-KnorpelSenf" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
140
- <td align="center"><a href="https://github.com/HeeroML"><img src="https://avatars.githubusercontent.com/u/42873000?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Heero</b></sub></a><br /><a href="#plugin-HeeroML" title="Plugin/utility libraries">🔌</a> <a href="#userTesting-HeeroML" title="User Testing">📓</a> <a href="#example-HeeroML" title="Examples">💡</a> <a href="https://github.com/grammyjs/grammY/commits?author=HeeroML" title="Documentation">📖</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AHeeroML" title="Reviewed Pull Requests">👀</a></td>
145
+ <td align="center"><a href="https://github.com/HeeroML"><img src="https://avatars.githubusercontent.com/u/42873000?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Heero</b></sub></a><br /><a href="#plugin-HeeroML" title="Plugin/utility libraries">🔌</a> <a href="#userTesting-HeeroML" title="User Testing">📓</a> <a href="#example-HeeroML" title="Examples">💡</a> <a href="https://github.com/grammyjs/grammY/commits?author=HeeroML" title="Documentation">📖</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AHeeroML" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/grammyjs/grammY/commits?author=HeeroML" title="Code">💻</a> <a href="#ideas-HeeroML" title="Ideas, Planning, & Feedback">🤔</a></td>
141
146
  <td align="center"><a href="https://github.com/wojpawlik"><img src="https://avatars.githubusercontent.com/u/23058303?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Wojciech Pawlik</b></sub></a><br /><a href="#ideas-wojpawlik" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Awojpawlik" title="Reviewed Pull Requests">👀</a> <a href="#infra-wojpawlik" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#platform-wojpawlik" title="Packaging/porting to new platform">📦</a> <a href="#tool-wojpawlik" title="Tools">🔧</a></td>
142
147
  <td align="center"><a href="https://github.com/MegaITA"><img src="https://avatars.githubusercontent.com/u/32493080?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alessandro Bertozzi</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=MegaITA" title="Documentation">📖</a></td>
143
148
  <td align="center"><a href="https://trgwii.no/"><img src="https://avatars.githubusercontent.com/u/11262022?v=4?s=100" width="100px;" alt=""/><br /><sub><b>trgwii</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=trgwii" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Atrgwii" title="Reviewed Pull Requests">👀</a></td>
@@ -213,11 +218,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
213
218
  <td align="center"><a href="https://github.com/kolay-v"><img src="https://avatars.githubusercontent.com/u/49853802?v=4?s=100" width="100px;" alt=""/><br /><sub><b>kolay</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Akolay-v" title="Reviewed Pull Requests">👀</a></td>
214
219
  <td align="center"><a href="https://enepom.com/"><img src="https://avatars.githubusercontent.com/u/2511553?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Evgeny Nepomnyashchiy</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Apizzaeater" title="Reviewed Pull Requests">👀</a></td>
215
220
  <td align="center"><a href="https://github.com/anantakrishna"><img src="https://avatars.githubusercontent.com/u/6065071?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ananta Krsna dasa</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=anantakrishna" title="Documentation">📖</a></td>
216
- <td align="center"><a href="https://github.com/Mi3liX9"><img src="https://avatars.githubusercontent.com/u/26169870?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mighty Ali</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Mi3liX9" title="Code">💻</a></td>
221
+ <td align="center"><a href="https://github.com/Mi3liX9"><img src="https://avatars.githubusercontent.com/u/26169870?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mighty Ali</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Mi3liX9" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AMi3liX9" title="Reviewed Pull Requests">👀</a> <a href="#ideas-Mi3liX9" title="Ideas, Planning, & Feedback">🤔</a></td>
217
222
  <td align="center"><a href="https://oott123.com"><img src="https://avatars.githubusercontent.com/u/905663?v=4?s=100" width="100px;" alt=""/><br /><sub><b>三三</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aoott123" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=oott123" title="Code">💻</a></td>
218
223
  </tr>
219
224
  <tr>
220
- <td align="center"><a href="http://roz.ninja"><img src="https://avatars.githubusercontent.com/u/3948961?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Roz</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aroziscoding" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=roziscoding" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Aroziscoding" title="Reviewed Pull Requests">👀</a></td>
225
+ <td align="center"><a href="http://roz.ninja"><img src="https://avatars.githubusercontent.com/u/3948961?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Roz</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aroziscoding" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/commits?author=roziscoding" title="Code">💻</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Aroziscoding" title="Reviewed Pull Requests">👀</a> <a href="#infra-roziscoding" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#ideas-roziscoding" title="Ideas, Planning, & Feedback">🤔</a></td>
221
226
  <td align="center"><a href="https://github.com/daniharo"><img src="https://avatars.githubusercontent.com/u/47931084?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dani Haro</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=daniharo" title="Code">💻</a> <a href="#plugin-daniharo" title="Plugin/utility libraries">🔌</a> <a href="https://github.com/grammyjs/grammY/commits?author=daniharo" title="Documentation">📖</a></td>
222
227
  <td align="center"><a href="https://github.com/Ryukaizen"><img src="https://avatars.githubusercontent.com/u/55140313?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ryukaizen</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Ryukaizen" title="Documentation">📖</a></td>
223
228
  <td align="center"><a href="https://github.com/mcpeblocker"><img src="https://avatars.githubusercontent.com/u/59408255?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alisher Ortiqov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=mcpeblocker" title="Documentation">📖</a></td>
@@ -225,6 +230,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
225
230
  <td align="center"><a href="https://github.com/rainrisa"><img src="https://avatars.githubusercontent.com/u/108156134?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ra</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=rainrisa" title="Code">💻</a></td>
226
231
  <td align="center"><a href="https://github.com/sartoshi-foot-dao"><img src="https://avatars.githubusercontent.com/u/99770068?v=4?s=100" width="100px;" alt=""/><br /><sub><b>sartoshi-foot-dao</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=sartoshi-foot-dao" title="Documentation">📖</a></td>
227
232
  </tr>
233
+ <tr>
234
+ <td align="center"><a href="https://github.com/yn4v4s"><img src="https://avatars.githubusercontent.com/u/35275827?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yoel Navas E.</b></sub></a><br /><a href="#ideas-yn4v4s" title="Ideas, Planning, & Feedback">🤔</a></td>
235
+ <td align="center"><a href="https://github.com/vitorleo"><img src="https://avatars.githubusercontent.com/u/5118352?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vitor Gomes</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Avitorleo" title="Bug reports">🐛</a></td>
236
+ <td align="center"><a href="http://xditya.me/"><img src="https://avatars.githubusercontent.com/u/58950863?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aditya</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Axditya" title="Bug reports">🐛</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Axditya" title="Reviewed Pull Requests">👀</a></td>
237
+ </tr>
228
238
  </table>
229
239
 
230
240
  <!-- markdownlint-restore -->
package/out/composer.d.ts CHANGED
@@ -527,7 +527,7 @@ export declare class Composer<C extends Context> implements MiddlewareObj<C> {
527
527
  * @param routeHandlers Handlers for every route
528
528
  * @param fallback Optional fallback middleware if no route matches
529
529
  */
530
- route<R extends Record<string, Middleware<C>>>(router: (ctx: C) => MaybePromise<undefined | keyof R>, routeHandlers: R, fallback?: Middleware<C>): Composer<C>;
530
+ route<R extends Record<PropertyKey, Middleware<C>>>(router: (ctx: C) => MaybePromise<undefined | keyof R>, routeHandlers: R, fallback?: Middleware<C>): Composer<C>;
531
531
  /**
532
532
  * > This is an advanced method of grammY.
533
533
  *
@@ -50,5 +50,15 @@ export declare const adapters: {
50
50
  respond: (json: string) => any;
51
51
  unauthorized: () => any;
52
52
  };
53
+ azure: (context: any, req: any) => {
54
+ update: Promise<any>;
55
+ header: any;
56
+ end: () => {
57
+ status: number;
58
+ body: string;
59
+ };
60
+ respond: (json: string) => void;
61
+ unauthorized: () => void;
62
+ };
53
63
  };
54
64
  export declare const defaultAdapter = "express";
@@ -41,12 +41,29 @@ const awsLambda = (event, _context, callback) => ({
41
41
  respond: (json) => callback(null, { statusCode: 200, body: json }),
42
42
  unauthorized: () => callback(null, { statusCode: 401 }),
43
43
  });
44
+ /** Azure Functions */
45
+ const azure = (context, req) => ({
46
+ update: Promise.resolve(req.body),
47
+ header: context.res.headers[frameworks_shared_js_1.SECRET_HEADER],
48
+ end: () => context.res = {
49
+ status: 200,
50
+ body: "",
51
+ },
52
+ respond: (json) => {
53
+ context.res.set("Content-Type", "application/json");
54
+ context.res.send(json);
55
+ },
56
+ unauthorized: () => {
57
+ context.res.send(401, "secret token is wrong");
58
+ },
59
+ });
44
60
  // please open a PR if you want to add another
45
61
  exports.adapters = {
46
62
  http,
47
63
  https: http,
48
64
  worktop,
49
65
  "aws-lambda": awsLambda,
66
+ azure,
50
67
  ...frameworks_shared_js_1.adapters,
51
68
  };
52
69
  exports.defaultAdapter = "express";
@@ -158,8 +158,9 @@ export declare class Keyboard {
158
158
  */
159
159
  placeholder(value: string): this;
160
160
  /**
161
- * Return the resulting custom keyboard that was built. May be called in the
162
- * end if necessary so you can specify more options in `reply_markup`.
161
+ * Returns the keyboard that was build. Note that it doesn't return
162
+ * `resize_keyboard` or other options that may be set. You don't usually
163
+ * need to call this method. It is no longer useful.
163
164
  */
164
165
  build(): KeyboardButton[][];
165
166
  }
@@ -172,8 +172,9 @@ class Keyboard {
172
172
  return this;
173
173
  }
174
174
  /**
175
- * Return the resulting custom keyboard that was built. May be called in the
176
- * end if necessary so you can specify more options in `reply_markup`.
175
+ * Returns the keyboard that was build. Note that it doesn't return
176
+ * `resize_keyboard` or other options that may be set. You don't usually
177
+ * need to call this method. It is no longer useful.
177
178
  */
178
179
  build() {
179
180
  return this.keyboard;
@@ -136,6 +136,7 @@ exports.lazySession = lazySession;
136
136
  * both in a strict and a lazy way. Works by using `Object.defineProperty` to
137
137
  * install `O[P]`.
138
138
  */
139
+ // deno-lint-ignore ban-types
139
140
  class PropertySession {
140
141
  constructor(storage, obj, prop, initial) {
141
142
  this.storage = storage;
@@ -53,6 +53,16 @@ declare const adapters: {
53
53
  respond: (json: string) => any;
54
54
  unauthorized: () => any;
55
55
  };
56
+ azure: (context: any, req: any) => {
57
+ update: Promise<any>;
58
+ header: any;
59
+ end: () => {
60
+ status: number;
61
+ body: string;
62
+ };
63
+ respond: (json: string) => void;
64
+ unauthorized: () => void;
65
+ };
56
66
  };
57
67
  /**
58
68
  * HTTP Web frameworks for which grammY provides compatible callback out of the
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grammy",
3
3
  "description": "The Telegram Bot Framework.",
4
- "version": "1.11.0",
4
+ "version": "1.11.2",
5
5
  "author": "KnorpelSenf",
6
6
  "license": "MIT",
7
7
  "engines": {