1
0
Эх сурвалжийг харах

Allow passing of false values in raw functions.

painor 4 жил өмнө
parent
commit
5108ffaee0

+ 1 - 1
gramjs/client/TelegramClient.ts

@@ -460,7 +460,7 @@ export class TelegramClient extends TelegramBaseClient {
             } catch (e) {
                 // we can't create sender for our own main DC
                 if (e.message=="DC_ID_INVALID"){
-                    throw e;
+                    return this._sender;
                 }
                 await sender.disconnect();
             }

+ 3 - 1
gramjs/tl/api.js

@@ -225,12 +225,14 @@ function compareType(value, type) {
     let correct = true;
     switch (type) {
         case "number":
+            correct = typeof value === "number" || value===undefined;
+            break;
         case "string":
         case "boolean":
             correct = typeof value === type;
             break;
         case "bigInt":
-            correct = bigInt.isInstance(value);
+            correct = bigInt.isInstance(value) ||  value===undefined;
             break;
         case "true":
             // true value is always correct

+ 2 - 2
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "telegram",
-  "version": "1.7.0",
+  "version": "1.7.1",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "telegram",
-      "version": "1.7.0",
+      "version": "1.7.1",
       "license": "MIT",
       "dependencies": {
         "@cryptography/aes": "^0.1.1",

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "telegram",
-  "version": "1.7.0",
+  "version": "1.7.1",
   "description": "NodeJS MTProto API Telegram client library,",
   "main": "index.js",
   "types": "index.d.ts",