Переглянути джерело

Add support for customFile class in sendMessage

painor 3 роки тому
батько
коміт
fa7e1fd8b1
2 змінених файлів з 3 додано та 2 видалено
  1. 2 1
      gramjs/client/uploads.ts
  2. 1 1
      gramjs/tl/api.d.ts

+ 2 - 1
gramjs/client/uploads.ts

@@ -276,6 +276,7 @@ export async function _fileToMedia(
         !Buffer.isBuffer(file) &&
         !(file instanceof Api.InputFile) &&
         !(file instanceof Api.InputFileBig) &&
+        !(file instanceof CustomFile) &&
         !("read" in file)
     ) {
         try {
@@ -321,7 +322,7 @@ export async function _fileToMedia(
                 (await fs.stat(file)).size,
                 file
             );
-        } else if (typeof File !== "undefined" && file instanceof File) {
+        } else if ((typeof File !== "undefined" && file instanceof File) || file instanceof CustomFile) {
             createdFile = file;
         } else {
             let name;

+ 1 - 1
gramjs/tl/api.d.ts

@@ -16,7 +16,7 @@ export namespace Api {
     type float = number;
     type int128 = BigInteger;
     type int256 = BigInteger;
-    type long = BigInteger;
+    type long = BigInteger | string;
     type bytes = Buffer;
     class VirtualClass<Args extends AnyLiteral> {
         static CONSTRUCTOR_ID: number;