gramio 0.2.0 → 0.2.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/dist/index.cjs CHANGED
@@ -306,6 +306,11 @@ class Plugin {
306
306
  }
307
307
  return this;
308
308
  }
309
+ /**
310
+ * ! ** At the moment, it can only pick up types** */
311
+ extend(plugin) {
312
+ return this;
313
+ }
309
314
  }
310
315
  _init$1 = __decoratorStart$1();
311
316
  Plugin = __decorateElement$1(_init$1, 0, "Plugin", _Plugin_decorators, Plugin);
@@ -468,11 +473,12 @@ _Bot_decorators = [inspectable.Inspectable({
468
473
  serialize: () => ({})
469
474
  })];
470
475
  class Bot {
476
+ /** @deprecated use `~` instead*/
471
477
  _ = {
472
- /** @internal. Remap generic */
478
+ /** @deprecated @internal. Remap generic */
473
479
  derives: {}
474
480
  };
475
- /** @internal. Remap generic */
481
+ /** @deprecated use `~.derives` instead @internal. Remap generic */
476
482
  __Derives;
477
483
  "~" = this._;
478
484
  filters = {
@@ -566,7 +572,7 @@ class Bot {
566
572
  }
567
573
  async _callApi(method, params = {}) {
568
574
  const debug$api$method = debug$api.extend(method);
569
- const url = `${this.options.api.baseURL}${this.options.token}/${method}`;
575
+ const url = `${this.options.api.baseURL}${this.options.token}/${this.options.api.useTest ? "test/" : ""}${method}`;
570
576
  const reqOptions = {
571
577
  method: "POST",
572
578
  ...this.options.api.fetchOptions,
package/dist/index.d.cts CHANGED
@@ -307,6 +307,9 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
307
307
  */
308
308
  onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<Bot, T> & Derives["global"] & Derives[T]>): this;
309
309
  onError(handler: Hooks.OnError<Errors, Context<AnyBot> & Derives["global"]>): this;
310
+ /**
311
+ * ! ** At the moment, it can only pick up types** */
312
+ extend<NewPlugin extends AnyPlugin>(plugin: MaybePromise<NewPlugin>): Plugin<Errors & NewPlugin["_"]["Errors"], Derives & NewPlugin["_"]["Derives"]>;
310
313
  }
311
314
 
312
315
  /** Bot options that you can provide to {@link Bot} constructor */
@@ -595,14 +598,15 @@ declare class Updates {
595
598
  * ```
596
599
  */
597
600
  declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDefinitions = DeriveDefinitions> {
601
+ /** @deprecated use `~` instead*/
598
602
  _: {
599
- /** @internal. Remap generic */
603
+ /** @deprecated @internal. Remap generic */
600
604
  derives: Derives;
601
605
  };
602
- /** @internal. Remap generic */
606
+ /** @deprecated use `~.derives` instead @internal. Remap generic */
603
607
  __Derives: Derives;
604
608
  "~": {
605
- /** @internal. Remap generic */
609
+ /** @deprecated @internal. Remap generic */
606
610
  derives: Derives;
607
611
  };
608
612
  private filters;
package/dist/index.d.ts CHANGED
@@ -307,6 +307,9 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
307
307
  */
308
308
  onError<T extends UpdateName>(updateName: MaybeArray<T>, handler: Hooks.OnError<Errors, ContextType<Bot, T> & Derives["global"] & Derives[T]>): this;
309
309
  onError(handler: Hooks.OnError<Errors, Context<AnyBot> & Derives["global"]>): this;
310
+ /**
311
+ * ! ** At the moment, it can only pick up types** */
312
+ extend<NewPlugin extends AnyPlugin>(plugin: MaybePromise<NewPlugin>): Plugin<Errors & NewPlugin["_"]["Errors"], Derives & NewPlugin["_"]["Derives"]>;
310
313
  }
311
314
 
312
315
  /** Bot options that you can provide to {@link Bot} constructor */
@@ -595,14 +598,15 @@ declare class Updates {
595
598
  * ```
596
599
  */
597
600
  declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDefinitions = DeriveDefinitions> {
601
+ /** @deprecated use `~` instead*/
598
602
  _: {
599
- /** @internal. Remap generic */
603
+ /** @deprecated @internal. Remap generic */
600
604
  derives: Derives;
601
605
  };
602
- /** @internal. Remap generic */
606
+ /** @deprecated use `~.derives` instead @internal. Remap generic */
603
607
  __Derives: Derives;
604
608
  "~": {
605
- /** @internal. Remap generic */
609
+ /** @deprecated @internal. Remap generic */
606
610
  derives: Derives;
607
611
  };
608
612
  private filters;
package/dist/index.js CHANGED
@@ -308,6 +308,11 @@ class Plugin {
308
308
  }
309
309
  return this;
310
310
  }
311
+ /**
312
+ * ! ** At the moment, it can only pick up types** */
313
+ extend(plugin) {
314
+ return this;
315
+ }
311
316
  }
312
317
  _init$1 = __decoratorStart$1();
313
318
  Plugin = __decorateElement$1(_init$1, 0, "Plugin", _Plugin_decorators, Plugin);
@@ -470,11 +475,12 @@ _Bot_decorators = [Inspectable({
470
475
  serialize: () => ({})
471
476
  })];
472
477
  class Bot {
478
+ /** @deprecated use `~` instead*/
473
479
  _ = {
474
- /** @internal. Remap generic */
480
+ /** @deprecated @internal. Remap generic */
475
481
  derives: {}
476
482
  };
477
- /** @internal. Remap generic */
483
+ /** @deprecated use `~.derives` instead @internal. Remap generic */
478
484
  __Derives;
479
485
  "~" = this._;
480
486
  filters = {
@@ -568,7 +574,7 @@ class Bot {
568
574
  }
569
575
  async _callApi(method, params = {}) {
570
576
  const debug$api$method = debug$api.extend(method);
571
- const url = `${this.options.api.baseURL}${this.options.token}/${method}`;
577
+ const url = `${this.options.api.baseURL}${this.options.token}/${this.options.api.useTest ? "test/" : ""}${method}`;
572
578
  const reqOptions = {
573
579
  method: "POST",
574
580
  ...this.options.api.fetchOptions,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gramio",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "description": "Powerful, extensible and really type-safe Telegram Bot API framework",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",