Explorar o código

Allow passing of false values in raw functions.

painor %!s(int64=4) %!d(string=hai) anos
pai
achega
5108ffaee0
Modificáronse 4 ficheiros con 7 adicións e 5 borrados
  1. 1 1
      gramjs/client/TelegramClient.ts
  2. 3 1
      gramjs/tl/api.js
  3. 2 2
      package-lock.json
  4. 1 1
      package.json

+ 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",