@mtkruto/node 0.0.987 → 0.0.988

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.
@@ -308,13 +308,11 @@ export declare class Client extends ClientAbstract {
308
308
  private handleUpdate;
309
309
  handler: Handler;
310
310
  use(middleware: Handler): void;
311
- on<U extends keyof Update, K extends null | keyof Update[U] = null>(filter: Update[U] extends string ? U : U | [U, K, ...K[]], handler: Handler<Pick<Update, U> & {
312
- [P in U]: K extends keyof Update[U] ? With<Update[U], K> : Update[U];
313
- }>): void;
311
+ on<U extends keyof Update, K extends keyof Update[U]>(filter: Update[U] extends string ? U : U | [U, ...K[]], handler: Handler<Pick<{
312
+ [P in U]: With<Update[U], K>;
313
+ }, U>>): void;
314
314
  }
315
- type With<T, K extends keyof T> = T & Required<{
316
- [P in K]: T[P];
317
- }>;
315
+ type With<T, K extends keyof T> = T & Required<Pick<T, K>>;
318
316
  export type ConnectionState = "not-connected" | "updating" | "ready";
319
317
  export interface Update {
320
318
  message: Message;
@@ -802,7 +802,7 @@ export class Client extends ClientAbstract {
802
802
  if (currentPts === undefined) {
803
803
  currentPts = await this.storage.getChannelPts(channelId);
804
804
  }
805
- currentPts ??= update.pts;
805
+ currentPts ??= update.pts - ptsCount;
806
806
  if (currentPts + ptsCount > update.pts) {
807
807
  updates = updates.filter((v) => v != update);
808
808
  }
@@ -1443,11 +1443,11 @@ export class Client extends ClientAbstract {
1443
1443
  const handler = this.handler;
1444
1444
  this.handler = async (upd, next) => {
1445
1445
  let called = false;
1446
- await middleware(upd, async () => {
1446
+ await handler(upd, async () => {
1447
1447
  if (called)
1448
1448
  return;
1449
1449
  called = true;
1450
- await handler(upd, next);
1450
+ await middleware(upd, next);
1451
1451
  });
1452
1452
  };
1453
1453
  }
@@ -5,7 +5,7 @@ export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const VECTOR_CONSTRUCTOR = 481674261;
6
6
  export declare const INITIAL_DC: DC;
7
7
  export declare const LAYER = 161;
8
- export declare const APP_VERSION = "MTKruto 0.0.987";
8
+ export declare const APP_VERSION = "MTKruto 0.0.988";
9
9
  export declare const DEVICE_MODEL: string;
10
10
  export declare const LANG_CODE: string;
11
11
  export declare const LANG_PACK = "";
package/esm/constants.js CHANGED
@@ -54,7 +54,7 @@ export const PUBLIC_KEYS = Object.freeze([
54
54
  export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
55
55
  export const INITIAL_DC = "2-test";
56
56
  export const LAYER = 161;
57
- export const APP_VERSION = "MTKruto 0.0.987";
57
+ export const APP_VERSION = "MTKruto 0.0.988";
58
58
  // @ts-ignore: lib
59
59
  export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
60
60
  export const LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/mod.js",
3
3
  "main": "./script/mod.js",
4
4
  "name": "@mtkruto/node",
5
- "version": "0.0.987",
5
+ "version": "0.0.988",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -308,13 +308,11 @@ export declare class Client extends ClientAbstract {
308
308
  private handleUpdate;
309
309
  handler: Handler;
310
310
  use(middleware: Handler): void;
311
- on<U extends keyof Update, K extends null | keyof Update[U] = null>(filter: Update[U] extends string ? U : U | [U, K, ...K[]], handler: Handler<Pick<Update, U> & {
312
- [P in U]: K extends keyof Update[U] ? With<Update[U], K> : Update[U];
313
- }>): void;
311
+ on<U extends keyof Update, K extends keyof Update[U]>(filter: Update[U] extends string ? U : U | [U, ...K[]], handler: Handler<Pick<{
312
+ [P in U]: With<Update[U], K>;
313
+ }, U>>): void;
314
314
  }
315
- type With<T, K extends keyof T> = T & Required<{
316
- [P in K]: T[P];
317
- }>;
315
+ type With<T, K extends keyof T> = T & Required<Pick<T, K>>;
318
316
  export type ConnectionState = "not-connected" | "updating" | "ready";
319
317
  export interface Update {
320
318
  message: Message;
@@ -828,7 +828,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
828
828
  if (currentPts === undefined) {
829
829
  currentPts = await this.storage.getChannelPts(channelId);
830
830
  }
831
- currentPts ??= update.pts;
831
+ currentPts ??= update.pts - ptsCount;
832
832
  if (currentPts + ptsCount > update.pts) {
833
833
  updates = updates.filter((v) => v != update);
834
834
  }
@@ -1469,11 +1469,11 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1469
1469
  const handler = this.handler;
1470
1470
  this.handler = async (upd, next) => {
1471
1471
  let called = false;
1472
- await middleware(upd, async () => {
1472
+ await handler(upd, async () => {
1473
1473
  if (called)
1474
1474
  return;
1475
1475
  called = true;
1476
- await handler(upd, next);
1476
+ await middleware(upd, next);
1477
1477
  });
1478
1478
  };
1479
1479
  }
@@ -5,7 +5,7 @@ export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const VECTOR_CONSTRUCTOR = 481674261;
6
6
  export declare const INITIAL_DC: DC;
7
7
  export declare const LAYER = 161;
8
- export declare const APP_VERSION = "MTKruto 0.0.987";
8
+ export declare const APP_VERSION = "MTKruto 0.0.988";
9
9
  export declare const DEVICE_MODEL: string;
10
10
  export declare const LANG_CODE: string;
11
11
  export declare const LANG_PACK = "";
@@ -80,7 +80,7 @@ exports.PUBLIC_KEYS = Object.freeze([
80
80
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
81
81
  exports.INITIAL_DC = "2-test";
82
82
  exports.LAYER = 161;
83
- exports.APP_VERSION = "MTKruto 0.0.987";
83
+ exports.APP_VERSION = "MTKruto 0.0.988";
84
84
  // @ts-ignore: lib
85
85
  exports.DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
86
86
  exports.LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];