grammy 1.6.0 → 1.6.1

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/out/composer.js CHANGED
@@ -45,7 +45,7 @@ function generateBotErrorMessage(error) {
45
45
  msg += `: ${error}`;
46
46
  break;
47
47
  case "string":
48
- msg += `: ${String(error).substr(0, 50)}`;
48
+ msg += `: ${String(error).substring(0, 50)}`;
49
49
  break;
50
50
  default:
51
51
  msg += "!";
@@ -299,24 +299,23 @@ class Composer {
299
299
  const noAtCommands = new Set();
300
300
  toArray(command).forEach((cmd) => {
301
301
  if (cmd.startsWith("/")) {
302
- throw new Error(`Do not include '/' when registering command handlers (use '${cmd.substr(1)}' not '${cmd}')`);
302
+ throw new Error(`Do not include '/' when registering command handlers (use '${cmd.substring(1)}' not '${cmd}')`);
303
303
  }
304
304
  const set = cmd.indexOf("@") === -1 ? noAtCommands : atCommands;
305
305
  set.add(cmd);
306
306
  });
307
307
  return this.on(":entities:bot_command").filter((ctx) => {
308
- var _a, _b, _c;
308
+ var _a;
309
309
  const msg = (_a = ctx.message) !== null && _a !== void 0 ? _a : ctx.channelPost;
310
- const txt = (_b = msg.text) !== null && _b !== void 0 ? _b : msg.caption;
311
- const entities = (_c = msg.entities) !== null && _c !== void 0 ? _c : msg.caption_entities;
312
- return entities.some((e) => {
310
+ const txt = msg.text;
311
+ return msg.entities.some((e) => {
313
312
  if (e.type !== "bot_command")
314
313
  return false;
315
314
  if (e.offset !== 0)
316
315
  return false;
317
316
  const cmd = txt.substring(1, e.length);
318
317
  if (noAtCommands.has(cmd) || atCommands.has(cmd)) {
319
- ctx.match = txt.substr(cmd.length + 1).trimStart();
318
+ ctx.match = txt.substring(cmd.length + 1).trimStart();
320
319
  return true;
321
320
  }
322
321
  const index = cmd.indexOf("@");
@@ -327,7 +326,7 @@ class Composer {
327
326
  return false;
328
327
  const atCommand = cmd.substring(0, index);
329
328
  if (noAtCommands.has(atCommand)) {
330
- ctx.match = txt.substr(cmd.length + 1).trimStart();
329
+ ctx.match = txt.substring(cmd.length + 1).trimStart();
331
330
  return true;
332
331
  }
333
332
  return false;
@@ -97,7 +97,7 @@ class ApiClient {
97
97
  sensitiveLogs: (_d = options.sensitiveLogs) !== null && _d !== void 0 ? _d : false,
98
98
  };
99
99
  if (this.options.apiRoot.endsWith("/")) {
100
- throw new Error(`Remove the trailing '/' from the 'apiRoot' option (use '${this.options.apiRoot.substr(0, this.options.apiRoot.length - 1)}' instead of '${this.options.apiRoot}')`);
100
+ throw new Error(`Remove the trailing '/' from the 'apiRoot' option (use '${this.options.apiRoot.substring(0, this.options.apiRoot.length - 1)}' instead of '${this.options.apiRoot}')`);
101
101
  }
102
102
  }
103
103
  use(...transformers) {
package/out/filter.d.ts CHANGED
@@ -82,6 +82,7 @@ declare const UPDATE_KEYS: {
82
82
  readonly italic: {};
83
83
  readonly underline: {};
84
84
  readonly strikethrough: {};
85
+ readonly spoiler: {};
85
86
  readonly code: {};
86
87
  readonly pre: {};
87
88
  readonly text_link: {};
@@ -99,6 +100,7 @@ declare const UPDATE_KEYS: {
99
100
  readonly italic: {};
100
101
  readonly underline: {};
101
102
  readonly strikethrough: {};
103
+ readonly spoiler: {};
102
104
  readonly code: {};
103
105
  readonly pre: {};
104
106
  readonly text_link: {};
@@ -162,6 +164,7 @@ declare const UPDATE_KEYS: {
162
164
  readonly italic: {};
163
165
  readonly underline: {};
164
166
  readonly strikethrough: {};
167
+ readonly spoiler: {};
165
168
  readonly code: {};
166
169
  readonly pre: {};
167
170
  readonly text_link: {};
@@ -179,6 +182,7 @@ declare const UPDATE_KEYS: {
179
182
  readonly italic: {};
180
183
  readonly underline: {};
181
184
  readonly strikethrough: {};
185
+ readonly spoiler: {};
182
186
  readonly code: {};
183
187
  readonly pre: {};
184
188
  readonly text_link: {};
@@ -228,6 +232,7 @@ declare const UPDATE_KEYS: {
228
232
  readonly italic: {};
229
233
  readonly underline: {};
230
234
  readonly strikethrough: {};
235
+ readonly spoiler: {};
231
236
  readonly code: {};
232
237
  readonly pre: {};
233
238
  readonly text_link: {};
@@ -245,6 +250,7 @@ declare const UPDATE_KEYS: {
245
250
  readonly italic: {};
246
251
  readonly underline: {};
247
252
  readonly strikethrough: {};
253
+ readonly spoiler: {};
248
254
  readonly code: {};
249
255
  readonly pre: {};
250
256
  readonly text_link: {};
@@ -294,6 +300,7 @@ declare const UPDATE_KEYS: {
294
300
  readonly italic: {};
295
301
  readonly underline: {};
296
302
  readonly strikethrough: {};
303
+ readonly spoiler: {};
297
304
  readonly code: {};
298
305
  readonly pre: {};
299
306
  readonly text_link: {};
@@ -311,6 +318,7 @@ declare const UPDATE_KEYS: {
311
318
  readonly italic: {};
312
319
  readonly underline: {};
313
320
  readonly strikethrough: {};
321
+ readonly spoiler: {};
314
322
  readonly code: {};
315
323
  readonly pre: {};
316
324
  readonly text_link: {};
package/out/filter.js CHANGED
@@ -203,6 +203,7 @@ const ENTITY_KEYS = {
203
203
  italic: {},
204
204
  underline: {},
205
205
  strikethrough: {},
206
+ spoiler: {},
206
207
  code: {},
207
208
  pre: {},
208
209
  text_link: {},
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "grammy",
3
3
  "description": "The Telegram Bot Framework.",
4
- "version": "1.6.0",
4
+ "version": "1.6.1",
5
5
  "author": "KnorpelSenf",
6
6
  "license": "MIT",
7
7
  "engines": {
@@ -23,7 +23,7 @@
23
23
  "contribs": "all-contributors"
24
24
  },
25
25
  "dependencies": {
26
- "@grammyjs/types": "^2.5.0",
26
+ "@grammyjs/types": "^2.5.1",
27
27
  "abort-controller": "^3.0.0",
28
28
  "debug": "^4.3.3",
29
29
  "node-fetch": "^2.6.5"