grammy 1.32.0 β†’ 1.34.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,7 +10,7 @@
10
10
 
11
11
  <!-- deno-fmt-ignore-start -->
12
12
 
13
- [![Bot API](https://img.shields.io/badge/Bot%20API-8.0-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-8.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-)
@@ -144,7 +144,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
144
144
  <tr>
145
145
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/KnorpelSenf"><img src="https://avatars.githubusercontent.com/u/12952387?v=4?s=100" width="100px;" alt="KnorpelSenf"/><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> <a href="#audio-KnorpelSenf" title="Audio">πŸ”Š</a> <a href="#a11y-KnorpelSenf" title="Accessibility">️️️️♿️</a> <a href="#talk-KnorpelSenf" title="Talks">πŸ“’</a></td>
146
146
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/HeeroML"><img src="https://avatars.githubusercontent.com/u/42873000?v=4?s=100" width="100px;" alt="Heero"/><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>
147
- <td align="center" valign="top" width="11.11%"><a href="https://github.com/wojpawlik"><img src="https://avatars.githubusercontent.com/u/23058303?v=4?s=100" width="100px;" alt="Wojciech Pawlik"/><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>
147
+ <td align="center" valign="top" width="11.11%"><a href="https://github.com/wojpawlik"><img src="https://avatars.githubusercontent.com/u/23058303?v=4?s=100" width="100px;" alt="Wojciech Pawlik"/><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> <a href="https://github.com/grammyjs/grammY/commits?author=wojpawlik" title="Code">πŸ’»</a></td>
148
148
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/MegaITA"><img src="https://avatars.githubusercontent.com/u/32493080?v=4?s=100" width="100px;" alt="Alessandro Bertozzi"/><br /><sub><b>Alessandro Bertozzi</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=MegaITA" title="Documentation">πŸ“–</a></td>
149
149
  <td align="center" valign="top" width="11.11%"><a href="https://trgwii.no/"><img src="https://avatars.githubusercontent.com/u/11262022?v=4?s=100" width="100px;" alt="trgwii"/><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>
150
150
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/KnightNiwrem"><img src="https://avatars.githubusercontent.com/u/9781814?v=4?s=100" width="100px;" alt="KnightNiwrem"/><br /><sub><b>KnightNiwrem</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=KnightNiwrem" title="Code">πŸ’»</a> <a href="https://github.com/grammyjs/grammY/issues?q=author%3AKnightNiwrem" title="Bug reports">πŸ›</a> <a href="#plugin-KnightNiwrem" title="Plugin/utility libraries">πŸ”Œ</a> <a href="https://github.com/grammyjs/grammY/commits?author=KnightNiwrem" title="Documentation">πŸ“–</a> <a href="#example-KnightNiwrem" title="Examples">πŸ’‘</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3AKnightNiwrem" title="Reviewed Pull Requests">πŸ‘€</a> <a href="#mentoring-KnightNiwrem" title="Mentoring">πŸ§‘β€πŸ«</a></td>
@@ -259,7 +259,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
259
259
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/amanape"><img src="https://avatars.githubusercontent.com/u/83104063?v=4?s=100" width="100px;" alt="Stephan Psaras"/><br /><sub><b>Stephan Psaras</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Aamanape" title="Bug reports">πŸ›</a></td>
260
260
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/shevernitskiy"><img src="https://avatars.githubusercontent.com/u/28886342?v=4?s=100" width="100px;" alt="shevernitskiy"/><br /><sub><b>shevernitskiy</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3Ashevernitskiy" title="Bug reports">πŸ›</a> <a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Ashevernitskiy" title="Reviewed Pull Requests">πŸ‘€</a> <a href="https://github.com/grammyjs/grammY/commits?author=shevernitskiy" title="Code">πŸ’»</a></td>
261
261
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/mrmaster009"><img src="https://avatars.githubusercontent.com/u/81420490?v=4?s=100" width="100px;" alt="mrmaster009"/><br /><sub><b>mrmaster009</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=mrmaster009" title="Documentation">πŸ“–</a></td>
262
- <td align="center" valign="top" width="11.11%"><a href="https://lwjerri.dev/"><img src="https://avatars.githubusercontent.com/u/50290430?v=4?s=100" width="100px;" alt="Andrey Zontov"/><br /><sub><b>Andrey Zontov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3ALWJerri" title="Bug reports">πŸ›</a> <a href="https://github.com/grammyjs/grammY/commits?author=LWJerri" title="Code">πŸ’»</a> <a href="#question-LWJerri" title="Answering Questions">πŸ’¬</a> <a href="#ideas-LWJerri" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/grammyjs/grammY/commits?author=LWJerri" title="Documentation">πŸ“–</a> <a href="#translation-LWJerri" title="Translation">🌍</a></td>
262
+ <td align="center" valign="top" width="11.11%"><a href="https://lwjerri.dev"><img src="https://avatars.githubusercontent.com/u/50290430?v=4?s=100" width="100px;" alt="Andrii Zontov"/><br /><sub><b>Andrii Zontov</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/issues?q=author%3ALWJerri" title="Bug reports">πŸ›</a> <a href="https://github.com/grammyjs/grammY/commits?author=LWJerri" title="Code">πŸ’»</a> <a href="#question-LWJerri" title="Answering Questions">πŸ’¬</a> <a href="#ideas-LWJerri" title="Ideas, Planning, & Feedback">πŸ€”</a> <a href="https://github.com/grammyjs/grammY/commits?author=LWJerri" title="Documentation">πŸ“–</a> <a href="#translation-LWJerri" title="Translation">🌍</a></td>
263
263
  <td align="center" valign="top" width="11.11%"><a href="https://github.com/AbbassAlmusawi"><img src="https://avatars.githubusercontent.com/u/73327881?v=4?s=100" width="100px;" alt="Abbass Al-Musawi"/><br /><sub><b>Abbass Al-Musawi</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=AbbassAlmusawi" title="Documentation">πŸ“–</a> <a href="https://github.com/grammyjs/grammY/issues?q=author%3AAbbassAlmusawi" title="Bug reports">πŸ›</a> <a href="https://github.com/grammyjs/grammY/commits?author=AbbassAlmusawi" title="Code">πŸ’»</a></td>
264
264
  </tr>
265
265
  <tr>
@@ -319,6 +319,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
319
319
  </tr>
320
320
  <tr>
321
321
  <td align="center" valign="top" width="11.11%"><a href="https://www.vorant94.io/"><img src="https://avatars.githubusercontent.com/u/9719319?v=4?s=100" width="100px;" alt="Mordechai Dror"/><br /><sub><b>Mordechai Dror</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/pulls?q=is%3Apr+reviewed-by%3Avorant94" title="Reviewed Pull Requests">πŸ‘€</a></td>
322
+ <td align="center" valign="top" width="11.11%"><a href="https://github.com/mahovich"><img src="https://avatars.githubusercontent.com/u/2377626?v=4?s=100" width="100px;" alt="mahovich"/><br /><sub><b>mahovich</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=mahovich" title="Documentation">πŸ“–</a></td>
323
+ <td align="center" valign="top" width="11.11%"><a href="https://github.com/Hth4nh"><img src="https://avatars.githubusercontent.com/u/63627651?v=4?s=100" width="100px;" alt="ThΓ nh HoΓ ng TrαΊ§n"/><br /><sub><b>ThΓ nh HoΓ ng TrαΊ§n</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=Hth4nh" title="Documentation">πŸ“–</a></td>
324
+ <td align="center" valign="top" width="11.11%"><a href="https://github.com/ikelax"><img src="https://avatars.githubusercontent.com/u/163678144?v=4?s=100" width="100px;" alt="ikelax"/><br /><sub><b>ikelax</b></sub></a><br /><a href="https://github.com/grammyjs/grammY/commits?author=ikelax" title="Documentation">πŸ“–</a></td>
322
325
  </tr>
323
326
  </tbody>
324
327
  </table>
package/out/context.d.ts CHANGED
@@ -1409,6 +1409,40 @@ export declare class Context implements RenamedUpdate {
1409
1409
  * **Official reference:** https://core.telegram.org/bots/api#edituserstarsubscription
1410
1410
  */
1411
1411
  editUserStarSubscription(telegram_payment_charge_id: string, is_canceled: boolean, signal?: AbortSignal): Promise<true>;
1412
+ /**
1413
+ * Context-aware alias for `api.verifyUser`. Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.
1414
+ *
1415
+ * @param other Optional remaining parameters, confer the official reference below
1416
+ * @param signal Optional `AbortSignal` to cancel the request
1417
+ *
1418
+ * **Official reference:** https://core.telegram.org/bots/api#verifyuser
1419
+ */
1420
+ verifyUser(other?: Other<"verifyUser">, signal?: AbortSignal): Promise<true>;
1421
+ /**
1422
+ * Context-aware alias for `api.verifyChat`. Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.
1423
+ *
1424
+ * @param other Optional remaining parameters, confer the official reference below
1425
+ * @param signal Optional `AbortSignal` to cancel the request
1426
+ *
1427
+ * **Official reference:** https://core.telegram.org/bots/api#verifychat
1428
+ */
1429
+ verifyChat(other?: Other<"verifyChat">, signal?: AbortSignal): Promise<true>;
1430
+ /**
1431
+ * Context-aware alias for `api.removeUserVerification`. Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.
1432
+ *
1433
+ * @param signal Optional `AbortSignal` to cancel the request
1434
+ *
1435
+ * **Official reference:** https://core.telegram.org/bots/api#removeuserverification
1436
+ */
1437
+ removeUserVerification(signal?: AbortSignal): Promise<true>;
1438
+ /**
1439
+ * Context-aware alias for `api.removeChatVerification`. Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.
1440
+ *
1441
+ * @param signal Optional `AbortSignal` to cancel the request
1442
+ *
1443
+ * **Official reference:** https://core.telegram.org/bots/api#removechatverification
1444
+ */
1445
+ removeChatVerification(signal?: AbortSignal): Promise<true>;
1412
1446
  /**
1413
1447
  * Context-aware alias for `api.setPassportDataErrors`. Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
1414
1448
  *
package/out/context.js CHANGED
@@ -1846,6 +1846,48 @@ class Context {
1846
1846
  editUserStarSubscription(telegram_payment_charge_id, is_canceled, signal) {
1847
1847
  return this.api.editUserStarSubscription(orThrow(this.from, "editUserStarSubscription").id, telegram_payment_charge_id, is_canceled, signal);
1848
1848
  }
1849
+ /**
1850
+ * Context-aware alias for `api.verifyUser`. Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.
1851
+ *
1852
+ * @param other Optional remaining parameters, confer the official reference below
1853
+ * @param signal Optional `AbortSignal` to cancel the request
1854
+ *
1855
+ * **Official reference:** https://core.telegram.org/bots/api#verifyuser
1856
+ */
1857
+ verifyUser(other, signal) {
1858
+ return this.api.verifyUser(orThrow(this.from, "verifyUser").id, other, signal);
1859
+ }
1860
+ /**
1861
+ * Context-aware alias for `api.verifyChat`. Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.
1862
+ *
1863
+ * @param other Optional remaining parameters, confer the official reference below
1864
+ * @param signal Optional `AbortSignal` to cancel the request
1865
+ *
1866
+ * **Official reference:** https://core.telegram.org/bots/api#verifychat
1867
+ */
1868
+ verifyChat(other, signal) {
1869
+ return this.api.verifyChat(orThrow(this.chatId, "verifyChat"), other, signal);
1870
+ }
1871
+ /**
1872
+ * Context-aware alias for `api.removeUserVerification`. Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.
1873
+ *
1874
+ * @param signal Optional `AbortSignal` to cancel the request
1875
+ *
1876
+ * **Official reference:** https://core.telegram.org/bots/api#removeuserverification
1877
+ */
1878
+ removeUserVerification(signal) {
1879
+ return this.api.removeUserVerification(orThrow(this.from, "removeUserVerification").id, signal);
1880
+ }
1881
+ /**
1882
+ * Context-aware alias for `api.removeChatVerification`. Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.
1883
+ *
1884
+ * @param signal Optional `AbortSignal` to cancel the request
1885
+ *
1886
+ * **Official reference:** https://core.telegram.org/bots/api#removechatverification
1887
+ */
1888
+ removeChatVerification(signal) {
1889
+ return this.api.removeChatVerification(orThrow(this.chatId, "removeChatVerification"), signal);
1890
+ }
1849
1891
  /**
1850
1892
  * Context-aware alias for `api.setPassportDataErrors`. Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
1851
1893
  *
@@ -97,7 +97,7 @@ export type HonoAdapter = (c: {
97
97
  json: <T>() => Promise<T>;
98
98
  header: (header: string) => string | undefined;
99
99
  };
100
- body: (data: string | ArrayBuffer | ReadableStream | null, arg?: any, headers?: Record<string, string | string[]>) => Response;
100
+ body: (data: string | ArrayBuffer | ReadableStream, arg?: any, headers?: Record<string, string | string[]>) => Response;
101
101
  status: (status: any) => void;
102
102
  json: (json: string) => Response;
103
103
  }) => ReqResHandler<Response>;
@@ -157,14 +157,14 @@ const hono = (c) => {
157
157
  update: c.req.json(),
158
158
  header: c.req.header(SECRET_HEADER),
159
159
  end: () => {
160
- resolveResponse(c.body(null));
160
+ resolveResponse(c.body(""));
161
161
  },
162
162
  respond: (json) => {
163
163
  resolveResponse(c.json(json));
164
164
  },
165
165
  unauthorized: () => {
166
166
  c.status(401);
167
- resolveResponse(c.body(null));
167
+ resolveResponse(c.body(""));
168
168
  },
169
169
  handlerReturn: new Promise((resolve) => {
170
170
  resolveResponse = resolve;
@@ -109,6 +109,15 @@ export interface SessionOptions<S, C extends Context = Context> {
109
109
  * session data.
110
110
  */
111
111
  initial?: () => S;
112
+ /**
113
+ * An optional prefix to prepend to the session key after it was generated.
114
+ *
115
+ * This makes it easier to store session data under a namespace. You can
116
+ * technically achieve the same functionality by returning an already
117
+ * prefixed key from `getSessionKey`. This option is merely more convenient,
118
+ * as it does not require you to think about session key generation.
119
+ */
120
+ prefix?: string;
112
121
  /**
113
122
  * This option lets you generate your own session keys per context object.
114
123
  * The session key determines how to map the different session objects to
@@ -236,13 +236,21 @@ class PropertySession {
236
236
  }
237
237
  }
238
238
  function fillDefaults(opts = {}) {
239
- let { getSessionKey = defaultGetSessionKey, initial, storage } = opts;
239
+ let { prefix = "", getSessionKey = defaultGetSessionKey, initial, storage, } = opts;
240
240
  if (storage == null) {
241
241
  debug("Storing session data in memory, all data will be lost when the bot restarts.");
242
242
  storage = new MemorySessionStorage();
243
243
  }
244
244
  const custom = getSessionKey !== defaultGetSessionKey;
245
- return { initial, storage, getSessionKey, custom };
245
+ return {
246
+ initial,
247
+ storage,
248
+ getSessionKey: async (ctx) => {
249
+ const key = await getSessionKey(ctx);
250
+ return key === undefined ? undefined : prefix + key;
251
+ },
252
+ custom,
253
+ };
246
254
  }
247
255
  /** Stores session data per chat by default */
248
256
  function defaultGetSessionKey(ctx) {
package/out/core/api.d.ts CHANGED
@@ -1498,6 +1498,44 @@ export declare class Api<R extends RawApi = RawApi> {
1498
1498
  * **Official reference:** https://core.telegram.org/bots/api#edituserstarsubscription
1499
1499
  */
1500
1500
  editUserStarSubscription(user_id: number, telegram_payment_charge_id: string, is_canceled: boolean, signal?: AbortSignal): Promise<true>;
1501
+ /**
1502
+ * Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.
1503
+ *
1504
+ * @param user_id Unique identifier of the target user
1505
+ * @param other Optional remaining parameters, confer the official reference below
1506
+ * @param signal Optional `AbortSignal` to cancel the request
1507
+ *
1508
+ * **Official reference:** https://core.telegram.org/bots/api#verifyuser
1509
+ */
1510
+ verifyUser(user_id: number, other?: Other<R, "verifyUser">, signal?: AbortSignal): Promise<true>;
1511
+ /**
1512
+ * Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.
1513
+ *
1514
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1515
+ * @param other Optional remaining parameters, confer the official reference below
1516
+ * @param signal Optional `AbortSignal` to cancel the request
1517
+ *
1518
+ * **Official reference:** https://core.telegram.org/bots/api#verifychat
1519
+ */
1520
+ verifyChat(chat_id: number | string, other?: Other<R, "verifyChat">, signal?: AbortSignal): Promise<true>;
1521
+ /**
1522
+ * Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.
1523
+ *
1524
+ * @param user_id Unique identifier of the target user
1525
+ * @param signal Optional `AbortSignal` to cancel the request
1526
+ *
1527
+ * **Official reference:** https://core.telegram.org/bots/api#removeuserverification
1528
+ */
1529
+ removeUserVerification(user_id: number, signal?: AbortSignal): Promise<true>;
1530
+ /**
1531
+ * Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.
1532
+ *
1533
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1534
+ * @param signal Optional `AbortSignal` to cancel the request
1535
+ *
1536
+ * **Official reference:** https://core.telegram.org/bots/api#removechatverification
1537
+ */
1538
+ removeChatVerification(chat_id: number | string, signal?: AbortSignal): Promise<true>;
1501
1539
  /**
1502
1540
  * Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
1503
1541
  *
package/out/core/api.js CHANGED
@@ -1759,6 +1759,52 @@ class Api {
1759
1759
  editUserStarSubscription(user_id, telegram_payment_charge_id, is_canceled, signal) {
1760
1760
  return this.raw.editUserStarSubscription({ user_id, telegram_payment_charge_id, is_canceled }, signal);
1761
1761
  }
1762
+ /**
1763
+ * Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.
1764
+ *
1765
+ * @param user_id Unique identifier of the target user
1766
+ * @param other Optional remaining parameters, confer the official reference below
1767
+ * @param signal Optional `AbortSignal` to cancel the request
1768
+ *
1769
+ * **Official reference:** https://core.telegram.org/bots/api#verifyuser
1770
+ */
1771
+ verifyUser(user_id, other, signal) {
1772
+ return this.raw.verifyUser({ user_id, ...other }, signal);
1773
+ }
1774
+ /**
1775
+ * Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.
1776
+ *
1777
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1778
+ * @param other Optional remaining parameters, confer the official reference below
1779
+ * @param signal Optional `AbortSignal` to cancel the request
1780
+ *
1781
+ * **Official reference:** https://core.telegram.org/bots/api#verifychat
1782
+ */
1783
+ verifyChat(chat_id, other, signal) {
1784
+ return this.raw.verifyChat({ chat_id, ...other }, signal);
1785
+ }
1786
+ /**
1787
+ * Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.
1788
+ *
1789
+ * @param user_id Unique identifier of the target user
1790
+ * @param signal Optional `AbortSignal` to cancel the request
1791
+ *
1792
+ * **Official reference:** https://core.telegram.org/bots/api#removeuserverification
1793
+ */
1794
+ removeUserVerification(user_id, signal) {
1795
+ return this.raw.removeUserVerification({ user_id }, signal);
1796
+ }
1797
+ /**
1798
+ * Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.
1799
+ *
1800
+ * @param chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1801
+ * @param signal Optional `AbortSignal` to cancel the request
1802
+ *
1803
+ * **Official reference:** https://core.telegram.org/bots/api#removechatverification
1804
+ */
1805
+ removeChatVerification(chat_id, signal) {
1806
+ return this.raw.removeChatVerification({ chat_id }, signal);
1807
+ }
1762
1808
  /**
1763
1809
  * Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
1764
1810
  *
package/out/web.mjs CHANGED
@@ -1106,6 +1106,18 @@ class Context {
1106
1106
  editUserStarSubscription(telegram_payment_charge_id, is_canceled, signal) {
1107
1107
  return this.api.editUserStarSubscription(orThrow(this.from, "editUserStarSubscription").id, telegram_payment_charge_id, is_canceled, signal);
1108
1108
  }
1109
+ verifyUser(other, signal) {
1110
+ return this.api.verifyUser(orThrow(this.from, "verifyUser").id, other, signal);
1111
+ }
1112
+ verifyChat(other, signal) {
1113
+ return this.api.verifyChat(orThrow(this.chatId, "verifyChat"), other, signal);
1114
+ }
1115
+ removeUserVerification(signal) {
1116
+ return this.api.removeUserVerification(orThrow(this.from, "removeUserVerification").id, signal);
1117
+ }
1118
+ removeChatVerification(signal) {
1119
+ return this.api.removeChatVerification(orThrow(this.chatId, "removeChatVerification"), signal);
1120
+ }
1109
1121
  setPassportDataErrors(errors, signal) {
1110
1122
  return this.api.setPassportDataErrors(orThrow(this.from, "setPassportDataErrors").id, errors, signal);
1111
1123
  }
@@ -3294,6 +3306,28 @@ class Api {
3294
3306
  is_canceled
3295
3307
  }, signal);
3296
3308
  }
3309
+ verifyUser(user_id, other, signal) {
3310
+ return this.raw.verifyUser({
3311
+ user_id,
3312
+ ...other
3313
+ }, signal);
3314
+ }
3315
+ verifyChat(chat_id, other, signal) {
3316
+ return this.raw.verifyChat({
3317
+ chat_id,
3318
+ ...other
3319
+ }, signal);
3320
+ }
3321
+ removeUserVerification(user_id, signal) {
3322
+ return this.raw.removeUserVerification({
3323
+ user_id
3324
+ }, signal);
3325
+ }
3326
+ removeChatVerification(chat_id, signal) {
3327
+ return this.raw.removeChatVerification({
3328
+ chat_id
3329
+ }, signal);
3330
+ }
3297
3331
  setPassportDataErrors(user_id, errors, signal) {
3298
3332
  return this.raw.setPassportDataErrors({
3299
3333
  user_id,
@@ -4482,7 +4516,7 @@ class PropertySession {
4482
4516
  }
4483
4517
  }
4484
4518
  function fillDefaults(opts = {}) {
4485
- let { getSessionKey = defaultGetSessionKey, initial, storage } = opts;
4519
+ let { prefix = "", getSessionKey = defaultGetSessionKey, initial, storage } = opts;
4486
4520
  if (storage == null) {
4487
4521
  debug3("Storing session data in memory, all data will be lost when the bot restarts.");
4488
4522
  storage = new MemorySessionStorage();
@@ -4491,7 +4525,10 @@ function fillDefaults(opts = {}) {
4491
4525
  return {
4492
4526
  initial,
4493
4527
  storage,
4494
- getSessionKey,
4528
+ getSessionKey: async (ctx)=>{
4529
+ const key = await getSessionKey(ctx);
4530
+ return key === undefined ? undefined : prefix + key;
4531
+ },
4495
4532
  custom
4496
4533
  };
4497
4534
  }
@@ -4808,14 +4845,14 @@ const hono = (c)=>{
4808
4845
  update: c.req.json(),
4809
4846
  header: c.req.header(SECRET_HEADER),
4810
4847
  end: ()=>{
4811
- resolveResponse(c.body(null));
4848
+ resolveResponse(c.body(""));
4812
4849
  },
4813
4850
  respond: (json)=>{
4814
4851
  resolveResponse(c.json(json));
4815
4852
  },
4816
4853
  unauthorized: ()=>{
4817
4854
  c.status(401);
4818
- resolveResponse(c.body(null));
4855
+ resolveResponse(c.body(""));
4819
4856
  },
4820
4857
  handlerReturn: new Promise((resolve)=>{
4821
4858
  resolveResponse = resolve;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grammy",
3
3
  "description": "The Telegram Bot Framework.",
4
- "version": "1.32.0",
4
+ "version": "1.34.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.16.0",
20
+ "@grammyjs/types": "3.18.0",
21
21
  "abort-controller": "^3.0.0",
22
22
  "debug": "^4.3.4",
23
23
  "node-fetch": "^2.7.0"