Prechádzať zdrojové kódy

add DC export and file download helpers

painor 5 rokov pred
rodič
commit
dc2d371b85
40 zmenil súbory, kde vykonal 25703 pridanie a 11 odobranie
  1. 153 0
      src/api/gramjs/client.ts
  2. 24 0
      src/api/gramjs/connectors/files.ts
  3. 93 0
      src/lib/gramjs/Utils.js
  4. 351 10
      src/lib/gramjs/client/TelegramClient.js
  5. 2924 0
      src/lib/gramjs/errors/RPCErrorList.js
  6. 102 0
      src/lib/gramjs/extensions/Logger.js
  7. 14 0
      src/lib/gramjs/extensions/index.js
  8. 198 0
      src/lib/gramjs/network/Authenticator.js
  9. 1 1
      src/lib/gramjs/network/MTProtoPlainSender.js
  10. 16 0
      src/lib/gramjs/network/RequestState.js
  11. 2333 0
      src/lib/gramjs/tl/functions/account.js
  12. 556 0
      src/lib/gramjs/tl/functions/auth.js
  13. 83 0
      src/lib/gramjs/tl/functions/bots.js
  14. 1506 0
      src/lib/gramjs/tl/functions/channels.js
  15. 725 0
      src/lib/gramjs/tl/functions/contacts.js
  16. 79 0
      src/lib/gramjs/tl/functions/folders.js
  17. 578 0
      src/lib/gramjs/tl/functions/help.js
  18. 704 0
      src/lib/gramjs/tl/functions/index.js
  19. 205 0
      src/lib/gramjs/tl/functions/langpack.js
  20. 5464 0
      src/lib/gramjs/tl/functions/messages.js
  21. 242 0
      src/lib/gramjs/tl/functions/payments.js
  22. 354 0
      src/lib/gramjs/tl/functions/phone.js
  23. 179 0
      src/lib/gramjs/tl/functions/photos.js
  24. 185 0
      src/lib/gramjs/tl/functions/stickers.js
  25. 147 0
      src/lib/gramjs/tl/functions/updates.js
  26. 343 0
      src/lib/gramjs/tl/functions/upload.js
  27. 134 0
      src/lib/gramjs/tl/functions/users.js
  28. 766 0
      src/lib/gramjs/tl/types/account.js
  29. 425 0
      src/lib/gramjs/tl/types/auth.js
  30. 189 0
      src/lib/gramjs/tl/types/channels.js
  31. 493 0
      src/lib/gramjs/tl/types/contacts.js
  32. 765 0
      src/lib/gramjs/tl/types/help.js
  33. 1905 0
      src/lib/gramjs/tl/types/index.js
  34. 1877 0
      src/lib/gramjs/tl/types/messages.js
  35. 383 0
      src/lib/gramjs/tl/types/payments.js
  36. 51 0
      src/lib/gramjs/tl/types/phone.js
  37. 154 0
      src/lib/gramjs/tl/types/photos.js
  38. 248 0
      src/lib/gramjs/tl/types/storage.js
  39. 530 0
      src/lib/gramjs/tl/types/updates.js
  40. 224 0
      src/lib/gramjs/tl/types/upload.js

+ 153 - 0
src/api/gramjs/client.ts

@@ -0,0 +1,153 @@
+import * as gramJsApi from '../../lib/gramjs/tl/types';
+import {
+  InvokeRequestPayload,
+  SupportedMessageRequests,
+  SupportedUploadRequests,
+} from './types/types';
+import * as apiRequests from '../../lib/gramjs/tl/functions';
+
+import { TelegramClient, session } from '../../lib/gramjs';
+import { DEBUG } from '../../config';
+import {
+  onAuthReady, onRequestCode, onRequestPassword, onRequestPhoneNumber,
+} from './connectors/auth';
+import { onGramJsUpdate } from './onGramJsUpdate';
+import localDb from './localDb';
+import { buildInputPeerPhotoFileLocation } from './inputHelpers';
+import { ApiFileLocation } from '../types';
+
+let client: any;
+
+export async function init(sessionId: string) {
+  const { StringSession } = session;
+
+  const stringSession = new StringSession(sessionId);
+  client = new TelegramClient(
+    stringSession,
+    process.env.TELEGRAM_T_API_ID,
+    process.env.TELEGRAM_T_API_HASH,
+    { useWSS: true } as any,
+  );
+
+  client.addEventHandler(onGramJsUpdate, { build: (update: object) => update });
+
+  try {
+    if (DEBUG) {
+      // eslint-disable-next-line no-console
+      console.log('[GramJs/worker] CONNECTING');
+    }
+
+    await client.start({
+      phone: onRequestPhoneNumber,
+      code: onRequestCode,
+      password: onRequestPassword,
+    } as any);
+    for (let x = 1; x <= 5; x++) {
+      if (x !== client.session.dcId) {
+        // Todo Better logic
+        // eslint-disable-next-line no-underscore-dangle
+        await client._borrowExportedSender(x);
+      }
+    }
+    const newSessionId = stringSession.save();
+
+    if (DEBUG) {
+      // eslint-disable-next-line no-console
+      console.log('[GramJs/worker] CONNECTED as ', newSessionId);
+    }
+
+    onAuthReady(newSessionId);
+  } catch (err) {
+    if (DEBUG) {
+      // eslint-disable-next-line no-console
+      console.log('[GramJs/worker] CONNECTING ERROR', err);
+    }
+
+    throw err;
+  }
+}
+
+export function downloadFile(id: number, fileLocation: ApiFileLocation, args = {
+  partSizeKb: null,
+  fileSize: null,
+  progressCallback: null,
+  dcId: null,
+}) {
+  return client.downloadFile(buildInputPeerPhotoFileLocation({ id, fileLocation }), Buffer, args);
+}
+
+export async function invokeRequest(data: InvokeRequestPayload) {
+  const { namespace, name, args } = data;
+
+  let RequestClass;
+
+  // For some reason these types are not working automatically.
+  switch (namespace) {
+    case 'messages':
+      RequestClass = apiRequests.messages[name as SupportedMessageRequests];
+      break;
+    case 'upload':
+      RequestClass = apiRequests.upload[name as SupportedUploadRequests];
+      break;
+    default:
+      return null;
+  }
+
+  const request = new RequestClass(args);
+
+  if (DEBUG) {
+    // eslint-disable-next-line no-console
+    console.log(`[GramJs/worker] INVOKE ${name}`, args);
+  }
+
+  const result = await client.invoke(request);
+
+  postProcess(name, result, args);
+
+  if (DEBUG) {
+    // eslint-disable-next-line no-console
+    console.log(`[GramJs/worker] INVOKE RESPONSE ${name}`, result);
+  }
+
+  return result;
+}
+
+function postProcess(name: string, anyResult: any, args: AnyLiteral) {
+  switch (name) {
+    case 'GetDialogsRequest': {
+      const result: MTP.messages$Dialogs = anyResult;
+
+      if (!result || !result.dialogs) {
+        return;
+      }
+
+      result.users.forEach((user) => {
+        localDb.users[user.id] = user as MTP.user;
+      });
+
+      result.chats.forEach((chat) => {
+        localDb.chats[chat.id] = chat as MTP.chat | MTP.channel;
+      });
+
+      break;
+    }
+
+    case 'SendMessageRequest': {
+      const result = anyResult;
+
+      if (!result) {
+        return;
+      }
+
+      // TODO Support this.
+      if (result instanceof gramJsApi.UpdatesTooLong) {
+        return;
+      }
+
+      const updates = result.hasOwnProperty('updates') ? result.updates as MTP.Updates[] : [result as MTP.Updates];
+
+      const originRequest = { name, args };
+      updates.forEach((update) => onGramJsUpdate(update, originRequest));
+    }
+  }
+}

+ 24 - 0
src/api/gramjs/connectors/files.ts

@@ -0,0 +1,24 @@
+import { ApiFileLocation } from '../../types';
+
+import { downloadFile } from '../client';
+
+export function init() {
+}
+
+export async function loadFile(id: any, fileLocation: ApiFileLocation): Promise<string | null> {
+  const result = await downloadFile(id, fileLocation);
+  // eslint-disable-next-line no-underscore-dangle
+  return result ? bytesToUrl(result) : null;
+}
+
+function bytesToUrl(bytes: Uint8Array, mimeType?: string) {
+  if (!mimeType) {
+    mimeType = 'image/jpg';
+  }
+
+  return `data:${mimeType};base64,${btoa(
+    bytes.reduce((data, byte) => {
+      return data + String.fromCharCode(byte);
+    }, ''),
+  )}`;
+}

+ 93 - 0
src/lib/gramjs/Utils.js

@@ -221,6 +221,95 @@ function getInputMessage(message) {
 }
 
 
+/**
+ * Adds the JPG header and footer to a stripped image.
+ * Ported from https://github.com/telegramdesktop/tdesktop/blob/bec39d89e19670eb436dc794a8f20b657cb87c71/Telegram/SourceFiles/ui/image/image.cpp#L225
+
+ * @param stripped{Buffer}
+ * @returns {Buffer}
+ */
+function strippedPhotoToJpg(stripped) {
+    // Note: Changes here should update _stripped_real_length
+    if (stripped.length < 3 || stripped[0] !== 1) {
+        return stripped
+    }
+    const header = Buffer.from('ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00', 'hex')
+    const footer = Buffer.from('ffd9', 'hex')
+    header[164] = stripped[1]
+    header[166] = stripped[2]
+    return Buffer.concat([header, stripped.slice(3), footer])
+}
+
+
+function getInputLocation(location) {
+    try {
+        if (!location.SUBCLASS_OF_ID) {
+            throw new Error()
+        }
+        if (location.SUBCLASS_OF_ID === 0x1523d462) {
+            return { dcId: null, inputLocation: location }
+        }
+    } catch (e) {
+        _raiseCastFail(location, 'InputFileLocation')
+    }
+    if (location instanceof types.Message) {
+        location = location.media
+    }
+
+    if (location instanceof types.MessageMediaDocument) {
+        location = location.document
+    } else if (location instanceof types.MessageMediaPhoto) {
+        location = location.photo
+    }
+
+    if (location instanceof types.Document) {
+        return {
+            dcId: location.dcId, inputLocation: new types.InputDocumentFileLocation({
+                id: location.id,
+                accessHash: location.accessHash,
+                fileReference: location.fileReference,
+                thumbSize: '', // Presumably to download one of its thumbnails
+            }),
+        }
+    } else if (location instanceof types.Photo) {
+        return {
+            dcId: location.dcId, inputLocation: new types.InputPhotoFileLocation({
+                id: location.id,
+                accessHash: location.accessHash,
+                fileReference: location.fileReference,
+                thumbSize: location.sizes[location.sizes.length - 1].type,
+            }),
+        }
+    }
+
+    if (location instanceof types.FileLocationToBeDeprecated) {
+        throw new Error('Unavailable location cannot be used as input')
+    }
+    _raiseCastFail(location, 'InputFileLocation')
+}
+
+
+/**
+ * Gets the appropriated part size when uploading or downloading files,
+ * given an initial file size.
+ * @param fileSize
+ * @returns {Number}
+ */
+function getAppropriatedPartSize(fileSize) {
+    if (fileSize <= 104857600) { // 100MB
+        return 128
+    }
+    if (fileSize <= 786432000) { // 750MB
+        return 256
+    }
+    if (fileSize <= 1572864000) { // 1500MB
+        return 512
+    }
+
+    throw new Error('File size too large')
+}
+
+
 function getPeer(peer) {
     try {
         if (typeof peer === 'number') {
@@ -487,4 +576,8 @@ module.exports = {
     getDisplayName,
     resolveId,
     isListLike,
+    getAppropriatedPartSize,
+    getInputLocation,
+    strippedPhotoToJpg,
+
 }

+ 351 - 10
src/lib/gramjs/client/TelegramClient.js

@@ -3,6 +3,8 @@ const { sleep } = require('../Helpers')
 const errors = require('../errors')
 const MemorySession = require('../sessions/Memory')
 const { addKey } = require('../crypto/RSA')
+const Helpers = require('../Helpers')
+const { BinaryWriter } = require('../extensions')
 const { TLRequest } = require('../tl/tlobject')
 const utils = require('../Utils')
 const Session = require('../sessions/Abstract')
@@ -19,6 +21,11 @@ const DEFAULT_DC_ID = 2
 const DEFAULT_IPV4_IP = 'venus.web.telegram.org'
 const DEFAULT_IPV6_IP = '[2001:67c:4e8:f002::a]'
 
+// Chunk sizes for upload.getFile must be multiples of the smallest size
+const MIN_CHUNK_SIZE = 4096
+const MAX_CHUNK_SIZE = 512 * 1024
+
+
 class TelegramClient {
     static DEFAULT_OPTIONS = {
         connection: ConnectionTCPObfuscated,
@@ -122,6 +129,8 @@ class TelegramClient {
 
         })
         this.phoneCodeHashes = []
+        this._borrowedSenders = {}
+
     }
 
 
@@ -161,7 +170,7 @@ class TelegramClient {
     async _switchDC(newDc) {
         this._log.info(`Reconnecting to new data center ${newDc}`)
         const DC = await this._getDC(newDc)
-        this.session.setDC(newDc, DC, 443)
+        this.session.setDC(newDc, DC.ipAddress, DC.port)
         // authKey's are associated with a server, which has now changed
         // so it's not valid anymore. Set to None to force recreating it.
         this._sender.authKey.key = null
@@ -177,21 +186,350 @@ class TelegramClient {
     }
 
     // endregion
+    // export region
+
+    async _borrowExportedSender(dcId) {
+        let sender = this._borrowedSenders[dcId]
+        if (!sender) {
+            sender = await this._createExportedSender(dcId)
+            sender.dcId = dcId
+            this._borrowedSenders[dcId] = sender
+        }
+        return sender
+    }
+
+    async _createExportedSender(dcId) {
+        const dc = await this._getDC(dcId)
+        const sender = new MTProtoSender(null, { logger: this._log })
+        await sender.connect(new this._connection(
+            dc.ipAddress,
+            dc.port,
+            dcId,
+            this._log,
+        ))
+        this._log.info(`Exporting authorization for data center ${dc.ipAddress}`)
+        const auth = await this.invoke(new functions.auth.ExportAuthorizationRequest({ dcId: dcId }))
+        const req = this._initWith(new functions.auth.ImportAuthorizationRequest({
+                id: auth.id, bytes: auth.bytes,
+            },
+        ))
+        await sender.send(req)
+        return sender
+    }
+
+    // end region
+
+    // download region
+
+
+    async downloadFile(inputLocation, file, args = {
+        partSizeKb: null,
+        fileSize: null,
+        progressCallback: null,
+        dcId: null,
+    }) {
+        if (!args.partSizeKb) {
+            if (!args.fileSize) {
+                args.partSizeKb = 64
+            } else {
+                args.partSizeKb = utils.getAppropriatedPartSize(args.fileSize)
+            }
+        }
+        const partSize = parseInt(args.partSizeKb * 1024)
+        if (partSize % MIN_CHUNK_SIZE !== 0) {
+            throw new Error('The part size must be evenly divisible by 4096')
+        }
+        const inMemory = !file || file === Buffer
+        let f
+        if (inMemory) {
+            f = new BinaryWriter(Buffer.alloc(0))
+        } else {
+            throw new Error('not supported')
+        }
+        const res = utils.getInputLocation(inputLocation)
+        let exported = args.dcId && this.session.dcId !== args.dcId
+
+        let sender
+        if (exported) {
+            try {
+                sender = await this._borrowExportedSender(args.dcId)
+            } catch (e) {
+                if (e instanceof errors.DcIdInvalidError) {
+                    // Can't export a sender for the ID we are currently in
+                    sender = this._sender
+                    exported = false
+                } else {
+                    throw e
+                }
+            }
+        } else {
+            sender = this._sender
+        }
+
+        this._log.info(`Downloading file in chunks of ${partSize} bytes`)
+
+        try {
+            let offset = 0
+            // eslint-disable-next-line no-constant-condition
+            while (true) {
+                let result
+                try {
+                    result = await sender.send(new functions.upload.GetFileRequest({
+                        location: res.inputLocation,
+                        offset: offset,
+                        limit: partSize,
+                    }))
+                    if (result instanceof types.upload.FileCdnRedirect) {
+                        throw new Error('not implemented')
+                    }
+                } catch (e) {
+                    if (e instanceof errors.FileMigrateError) {
+                        this._log.info('File lives in another DC')
+                        sender = await this._borrowExportedSender(e.newDc)
+                        exported = true
+                        continue
+                    } else {
+                        throw e
+                    }
+                }
+                offset += partSize
+
+                if (!result.bytes.length) {
+                    if (inMemory) {
+                        return f.getValue()
+                    } else {
+                        // Todo implement
+                    }
+                }
+                this._log.debug(`Saving ${result.bytes.length} more bytes`)
+                f.write(result.bytes)
+                if (args.progressCallback) {
+                    await args.progressCallback(f.getValue().length, args.fileSize)
+                }
+            }
+        } finally {
+            // TODO
+        }
+    }
+
+    async downloadMedia(message, file, args = {
+        thumb: null,
+        progressCallback: null,
+    }) {
+        let date
+        let media
+        if (message instanceof types.Message) {
+            date = message.date
+            media = message.media
+        } else {
+            date = new Date().getTime()
+            media = message
+        }
+        if (typeof media == 'string') {
+            throw new Error('not implemented')
+        }
+
+        if (media instanceof types.MessageMediaWebPage) {
+            if (media.webpage instanceof types.WebPage) {
+                media = media.webpage.document || media.webpage.photo
+            }
+        }
+        if (media instanceof types.MessageMediaPhoto || media instanceof types.Photo) {
+            return await this._downloadPhoto(media, file, date, args.thumb, args.progressCallback)
+        } else if (media instanceof types.MessageMediaDocument || media instanceof types.Document) {
+            return await this._downloadDocument(media, file, date, args.thumb, args.progressCallback, media.dcId)
+        } else if (media instanceof types.MessageMediaContact && args.thumb == null) {
+            return this._downloadContact(media, file)
+        } else if ((media instanceof types.WebDocument || media instanceof types.WebDocumentNoProxy) && args.thumb == null) {
+            return await this._downloadWebDocument(media, file, args.progressCallback)
+        }
+    }
+
+    async downloadProfilePhoto(entity, file, downloadBig = false) {
+        // ('User', 'Chat', 'UserFull', 'ChatFull')
+        const ENTITIES = [0x2da17977, 0xc5af5d94, 0x1f4661b9, 0xd49a2697]
+        // ('InputPeer', 'InputUser', 'InputChannel')
+        // const INPUTS = [0xc91c90b6, 0xe669bf46, 0x40f202fd]
+        // Todo account for input methods
+        const thumb = downloadBig ? -1 : 0
+        let photo
+        if (!(ENTITIES.includes(entity.SUBCLASS_OF_ID))) {
+            photo = entity
+        } else {
+            if (!entity.photo) {
+                // Special case: may be a ChatFull with photo:Photo
+                if (!entity.chatPhoto) {
+                    return null
+                }
+
+                return await this._downloadPhoto(
+                    entity.chatPhoto, file, null, thumb, null,
+                )
+            }
+            photo = entity.photo
+        }
+        let dcId
+        let which
+        let loc
+        if (photo instanceof types.UserProfilePhoto || photo instanceof types.ChatPhoto) {
+            console.log('i am ere')
+            dcId = photo.dcId
+            which = downloadBig ? photo.photoBig : photo.photoSmall
+            loc = new types.InputPeerPhotoFileLocation({
+                peer: await this.getInputEntity(entity),
+                localId: which.localId,
+                volumeId: which.volumeId,
+                big: downloadBig,
+            })
+            console.log(loc)
+        } else {
+            // It doesn't make any sense to check if `photo` can be used
+            // as input location, because then this method would be able
+            // to "download the profile photo of a message", i.e. its
+            // media which should be done with `download_media` instead.
+            return null
+        }
+        file = file ? file : Buffer
+        try {
+            const result = await this.downloadFile(loc, file, {
+                dcId: dcId,
+            })
+            return result
+        } catch (e) {
+            if (e instanceof errors.LocationInvalidError) {
+                const ie = await this.getInputEntity(entity)
+                if (ie instanceof types.InputPeerChannel) {
+                    const full = await this.invoke(new functions.channels.GetFullChannelRequest({
+                        channel: ie,
+                    }))
+                    return await this._downloadPhoto(full.fullChat.chatPhoto, file, null, null, thumb)
+                } else {
+                    return null
+                }
+            } else {
+                throw e
+            }
+        }
+
+
+    }
+
+    _getThumb(thumbs, thumb) {
+        if (thumb === null || thumb === undefined) {
+            return thumbs[thumbs.length - 1]
+        } else if (typeof thumb === 'number') {
+            return thumbs[thumb]
+        } else if (thumb instanceof types.PhotoSize ||
+            thumb instanceof types.PhotoCachedSize ||
+            thumb instanceof types.PhotoStrippedSize) {
+            return thumb
+        } else {
+            return null
+        }
+    }
+
+    _downloadCachedPhotoSize(size, file) {
+        // No need to download anything, simply write the bytes
+        let data
+        if (size instanceof types.PhotoStrippedSize) {
+            data = utils.strippedPhotoToJpg(size.bytes)
+        } else {
+            data = size.bytes
+        }
+        return data
+    }
+
+    async _downloadPhoto(photo, file, date, thumb, progressCallback) {
+        if (photo instanceof types.MessageMediaPhoto) {
+            photo = photo.photo
+        }
+        if (!(photo instanceof types.Photo)) {
+            return
+        }
+        const size = this._getThumb(photo.sizes, thumb)
+        if (!size || (size instanceof types.PhotoSizeEmpty)) {
+            return
+        }
+
+        file = file ? file : Buffer
+        if (size instanceof types.PhotoCachedSize || size instanceof types.PhotoStrippedSize) {
+            return this._downloadCachedPhotoSize(size, file)
+        }
+
+        const result = await this.downloadFile(
+            new types.InputPhotoFileLocation({
+                id: photo.id,
+                accessHash: photo.accessHash,
+                fileReference: photo.fileReference,
+                thumbSize: size.type,
+            }),
+            file,
+            {
+                dcId: photo.dcId,
+                fileSize: size.size,
+                progressCallback: progressCallback,
+            },
+        )
+        return result
+    }
+
+    async _downloadDocument(document, file, date, thumb, progressCallback, dcId) {
+        if (document instanceof types.MessageMediaPhoto) {
+            document = document.document
+        }
+        if (!(document instanceof types.Document)) {
+            return
+        }
+        let size
+        file = file ? file : Buffer
+
+        if (thumb === null || thumb === undefined) {
+            size = null
+        } else {
+            size = this._getThumb(document.thumbs, thumb)
+            if (size instanceof types.PhotoCachedSize || size instanceof types.PhotoStrippedSize) {
+                return this._downloadCachedPhotoSize(size, file)
+            }
+        }
+        const result = await this.downloadFile(
+            new types.InputDocumentFileLocation({
+                id: document.id,
+                accessHash: document.accessHash,
+                fileReference: document.fileReference,
+                thumbSize: size ? size.type : '',
+            }),
+            file,
+            {
+                fileSize: size ? size.size : document.size,
+                progressCallback: progressCallback,
+                dcId,
+            },
+        )
+        return result
+    }
+
+    _downloadContact(media, file) {
+        throw new Error('not implemented')
+    }
+
+    async _downloadWebDocument(media, file, progressCallback) {
+        throw new Error('not implemented')
+    }
 
     // region Working with different connections/Data Centers
 
     async _getDC(dcId, cdn = false) {
         switch (dcId) {
             case 1:
-                return 'pluto.web.telegram.org'
+                return { id: 1, ipAddress: 'pluto.web.telegram.org', port: 443 }
             case 2:
-                return 'venus.web.telegram.org'
+                return { id: 2, ipAddress: 'venus.web.telegram.org', port: 443 }
             case 3:
-                return 'aurora.web.telegram.org'
+                return { id: 3, ipAddress: 'aurora.web.telegram.org', port: 443 }
             case 4:
-                return 'vesta.web.telegram.org'
+                return { id: 4, ipAddress: 'vesta.web.telegram.org', port: 443 }
             case 5:
-                return 'flora.web.telegram.org'
+                return { id: 5, ipAddress: 'flora.web.telegram.org', port: 443 }
             default:
                 throw new Error(`Cannot find the DC with the ID of ${dcId}`)
         }
@@ -395,6 +733,7 @@ class TelegramClient {
                         })
                         break
                     } catch (e) {
+                        console.log(e)
                         console.log('Invalid password. Please try again')
                     }
                 }
@@ -438,9 +777,9 @@ class TelegramClient {
                     result = await this.invoke(new functions.auth.CheckPasswordRequest({
                         password: computeCheck(pwd, args.password),
                     }))
-                    break;
+                    break
                 } catch (err) {
-                    console.error(`Password check attempt ${i + 1} of 5 failed. Reason: `, err);
+                    console.error(`Password check attempt ${i + 1} of 5 failed. Reason: `, err)
                 }
             }
         } else if (args.botToken) {
@@ -475,7 +814,7 @@ class TelegramClient {
 
     // endregion
     async isUserAuthorized() {
-        if (this._authorized===undefined || this._authorized===null) {
+        if (this._authorized === undefined || this._authorized === null) {
             try {
                 await this.invoke(new functions.updates.GetStateRequest())
                 this._authorized = true
@@ -723,9 +1062,11 @@ class TelegramClient {
      chat = await client.get_input_entity(-123456789)
 
      * @param peer
-     * @returns {Promise<void>}
+     * @returns {Promise<>}
      */
     async getInputEntity(peer) {
+        console.log('trying to read ', peer)
+        console.log('trying to read ', peer)
         // Short-circuit if the input parameter directly maps to an InputPeer
         try {
             return utils.getInputPeer(peer)

+ 2924 - 0
src/lib/gramjs/errors/RPCErrorList.js

@@ -0,0 +1,2924 @@
+const { RPCError, BadRequestError, UnauthorizedError, AuthKeyError, ServerError, ForbiddenError, InvalidDCError, FloodError, TimedOutError } = require('./rpcbaseerrors');
+const format = require('string-format');
+
+class AboutTooLongError extends BadRequestError {
+    constructor(args) {
+        super('The provided bio is too long' + RPCError._fmtRequest(args.request));
+this.message = 'The provided bio is too long' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AccessTokenExpiredError extends BadRequestError {
+    constructor(args) {
+        super('Bot token expired' + RPCError._fmtRequest(args.request));
+this.message = 'Bot token expired' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AccessTokenInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided token is not valid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided token is not valid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ActiveUserRequiredError extends UnauthorizedError {
+    constructor(args) {
+        super('The method is only available to already activated users' + RPCError._fmtRequest(args.request));
+this.message = 'The method is only available to already activated users' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AdminsTooMuchError extends BadRequestError {
+    constructor(args) {
+        super('Too many admins' + RPCError._fmtRequest(args.request));
+this.message = 'Too many admins' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AdminRankEmojiNotAllowedError extends BadRequestError {
+    constructor(args) {
+        super('Emoji are not allowed in admin titles or ranks' + RPCError._fmtRequest(args.request));
+this.message = 'Emoji are not allowed in admin titles or ranks' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AdminRankInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The given admin title or rank was invalid (possibly larger than 16 characters)' + RPCError._fmtRequest(args.request));
+this.message = 'The given admin title or rank was invalid (possibly larger than 16 characters)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ApiIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The api_id/api_hash combination is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The api_id/api_hash combination is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ApiIdPublishedFloodError extends BadRequestError {
+    constructor(args) {
+        super('This API id was published somewhere, you can\'t use it now' + RPCError._fmtRequest(args.request));
+this.message = 'This API id was published somewhere, you can\'t use it now' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ArticleTitleEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The title of the article is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The title of the article is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AuthBytesInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided authorization is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided authorization is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AuthKeyDuplicatedError extends AuthKeyError {
+    constructor(args) {
+        super('The authorization key (session file) was used under two different IP addresses simultaneously, and can no longer be used. Use the same session exclusively, or use different sessions' + RPCError._fmtRequest(args.request));
+this.message = 'The authorization key (session file) was used under two different IP addresses simultaneously, and can no longer be used. Use the same session exclusively, or use different sessions' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AuthKeyInvalidError extends UnauthorizedError {
+    constructor(args) {
+        super('The key is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The key is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AuthKeyPermEmptyError extends UnauthorizedError {
+    constructor(args) {
+        super('The method is unavailable for temporary authorization key, not bound to permanent' + RPCError._fmtRequest(args.request));
+this.message = 'The method is unavailable for temporary authorization key, not bound to permanent' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AuthKeyUnregisteredError extends UnauthorizedError {
+    constructor(args) {
+        super('The key is not registered in the system' + RPCError._fmtRequest(args.request));
+this.message = 'The key is not registered in the system' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class AuthRestartError extends ServerError {
+    constructor(args) {
+        super('Restart the authorization process' + RPCError._fmtRequest(args.request));
+this.message = 'Restart the authorization process' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BannedRightsInvalidError extends BadRequestError {
+    constructor(args) {
+        super('You cannot use that set of permissions in this request, i.e. restricting view_messages as a default' + RPCError._fmtRequest(args.request));
+this.message = 'You cannot use that set of permissions in this request, i.e. restricting view_messages as a default' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BotsTooMuchError extends BadRequestError {
+    constructor(args) {
+        super('There are too many bots in this chat/channel' + RPCError._fmtRequest(args.request));
+this.message = 'There are too many bots in this chat/channel' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BotChannelsNaError extends BadRequestError {
+    constructor(args) {
+        super('Bots can\'t edit admin privileges' + RPCError._fmtRequest(args.request));
+this.message = 'Bots can\'t edit admin privileges' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BotGroupsBlockedError extends BadRequestError {
+    constructor(args) {
+        super('This bot can\'t be added to groups' + RPCError._fmtRequest(args.request));
+this.message = 'This bot can\'t be added to groups' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BotInlineDisabledError extends BadRequestError {
+    constructor(args) {
+        super('This bot can\'t be used in inline mode' + RPCError._fmtRequest(args.request));
+this.message = 'This bot can\'t be used in inline mode' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BotInvalidError extends BadRequestError {
+    constructor(args) {
+        super('This is not a valid bot' + RPCError._fmtRequest(args.request));
+this.message = 'This is not a valid bot' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BotMethodInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot' + RPCError._fmtRequest(args.request));
+this.message = 'The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BotMissingError extends BadRequestError {
+    constructor(args) {
+        super('This method can only be run by a bot' + RPCError._fmtRequest(args.request));
+this.message = 'This method can only be run by a bot' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BotPaymentsDisabledError extends BadRequestError {
+    constructor(args) {
+        super('This method can only be run by a bot' + RPCError._fmtRequest(args.request));
+this.message = 'This method can only be run by a bot' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BotPollsDisabledError extends BadRequestError {
+    constructor(args) {
+        super('You cannot create polls under a bot account' + RPCError._fmtRequest(args.request));
+this.message = 'You cannot create polls under a bot account' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class BroadcastIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The channel is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The channel is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ButtonDataInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided button data is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided button data is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ButtonTypeInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The type of one of the buttons you provided is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The type of one of the buttons you provided is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ButtonUrlInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Button URL invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Button URL invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class CallAlreadyAcceptedError extends BadRequestError {
+    constructor(args) {
+        super('The call was already accepted' + RPCError._fmtRequest(args.request));
+this.message = 'The call was already accepted' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class CallAlreadyDeclinedError extends BadRequestError {
+    constructor(args) {
+        super('The call was already declined' + RPCError._fmtRequest(args.request));
+this.message = 'The call was already declined' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class CallOccupyFailedError extends ServerError {
+    constructor(args) {
+        super('The call failed because the user is already making another call' + RPCError._fmtRequest(args.request));
+this.message = 'The call failed because the user is already making another call' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class CallPeerInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided call peer object is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided call peer object is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class CallProtocolFlagsInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Call protocol flags invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Call protocol flags invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class CdnMethodInvalidError extends BadRequestError {
+    constructor(args) {
+        super('This method cannot be invoked on a CDN server. Refer to https://core.telegram.org/cdn#schema for available methods' + RPCError._fmtRequest(args.request));
+this.message = 'This method cannot be invoked on a CDN server. Refer to https://core.telegram.org/cdn#schema for available methods' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChannelsAdminPublicTooMuchError extends BadRequestError {
+    constructor(args) {
+        super('You\'re admin of too many public channels, make some channels private to change the username of this channel' + RPCError._fmtRequest(args.request));
+this.message = 'You\'re admin of too many public channels, make some channels private to change the username of this channel' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChannelsTooMuchError extends BadRequestError {
+    constructor(args) {
+        super('You have joined too many channels/supergroups' + RPCError._fmtRequest(args.request));
+this.message = 'You have joined too many channels/supergroups' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChannelInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited' + RPCError._fmtRequest(args.request));
+this.message = 'Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChannelPrivateError extends BadRequestError {
+    constructor(args) {
+        super('The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it' + RPCError._fmtRequest(args.request));
+this.message = 'The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChannelPublicGroupNaError extends ForbiddenError {
+    constructor(args) {
+        super('channel/supergroup not available' + RPCError._fmtRequest(args.request));
+this.message = 'channel/supergroup not available' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatAboutNotModifiedError extends BadRequestError {
+    constructor(args) {
+        super('About text has not changed' + RPCError._fmtRequest(args.request));
+this.message = 'About text has not changed' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatAboutTooLongError extends BadRequestError {
+    constructor(args) {
+        super('Chat about too long' + RPCError._fmtRequest(args.request));
+this.message = 'Chat about too long' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatAdminInviteRequiredError extends ForbiddenError {
+    constructor(args) {
+        super('You do not have the rights to do this' + RPCError._fmtRequest(args.request));
+this.message = 'You do not have the rights to do this' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatAdminRequiredError extends BadRequestError {
+    constructor(args) {
+        super('Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group' + RPCError._fmtRequest(args.request));
+this.message = 'Chat admin privileges are required to do that in the specified chat (for example, to send a message in a channel which is not yours), or invalid permissions used for the channel or group' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatForbiddenError extends BadRequestError {
+    constructor(args) {
+        super('You cannot write in this chat' + RPCError._fmtRequest(args.request));
+this.message = 'You cannot write in this chat' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatIdEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The provided chat ID is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The provided chat ID is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead' + RPCError._fmtRequest(args.request));
+this.message = 'Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The chat is invalid for this request' + RPCError._fmtRequest(args.request));
+this.message = 'The chat is invalid for this request' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatLinkExistsError extends BadRequestError {
+    constructor(args) {
+        super('The chat is linked to a channel and cannot be used in that request' + RPCError._fmtRequest(args.request));
+this.message = 'The chat is linked to a channel and cannot be used in that request' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatNotModifiedError extends BadRequestError {
+    constructor(args) {
+        super('The chat or channel wasn\'t modified (title, invites, username, admins, etc. are the same)' + RPCError._fmtRequest(args.request));
+this.message = 'The chat or channel wasn\'t modified (title, invites, username, admins, etc. are the same)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatRestrictedError extends BadRequestError {
+    constructor(args) {
+        super('The chat is restricted and cannot be used in that request' + RPCError._fmtRequest(args.request));
+this.message = 'The chat is restricted and cannot be used in that request' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatSendGifsForbiddenError extends ForbiddenError {
+    constructor(args) {
+        super('You can\'t send gifs in this chat' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t send gifs in this chat' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatSendInlineForbiddenError extends BadRequestError {
+    constructor(args) {
+        super('You cannot send inline results in this chat' + RPCError._fmtRequest(args.request));
+this.message = 'You cannot send inline results in this chat' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatSendMediaForbiddenError extends ForbiddenError {
+    constructor(args) {
+        super('You can\'t send media in this chat' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t send media in this chat' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatSendStickersForbiddenError extends ForbiddenError {
+    constructor(args) {
+        super('You can\'t send stickers in this chat' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t send stickers in this chat' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatTitleEmptyError extends BadRequestError {
+    constructor(args) {
+        super('No chat title provided' + RPCError._fmtRequest(args.request));
+this.message = 'No chat title provided' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ChatWriteForbiddenError extends ForbiddenError {
+    constructor(args) {
+        super('You can\'t write in this chat' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t write in this chat' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class CodeEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The provided code is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The provided code is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class CodeHashInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Code hash invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Code hash invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class CodeInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Code invalid (i.e. from email)' + RPCError._fmtRequest(args.request));
+this.message = 'Code invalid (i.e. from email)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ConnectionApiIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided API id is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided API id is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ConnectionDeviceModelEmptyError extends BadRequestError {
+    constructor(args) {
+        super('Device model empty' + RPCError._fmtRequest(args.request));
+this.message = 'Device model empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ConnectionLangPackInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The specified language pack is not valid. This is meant to be used by official applications only so far, leave it empty' + RPCError._fmtRequest(args.request));
+this.message = 'The specified language pack is not valid. This is meant to be used by official applications only so far, leave it empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ConnectionLayerInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The very first request must always be InvokeWithLayerRequest' + RPCError._fmtRequest(args.request));
+this.message = 'The very first request must always be InvokeWithLayerRequest' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ConnectionNotInitedError extends BadRequestError {
+    constructor(args) {
+        super('Connection not initialized' + RPCError._fmtRequest(args.request));
+this.message = 'Connection not initialized' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ConnectionSystemEmptyError extends BadRequestError {
+    constructor(args) {
+        super('Connection system empty' + RPCError._fmtRequest(args.request));
+this.message = 'Connection system empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ContactIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided contact ID is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided contact ID is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class DataInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Encrypted data invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Encrypted data invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class DataJsonInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided JSON data is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided JSON data is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class DateEmptyError extends BadRequestError {
+    constructor(args) {
+        super('Date empty' + RPCError._fmtRequest(args.request));
+this.message = 'Date empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class DcIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('This occurs when an authorization is tried to be exported for the same data center one is currently connected to' + RPCError._fmtRequest(args.request));
+this.message = 'This occurs when an authorization is tried to be exported for the same data center one is currently connected to' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class DhGAInvalidError extends BadRequestError {
+    constructor(args) {
+        super('g_a invalid' + RPCError._fmtRequest(args.request));
+this.message = 'g_a invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EmailHashExpiredError extends BadRequestError {
+    constructor(args) {
+        super('The email hash expired and cannot be used to verify it' + RPCError._fmtRequest(args.request));
+this.message = 'The email hash expired and cannot be used to verify it' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EmailInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The given email is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The given email is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EmailUnconfirmedError extends BadRequestError {
+    constructor(args) {
+        const codeLength = Number(args.capture || 0);
+        super(format('Email unconfirmed, the length of the code must be {code_length}', {codeLength}) + RPCError._fmtRequest(args.request));
+this.message = format('Email unconfirmed, the length of the code must be {code_length}', {codeLength}) + RPCError._fmtRequest(args.request);
+        this.codeLength = codeLength;
+    }
+}
+
+
+class EmoticonEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The emoticon field cannot be empty' + RPCError._fmtRequest(args.request));
+this.message = 'The emoticon field cannot be empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EncryptedMessageInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Encrypted message invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Encrypted message invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EncryptionAlreadyAcceptedError extends BadRequestError {
+    constructor(args) {
+        super('Secret chat already accepted' + RPCError._fmtRequest(args.request));
+this.message = 'Secret chat already accepted' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EncryptionAlreadyDeclinedError extends BadRequestError {
+    constructor(args) {
+        super('The secret chat was already declined' + RPCError._fmtRequest(args.request));
+this.message = 'The secret chat was already declined' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EncryptionDeclinedError extends BadRequestError {
+    constructor(args) {
+        super('The secret chat was declined' + RPCError._fmtRequest(args.request));
+this.message = 'The secret chat was declined' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EncryptionIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided secret chat ID is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided secret chat ID is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EncryptionOccupyFailedError extends ServerError {
+    constructor(args) {
+        super('TDLib developer claimed it is not an error while accepting secret chats and 500 is used instead of 420' + RPCError._fmtRequest(args.request));
+this.message = 'TDLib developer claimed it is not an error while accepting secret chats and 500 is used instead of 420' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EntitiesTooLongError extends BadRequestError {
+    constructor(args) {
+        super('It is no longer possible to send such long data inside entity tags (for example inline text URLs)' + RPCError._fmtRequest(args.request));
+this.message = 'It is no longer possible to send such long data inside entity tags (for example inline text URLs)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class EntityMentionUserInvalidError extends BadRequestError {
+    constructor(args) {
+        super('You can\'t use this entity' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t use this entity' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ErrorTextEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The provided error message is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The provided error message is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ExportCardInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Provided card is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Provided card is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ExternalUrlInvalidError extends BadRequestError {
+    constructor(args) {
+        super('External URL invalid' + RPCError._fmtRequest(args.request));
+this.message = 'External URL invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FieldNameEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The field with the name FIELD_NAME is missing' + RPCError._fmtRequest(args.request));
+this.message = 'The field with the name FIELD_NAME is missing' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FieldNameInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The field with the name FIELD_NAME is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The field with the name FIELD_NAME is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FileIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided file id is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided file id is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FileMigrateError extends InvalidDCError {
+    constructor(args) {
+        const newDc = Number(args.capture || 0);
+        super(format('The file to be accessed is currently stored in DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request));
+this.message = format('The file to be accessed is currently stored in DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request);
+        this.newDc = newDc;
+    }
+}
+
+
+class FilePartsInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The number of file parts is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The number of file parts is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FilePart0MissingError extends BadRequestError {
+    constructor(args) {
+        super('File part 0 missing' + RPCError._fmtRequest(args.request));
+this.message = 'File part 0 missing' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FilePartEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The provided file part is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The provided file part is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FilePartInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The file part number is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The file part number is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FilePartLengthInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The length of a file part is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The length of a file part is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FilePartSizeInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided file part size is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided file part size is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FilePartMissingError extends BadRequestError {
+    constructor(args) {
+        const which = Number(args.capture || 0);
+        super(format('Part {which} of the file is missing from storage', {which}) + RPCError._fmtRequest(args.request));
+this.message = format('Part {which} of the file is missing from storage', {which}) + RPCError._fmtRequest(args.request);
+        this.which = which;
+    }
+}
+
+
+class FilerefUpgradeNeededError extends AuthKeyError {
+    constructor(args) {
+        super('The file reference needs to be refreshed before being used again' + RPCError._fmtRequest(args.request));
+this.message = 'The file reference needs to be refreshed before being used again' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FirstNameInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The first name is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The first name is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FloodTestPhoneWaitError extends FloodError {
+    constructor(args) {
+        const seconds = Number(args.capture || 0);
+        super(format('A wait of {seconds} seconds is required in the test servers', {seconds}) + RPCError._fmtRequest(args.request));
+this.message = format('A wait of {seconds} seconds is required in the test servers', {seconds}) + RPCError._fmtRequest(args.request);
+        this.seconds = seconds;
+    }
+}
+
+
+class FloodWaitError extends FloodError {
+    constructor(args) {
+        const seconds = Number(args.capture || 0);
+        super(format('A wait of {seconds} seconds is required', {seconds}) + RPCError._fmtRequest(args.request));
+this.message = format('A wait of {seconds} seconds is required', {seconds}) + RPCError._fmtRequest(args.request);
+        this.seconds = seconds;
+    }
+}
+
+
+class FolderIdEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The folder you tried to delete was already empty' + RPCError._fmtRequest(args.request));
+this.message = 'The folder you tried to delete was already empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FolderIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The folder you tried to use was not valid' + RPCError._fmtRequest(args.request));
+this.message = 'The folder you tried to use was not valid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class FreshResetAuthorisationForbiddenError extends AuthKeyError {
+    constructor(args) {
+        super('The current session is too new and cannot be used to reset other authorisations yet' + RPCError._fmtRequest(args.request));
+this.message = 'The current session is too new and cannot be used to reset other authorisations yet' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class GifIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided GIF ID is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided GIF ID is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class GroupedMediaInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Invalid grouped media' + RPCError._fmtRequest(args.request));
+this.message = 'Invalid grouped media' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class HashInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided hash is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided hash is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class HistoryGetFailedError extends ServerError {
+    constructor(args) {
+        super('Fetching of history failed' + RPCError._fmtRequest(args.request));
+this.message = 'Fetching of history failed' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ImageProcessFailedError extends BadRequestError {
+    constructor(args) {
+        super('Failure while processing image' + RPCError._fmtRequest(args.request));
+this.message = 'Failure while processing image' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InlineResultExpiredError extends BadRequestError {
+    constructor(args) {
+        super('The inline query expired' + RPCError._fmtRequest(args.request));
+this.message = 'The inline query expired' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InputConstructorInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided constructor is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided constructor is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InputFetchErrorError extends BadRequestError {
+    constructor(args) {
+        super('An error occurred while deserializing TL parameters' + RPCError._fmtRequest(args.request));
+this.message = 'An error occurred while deserializing TL parameters' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InputFetchFailError extends BadRequestError {
+    constructor(args) {
+        super('Failed deserializing TL payload' + RPCError._fmtRequest(args.request));
+this.message = 'Failed deserializing TL payload' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InputLayerInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided layer is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided layer is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InputMethodInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The invoked method does not exist anymore or has never existed' + RPCError._fmtRequest(args.request));
+this.message = 'The invoked method does not exist anymore or has never existed' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InputRequestTooLongError extends BadRequestError {
+    constructor(args) {
+        super('The input request was too long. This may be a bug in the library as it can occur when serializing more bytes than it should (like appending the vector constructor code at the end of a message)' + RPCError._fmtRequest(args.request));
+this.message = 'The input request was too long. This may be a bug in the library as it can occur when serializing more bytes than it should (like appending the vector constructor code at the end of a message)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InputUserDeactivatedError extends BadRequestError {
+    constructor(args) {
+        super('The specified user was deleted' + RPCError._fmtRequest(args.request));
+this.message = 'The specified user was deleted' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InterdcCallErrorError extends BadRequestError {
+    constructor(args) {
+        const dc = Number(args.capture || 0);
+        super(format('An error occurred while communicating with DC {dc}', {dc}) + RPCError._fmtRequest(args.request));
+this.message = format('An error occurred while communicating with DC {dc}', {dc}) + RPCError._fmtRequest(args.request);
+        this.dc = dc;
+    }
+}
+
+
+class InterdcCallRichErrorError extends BadRequestError {
+    constructor(args) {
+        const dc = Number(args.capture || 0);
+        super(format('A rich error occurred while communicating with DC {dc}', {dc}) + RPCError._fmtRequest(args.request));
+this.message = format('A rich error occurred while communicating with DC {dc}', {dc}) + RPCError._fmtRequest(args.request);
+        this.dc = dc;
+    }
+}
+
+
+class InviteHashEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The invite hash is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The invite hash is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InviteHashExpiredError extends BadRequestError {
+    constructor(args) {
+        super('The chat the user tried to join has expired and is not valid anymore' + RPCError._fmtRequest(args.request));
+this.message = 'The chat the user tried to join has expired and is not valid anymore' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class InviteHashInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The invite hash is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The invite hash is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class LangPackInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided language pack is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided language pack is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class LastnameInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The last name is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The last name is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class LimitInvalidError extends BadRequestError {
+    constructor(args) {
+        super('An invalid limit was provided. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request));
+this.message = 'An invalid limit was provided. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class LinkNotModifiedError extends BadRequestError {
+    constructor(args) {
+        super('The channel is already linked to this group' + RPCError._fmtRequest(args.request));
+this.message = 'The channel is already linked to this group' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class LocationInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The location given for a file was invalid. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request));
+this.message = 'The location given for a file was invalid. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MaxIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided max ID is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided max ID is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MaxQtsInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided QTS were invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided QTS were invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class Md5ChecksumInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The MD5 check-sums do not match' + RPCError._fmtRequest(args.request));
+this.message = 'The MD5 check-sums do not match' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MediaCaptionTooLongError extends BadRequestError {
+    constructor(args) {
+        super('The caption is too long' + RPCError._fmtRequest(args.request));
+this.message = 'The caption is too long' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MediaEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The provided media object is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided media object is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MediaInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Media invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Media invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MediaNewInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The new media to edit the message with is invalid (such as stickers or voice notes)' + RPCError._fmtRequest(args.request));
+this.message = 'The new media to edit the message with is invalid (such as stickers or voice notes)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MediaPrevInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The old media cannot be edited with anything else (such as stickers or voice notes)' + RPCError._fmtRequest(args.request));
+this.message = 'The old media cannot be edited with anything else (such as stickers or voice notes)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MegagroupIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The group is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The group is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MegagroupPrehistoryHiddenError extends BadRequestError {
+    constructor(args) {
+        super('You can\'t set this discussion group because it\'s history is hidden' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t set this discussion group because it\'s history is hidden' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MemberNoLocationError extends ServerError {
+    constructor(args) {
+        super('An internal failure occurred while fetching user info (couldn\'t find location)' + RPCError._fmtRequest(args.request));
+this.message = 'An internal failure occurred while fetching user info (couldn\'t find location)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MemberOccupyPrimaryLocFailedError extends ServerError {
+    constructor(args) {
+        super('Occupation of primary member location failed' + RPCError._fmtRequest(args.request));
+this.message = 'Occupation of primary member location failed' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MessageAuthorRequiredError extends ForbiddenError {
+    constructor(args) {
+        super('Message author required' + RPCError._fmtRequest(args.request));
+this.message = 'Message author required' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MessageDeleteForbiddenError extends ForbiddenError {
+    constructor(args) {
+        super('You can\'t delete one of the messages you tried to delete, most likely because it is a service message.' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t delete one of the messages you tried to delete, most likely because it is a service message.' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MessageEditTimeExpiredError extends BadRequestError {
+    constructor(args) {
+        super('You can\'t edit this message anymore, too much time has passed since its creation.' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t edit this message anymore, too much time has passed since its creation.' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MessageEmptyError extends BadRequestError {
+    constructor(args) {
+        super('Empty or invalid UTF-8 message was sent' + RPCError._fmtRequest(args.request));
+this.message = 'Empty or invalid UTF-8 message was sent' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MessageIdsEmptyError extends BadRequestError {
+    constructor(args) {
+        super('No message ids were provided' + RPCError._fmtRequest(args.request));
+this.message = 'No message ids were provided' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MessageIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The specified message ID is invalid or you can\'t do that operation on such message' + RPCError._fmtRequest(args.request));
+this.message = 'The specified message ID is invalid or you can\'t do that operation on such message' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MessageNotModifiedError extends BadRequestError {
+    constructor(args) {
+        super('Content of the message was not modified' + RPCError._fmtRequest(args.request));
+this.message = 'Content of the message was not modified' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MessageTooLongError extends BadRequestError {
+    constructor(args) {
+        super('Message was too long. Current maximum length is 4096 UTF-8 characters' + RPCError._fmtRequest(args.request));
+this.message = 'Message was too long. Current maximum length is 4096 UTF-8 characters' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MsgWaitFailedError extends BadRequestError {
+    constructor(args) {
+        super('A waiting call returned an error' + RPCError._fmtRequest(args.request));
+this.message = 'A waiting call returned an error' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class MtSendQueueTooLongError extends ServerError {
+    constructor(args) {
+        super('' + RPCError._fmtRequest(args.request));
+this.message = '' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class NeedChatInvalidError extends ServerError {
+    constructor(args) {
+        super('The provided chat is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided chat is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class NeedMemberInvalidError extends ServerError {
+    constructor(args) {
+        super('The provided member is invalid or does not exist (for example a thumb size)' + RPCError._fmtRequest(args.request));
+this.message = 'The provided member is invalid or does not exist (for example a thumb size)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class NetworkMigrateError extends InvalidDCError {
+    constructor(args) {
+        const newDc = Number(args.capture || 0);
+        super(format('The source IP address is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request));
+this.message = format('The source IP address is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request);
+        this.newDc = newDc;
+    }
+}
+
+
+class NewSaltInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The new salt is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The new salt is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class NewSettingsInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The new settings are invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The new settings are invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class OffsetInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The given offset was invalid, it must be divisible by 1KB. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request));
+this.message = 'The given offset was invalid, it must be divisible by 1KB. See https://core.telegram.org/api/files#downloading-files' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class OffsetPeerIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided offset peer is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided offset peer is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class OptionsTooMuchError extends BadRequestError {
+    constructor(args) {
+        super('You defined too many options for the poll' + RPCError._fmtRequest(args.request));
+this.message = 'You defined too many options for the poll' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PackShortNameInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Invalid sticker pack name. It must begin with a letter, can\'t contain consecutive underscores and must end in "_by_<bot username>".' + RPCError._fmtRequest(args.request));
+this.message = 'Invalid sticker pack name. It must begin with a letter, can\'t contain consecutive underscores and must end in "_by_<bot username>".' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PackShortNameOccupiedError extends BadRequestError {
+    constructor(args) {
+        super('A stickerpack with this name already exists' + RPCError._fmtRequest(args.request));
+this.message = 'A stickerpack with this name already exists' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ParticipantsTooFewError extends BadRequestError {
+    constructor(args) {
+        super('Not enough participants' + RPCError._fmtRequest(args.request));
+this.message = 'Not enough participants' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ParticipantCallFailedError extends ServerError {
+    constructor(args) {
+        super('Failure while making call' + RPCError._fmtRequest(args.request));
+this.message = 'Failure while making call' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ParticipantVersionOutdatedError extends BadRequestError {
+    constructor(args) {
+        super('The other participant does not use an up to date telegram client with support for calls' + RPCError._fmtRequest(args.request));
+this.message = 'The other participant does not use an up to date telegram client with support for calls' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PasswordEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The provided password is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The provided password is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PasswordHashInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The password (and thus its hash value) you entered is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The password (and thus its hash value) you entered is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PasswordRequiredError extends BadRequestError {
+    constructor(args) {
+        super('The account must have 2-factor authentication enabled (a password) before this method can be used' + RPCError._fmtRequest(args.request));
+this.message = 'The account must have 2-factor authentication enabled (a password) before this method can be used' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PaymentProviderInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The payment provider was not recognised or its token was invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The payment provider was not recognised or its token was invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PeerFloodError extends BadRequestError {
+    constructor(args) {
+        super('Too many requests' + RPCError._fmtRequest(args.request));
+this.message = 'Too many requests' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PeerIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('An invalid Peer was used. Make sure to pass the right peer type' + RPCError._fmtRequest(args.request));
+this.message = 'An invalid Peer was used. Make sure to pass the right peer type' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PeerIdNotSupportedError extends BadRequestError {
+    constructor(args) {
+        super('The provided peer ID is not supported' + RPCError._fmtRequest(args.request));
+this.message = 'The provided peer ID is not supported' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PersistentTimestampEmptyError extends BadRequestError {
+    constructor(args) {
+        super('Persistent timestamp empty' + RPCError._fmtRequest(args.request));
+this.message = 'Persistent timestamp empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PersistentTimestampInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Persistent timestamp invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Persistent timestamp invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PersistentTimestampOutdatedError extends ServerError {
+    constructor(args) {
+        super('Persistent timestamp outdated' + RPCError._fmtRequest(args.request));
+this.message = 'Persistent timestamp outdated' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneCodeEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The phone code is missing' + RPCError._fmtRequest(args.request));
+this.message = 'The phone code is missing' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneCodeExpiredError extends BadRequestError {
+    constructor(args) {
+        super('The confirmation code has expired' + RPCError._fmtRequest(args.request));
+this.message = 'The confirmation code has expired' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneCodeHashEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The phone code hash is missing' + RPCError._fmtRequest(args.request));
+this.message = 'The phone code hash is missing' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneCodeInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The phone code entered was invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The phone code entered was invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneMigrateError extends InvalidDCError {
+    constructor(args) {
+        const newDc = Number(args.capture || 0);
+        super(format('The phone number a user is trying to use for authorization is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request));
+this.message = format('The phone number a user is trying to use for authorization is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request);
+        this.newDc = newDc;
+    }
+}
+
+
+class PhoneNumberAppSignupForbiddenError extends BadRequestError {
+    constructor(args) {
+        super('' + RPCError._fmtRequest(args.request));
+this.message = '' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneNumberBannedError extends BadRequestError {
+    constructor(args) {
+        super('The used phone number has been banned from Telegram and cannot be used anymore. Maybe check https://www.telegram.org/faq_spam' + RPCError._fmtRequest(args.request));
+this.message = 'The used phone number has been banned from Telegram and cannot be used anymore. Maybe check https://www.telegram.org/faq_spam' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneNumberFloodError extends BadRequestError {
+    constructor(args) {
+        super('You asked for the code too many times.' + RPCError._fmtRequest(args.request));
+this.message = 'You asked for the code too many times.' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneNumberInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The phone number is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The phone number is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneNumberOccupiedError extends BadRequestError {
+    constructor(args) {
+        super('The phone number is already in use' + RPCError._fmtRequest(args.request));
+this.message = 'The phone number is already in use' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhoneNumberUnoccupiedError extends BadRequestError {
+    constructor(args) {
+        super('The phone number is not yet being used' + RPCError._fmtRequest(args.request));
+this.message = 'The phone number is not yet being used' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhonePasswordFloodError extends AuthKeyError {
+    constructor(args) {
+        super('You have tried logging in too many times' + RPCError._fmtRequest(args.request));
+this.message = 'You have tried logging in too many times' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhonePasswordProtectedError extends BadRequestError {
+    constructor(args) {
+        super('This phone is password protected' + RPCError._fmtRequest(args.request));
+this.message = 'This phone is password protected' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhotoContentUrlEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The content from the URL used as a photo appears to be empty or has caused another HTTP error' + RPCError._fmtRequest(args.request));
+this.message = 'The content from the URL used as a photo appears to be empty or has caused another HTTP error' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhotoCropSizeSmallError extends BadRequestError {
+    constructor(args) {
+        super('Photo is too small' + RPCError._fmtRequest(args.request));
+this.message = 'Photo is too small' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhotoExtInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The extension of the photo is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The extension of the photo is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhotoInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Photo invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Photo invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhotoInvalidDimensionsError extends BadRequestError {
+    constructor(args) {
+        super('The photo dimensions are invalid (hint: `pip install pillow` for `send_file` to resize images)' + RPCError._fmtRequest(args.request));
+this.message = 'The photo dimensions are invalid (hint: `pip install pillow` for `send_file` to resize images)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhotoSaveFileInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The photo you tried to send cannot be saved by Telegram. A reason may be that it exceeds 10MB. Try resizing it locally' + RPCError._fmtRequest(args.request));
+this.message = 'The photo you tried to send cannot be saved by Telegram. A reason may be that it exceeds 10MB. Try resizing it locally' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PhotoThumbUrlEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The URL used as a thumbnail appears to be empty or has caused another HTTP error' + RPCError._fmtRequest(args.request));
+this.message = 'The URL used as a thumbnail appears to be empty or has caused another HTTP error' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PinRestrictedError extends BadRequestError {
+    constructor(args) {
+        super('You can\'t pin messages in private chats with other people' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t pin messages in private chats with other people' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PollOptionDuplicateError extends BadRequestError {
+    constructor(args) {
+        super('A duplicate option was sent in the same poll' + RPCError._fmtRequest(args.request));
+this.message = 'A duplicate option was sent in the same poll' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PollUnsupportedError extends BadRequestError {
+    constructor(args) {
+        super('This layer does not support polls in the issued method' + RPCError._fmtRequest(args.request));
+this.message = 'This layer does not support polls in the issued method' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PrivacyKeyInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The privacy key is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The privacy key is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class PtsChangeEmptyError extends ServerError {
+    constructor(args) {
+        super('No PTS change' + RPCError._fmtRequest(args.request));
+this.message = 'No PTS change' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class QueryIdEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The query ID is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The query ID is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class QueryIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The query ID is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The query ID is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class QueryTooShortError extends BadRequestError {
+    constructor(args) {
+        super('The query string is too short' + RPCError._fmtRequest(args.request));
+this.message = 'The query string is too short' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class RandomIdDuplicateError extends ServerError {
+    constructor(args) {
+        super('You provided a random ID that was already used' + RPCError._fmtRequest(args.request));
+this.message = 'You provided a random ID that was already used' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class RandomIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('A provided random ID is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'A provided random ID is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class RandomLengthInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Random length invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Random length invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class RangesInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Invalid range provided' + RPCError._fmtRequest(args.request));
+this.message = 'Invalid range provided' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ReactionEmptyError extends BadRequestError {
+    constructor(args) {
+        super('No reaction provided' + RPCError._fmtRequest(args.request));
+this.message = 'No reaction provided' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ReactionInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Invalid reaction provided (only emoji are allowed)' + RPCError._fmtRequest(args.request));
+this.message = 'Invalid reaction provided (only emoji are allowed)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class RegIdGenerateFailedError extends ServerError {
+    constructor(args) {
+        super('Failure while generating registration ID' + RPCError._fmtRequest(args.request));
+this.message = 'Failure while generating registration ID' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ReplyMarkupInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided reply markup is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided reply markup is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ReplyMarkupTooLongError extends BadRequestError {
+    constructor(args) {
+        super('The data embedded in the reply markup buttons was too much' + RPCError._fmtRequest(args.request));
+this.message = 'The data embedded in the reply markup buttons was too much' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ResultIdDuplicateError extends BadRequestError {
+    constructor(args) {
+        super('Duplicated IDs on the sent results. Make sure to use unique IDs.' + RPCError._fmtRequest(args.request));
+this.message = 'Duplicated IDs on the sent results. Make sure to use unique IDs.' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ResultTypeInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Result type invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Result type invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ResultsTooMuchError extends BadRequestError {
+    constructor(args) {
+        super('You sent too many results. See https://core.telegram.org/bots/api#answerinlinequery for the current limit.' + RPCError._fmtRequest(args.request));
+this.message = 'You sent too many results. See https://core.telegram.org/bots/api#answerinlinequery for the current limit.' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class RightForbiddenError extends ForbiddenError {
+    constructor(args) {
+        super('Either your admin rights do not allow you to do this or you passed the wrong rights combination (some rights only apply to channels and vice versa)' + RPCError._fmtRequest(args.request));
+this.message = 'Either your admin rights do not allow you to do this or you passed the wrong rights combination (some rights only apply to channels and vice versa)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class RpcCallFailError extends BadRequestError {
+    constructor(args) {
+        super('Telegram is having internal issues, please try again later.' + RPCError._fmtRequest(args.request));
+this.message = 'Telegram is having internal issues, please try again later.' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class RpcMcgetFailError extends BadRequestError {
+    constructor(args) {
+        super('Telegram is having internal issues, please try again later.' + RPCError._fmtRequest(args.request));
+this.message = 'Telegram is having internal issues, please try again later.' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class RsaDecryptFailedError extends BadRequestError {
+    constructor(args) {
+        super('Internal RSA decryption failed' + RPCError._fmtRequest(args.request));
+this.message = 'Internal RSA decryption failed' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ScheduleDateTooLateError extends BadRequestError {
+    constructor(args) {
+        super('The date you tried to schedule is too far in the future (last known limit of 1 year and a few hours)' + RPCError._fmtRequest(args.request));
+this.message = 'The date you tried to schedule is too far in the future (last known limit of 1 year and a few hours)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ScheduleTooMuchError extends BadRequestError {
+    constructor(args) {
+        super('You cannot schedule more messages in this chat (last known limit of 100 per chat)' + RPCError._fmtRequest(args.request));
+this.message = 'You cannot schedule more messages in this chat (last known limit of 100 per chat)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class SearchQueryEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The search query is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The search query is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class SecondsInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Slow mode only supports certain values (e.g. 0, 10s, 30s, 1m, 5m, 15m and 1h)' + RPCError._fmtRequest(args.request));
+this.message = 'Slow mode only supports certain values (e.g. 0, 10s, 30s, 1m, 5m, 15m and 1h)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class SendMessageMediaInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The message media was invalid or not specified' + RPCError._fmtRequest(args.request));
+this.message = 'The message media was invalid or not specified' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class SendMessageTypeInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The message type is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The message type is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class SessionExpiredError extends UnauthorizedError {
+    constructor(args) {
+        super('The authorization has expired' + RPCError._fmtRequest(args.request));
+this.message = 'The authorization has expired' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class SessionPasswordNeededError extends UnauthorizedError {
+    constructor(args) {
+        super('Two-steps verification is enabled and a password is required' + RPCError._fmtRequest(args.request));
+this.message = 'Two-steps verification is enabled and a password is required' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class SessionRevokedError extends UnauthorizedError {
+    constructor(args) {
+        super('The authorization has been invalidated, because of the user terminating all sessions' + RPCError._fmtRequest(args.request));
+this.message = 'The authorization has been invalidated, because of the user terminating all sessions' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class Sha256HashInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided SHA256 hash is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided SHA256 hash is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class ShortnameOccupyFailedError extends BadRequestError {
+    constructor(args) {
+        super('An error occurred when trying to register the short-name used for the sticker pack. Try a different name' + RPCError._fmtRequest(args.request));
+this.message = 'An error occurred when trying to register the short-name used for the sticker pack. Try a different name' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class SlowModeWaitError extends FloodError {
+    constructor(args) {
+        const seconds = Number(args.capture || 0);
+        super(format('A wait of {seconds} seconds is required before sending another message in this chat', {seconds}) + RPCError._fmtRequest(args.request));
+this.message = format('A wait of {seconds} seconds is required before sending another message in this chat', {seconds}) + RPCError._fmtRequest(args.request);
+        this.seconds = seconds;
+    }
+}
+
+
+class StartParamEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The start parameter is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The start parameter is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StartParamInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Start parameter invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Start parameter invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StickersetInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided sticker set is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided sticker set is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StickersEmptyError extends BadRequestError {
+    constructor(args) {
+        super('No sticker provided' + RPCError._fmtRequest(args.request));
+this.message = 'No sticker provided' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StickerEmojiInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Sticker emoji invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Sticker emoji invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StickerFileInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Sticker file invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Sticker file invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StickerIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided sticker ID is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided sticker ID is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StickerInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided sticker is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided sticker is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StickerPngDimensionsError extends BadRequestError {
+    constructor(args) {
+        super('Sticker png dimensions invalid' + RPCError._fmtRequest(args.request));
+this.message = 'Sticker png dimensions invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StorageCheckFailedError extends ServerError {
+    constructor(args) {
+        super('Server storage check failed' + RPCError._fmtRequest(args.request));
+this.message = 'Server storage check failed' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class StoreInvalidScalarTypeError extends ServerError {
+    constructor(args) {
+        super('' + RPCError._fmtRequest(args.request));
+this.message = '' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class TakeoutInitDelayError extends FloodError {
+    constructor(args) {
+        const seconds = Number(args.capture || 0);
+        super(format('A wait of {seconds} seconds is required before being able to initiate the takeout', {seconds}) + RPCError._fmtRequest(args.request));
+this.message = format('A wait of {seconds} seconds is required before being able to initiate the takeout', {seconds}) + RPCError._fmtRequest(args.request);
+        this.seconds = seconds;
+    }
+}
+
+
+class TakeoutInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The takeout session has been invalidated by another data export session' + RPCError._fmtRequest(args.request));
+this.message = 'The takeout session has been invalidated by another data export session' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class TakeoutRequiredError extends BadRequestError {
+    constructor(args) {
+        super('You must initialize a takeout request first' + RPCError._fmtRequest(args.request));
+this.message = 'You must initialize a takeout request first' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class TempAuthKeyEmptyError extends BadRequestError {
+    constructor(args) {
+        super('No temporary auth key provided' + RPCError._fmtRequest(args.request));
+this.message = 'No temporary auth key provided' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class TimeoutError extends TimedOutError {
+    constructor(args) {
+        super('A timeout occurred while fetching data from the worker' + RPCError._fmtRequest(args.request));
+this.message = 'A timeout occurred while fetching data from the worker' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class TmpPasswordDisabledError extends BadRequestError {
+    constructor(args) {
+        super('The temporary password is disabled' + RPCError._fmtRequest(args.request));
+this.message = 'The temporary password is disabled' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class TokenInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided token is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided token is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class TtlDaysInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The provided TTL is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The provided TTL is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class TypesEmptyError extends BadRequestError {
+    constructor(args) {
+        super('The types field is empty' + RPCError._fmtRequest(args.request));
+this.message = 'The types field is empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class TypeConstructorInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The type constructor is invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The type constructor is invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UnknownMethodError extends ServerError {
+    constructor(args) {
+        super('The method you tried to call cannot be called on non-CDN DCs' + RPCError._fmtRequest(args.request));
+this.message = 'The method you tried to call cannot be called on non-CDN DCs' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UntilDateInvalidError extends BadRequestError {
+    constructor(args) {
+        super('That date cannot be specified in this request (try using None)' + RPCError._fmtRequest(args.request));
+this.message = 'That date cannot be specified in this request (try using None)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UrlInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The URL used was invalid (e.g. when answering a callback with an URL that\'s not t.me/yourbot or your game\'s URL)' + RPCError._fmtRequest(args.request));
+this.message = 'The URL used was invalid (e.g. when answering a callback with an URL that\'s not t.me/yourbot or your game\'s URL)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UsernameInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Nobody is using this username, or the username is unacceptable. If the latter, it must match r"[a-zA-Z][\w\d]{3,30}[a-zA-Z\d]"' + RPCError._fmtRequest(args.request));
+this.message = 'Nobody is using this username, or the username is unacceptable. If the latter, it must match r"[a-zA-Z][\w\d]{3,30}[a-zA-Z\d]"' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UsernameNotModifiedError extends BadRequestError {
+    constructor(args) {
+        super('The username is not different from the current username' + RPCError._fmtRequest(args.request));
+this.message = 'The username is not different from the current username' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UsernameNotOccupiedError extends BadRequestError {
+    constructor(args) {
+        super('The username is not in use by anyone else yet' + RPCError._fmtRequest(args.request));
+this.message = 'The username is not in use by anyone else yet' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UsernameOccupiedError extends BadRequestError {
+    constructor(args) {
+        super('The username is already taken' + RPCError._fmtRequest(args.request));
+this.message = 'The username is already taken' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UsersTooFewError extends BadRequestError {
+    constructor(args) {
+        super('Not enough users (to create a chat, for example)' + RPCError._fmtRequest(args.request));
+this.message = 'Not enough users (to create a chat, for example)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UsersTooMuchError extends BadRequestError {
+    constructor(args) {
+        super('The maximum number of users has been exceeded (to create a chat, for example)' + RPCError._fmtRequest(args.request));
+this.message = 'The maximum number of users has been exceeded (to create a chat, for example)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserAdminInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Either you\'re not an admin or you tried to ban an admin that you didn\'t promote' + RPCError._fmtRequest(args.request));
+this.message = 'Either you\'re not an admin or you tried to ban an admin that you didn\'t promote' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserAlreadyParticipantError extends BadRequestError {
+    constructor(args) {
+        super('The authenticated user is already a participant of the chat' + RPCError._fmtRequest(args.request));
+this.message = 'The authenticated user is already a participant of the chat' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserBannedInChannelError extends BadRequestError {
+    constructor(args) {
+        super('You\'re banned from sending messages in supergroups/channels' + RPCError._fmtRequest(args.request));
+this.message = 'You\'re banned from sending messages in supergroups/channels' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserBlockedError extends BadRequestError {
+    constructor(args) {
+        super('User blocked' + RPCError._fmtRequest(args.request));
+this.message = 'User blocked' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserBotError extends BadRequestError {
+    constructor(args) {
+        super('Bots can only be admins in channels.' + RPCError._fmtRequest(args.request));
+this.message = 'Bots can only be admins in channels.' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserBotInvalidError extends BadRequestError {
+    constructor(args) {
+        super('This method can only be called by a bot' + RPCError._fmtRequest(args.request));
+this.message = 'This method can only be called by a bot' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserBotRequiredError extends BadRequestError {
+    constructor(args) {
+        super('This method can only be called by a bot' + RPCError._fmtRequest(args.request));
+this.message = 'This method can only be called by a bot' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserChannelsTooMuchError extends ForbiddenError {
+    constructor(args) {
+        super('One of the users you tried to add is already in too many channels/supergroups' + RPCError._fmtRequest(args.request));
+this.message = 'One of the users you tried to add is already in too many channels/supergroups' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserCreatorError extends BadRequestError {
+    constructor(args) {
+        super('You can\'t leave this channel, because you\'re its creator' + RPCError._fmtRequest(args.request));
+this.message = 'You can\'t leave this channel, because you\'re its creator' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserDeactivatedError extends UnauthorizedError {
+    constructor(args) {
+        super('The user has been deleted/deactivated' + RPCError._fmtRequest(args.request));
+this.message = 'The user has been deleted/deactivated' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserDeactivatedBanError extends UnauthorizedError {
+    constructor(args) {
+        super('The user has been deleted/deactivated' + RPCError._fmtRequest(args.request));
+this.message = 'The user has been deleted/deactivated' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserIdInvalidError extends BadRequestError {
+    constructor(args) {
+        super('Invalid object ID for a user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited' + RPCError._fmtRequest(args.request));
+this.message = 'Invalid object ID for a user. Make sure to pass the right types, for instance making sure that the request is designed for users or otherwise look for a different one more suited' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The given user was invalid' + RPCError._fmtRequest(args.request));
+this.message = 'The given user was invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserIsBlockedError extends BadRequestError {
+    constructor(args) {
+        super('User is blocked' + RPCError._fmtRequest(args.request));
+this.message = 'User is blocked' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserIsBotError extends BadRequestError {
+    constructor(args) {
+        super('Bots can\'t send messages to other bots' + RPCError._fmtRequest(args.request));
+this.message = 'Bots can\'t send messages to other bots' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserKickedError extends BadRequestError {
+    constructor(args) {
+        super('This user was kicked from this supergroup/channel' + RPCError._fmtRequest(args.request));
+this.message = 'This user was kicked from this supergroup/channel' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserMigrateError extends InvalidDCError {
+    constructor(args) {
+        const newDc = Number(args.capture || 0);
+        super(format('The user whose identity is being used to execute queries is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request));
+this.message = format('The user whose identity is being used to execute queries is associated with DC {new_dc}', {newDc}) + RPCError._fmtRequest(args.request);
+        this.newDc = newDc;
+    }
+}
+
+
+class UserNotMutualContactError extends BadRequestError {
+    constructor(args) {
+        super('The provided user is not a mutual contact' + RPCError._fmtRequest(args.request));
+this.message = 'The provided user is not a mutual contact' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserNotParticipantError extends BadRequestError {
+    constructor(args) {
+        super('The target user is not a member of the specified megagroup or channel' + RPCError._fmtRequest(args.request));
+this.message = 'The target user is not a member of the specified megagroup or channel' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserPrivacyRestrictedError extends ForbiddenError {
+    constructor(args) {
+        super('The user\'s privacy settings do not allow you to do this' + RPCError._fmtRequest(args.request));
+this.message = 'The user\'s privacy settings do not allow you to do this' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class UserRestrictedError extends ForbiddenError {
+    constructor(args) {
+        super('You\'re spamreported, you can\'t create channels or chats.' + RPCError._fmtRequest(args.request));
+this.message = 'You\'re spamreported, you can\'t create channels or chats.' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class VideoContentTypeInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The video content type is not supported with the given parameters (i.e. supports_streaming)' + RPCError._fmtRequest(args.request));
+this.message = 'The video content type is not supported with the given parameters (i.e. supports_streaming)' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class WallpaperFileInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The given file cannot be used as a wallpaper' + RPCError._fmtRequest(args.request));
+this.message = 'The given file cannot be used as a wallpaper' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class WallpaperInvalidError extends BadRequestError {
+    constructor(args) {
+        super('The input wallpaper was not valid' + RPCError._fmtRequest(args.request));
+this.message = 'The input wallpaper was not valid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class WcConvertUrlInvalidError extends BadRequestError {
+    constructor(args) {
+        super('WC convert URL invalid' + RPCError._fmtRequest(args.request));
+this.message = 'WC convert URL invalid' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class WebpageCurlFailedError extends BadRequestError {
+    constructor(args) {
+        super('Failure while fetching the webpage with cURL' + RPCError._fmtRequest(args.request));
+this.message = 'Failure while fetching the webpage with cURL' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class WebpageMediaEmptyError extends BadRequestError {
+    constructor(args) {
+        super('Webpage media empty' + RPCError._fmtRequest(args.request));
+this.message = 'Webpage media empty' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class WorkerBusyTooLongRetryError extends ServerError {
+    constructor(args) {
+        super('Telegram workers are too busy to respond immediately' + RPCError._fmtRequest(args.request));
+this.message = 'Telegram workers are too busy to respond immediately' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+class YouBlockedUserError extends BadRequestError {
+    constructor(args) {
+        super('You blocked this user' + RPCError._fmtRequest(args.request));
+this.message = 'You blocked this user' + RPCError._fmtRequest(args.request);
+    }
+}
+
+
+const rpcErrorsObject = {
+    ABOUT_TOO_LONG: AboutTooLongError,
+    ACCESS_TOKEN_EXPIRED: AccessTokenExpiredError,
+    ACCESS_TOKEN_INVALID: AccessTokenInvalidError,
+    ACTIVE_USER_REQUIRED: ActiveUserRequiredError,
+    ADMINS_TOO_MUCH: AdminsTooMuchError,
+    ADMIN_RANK_EMOJI_NOT_ALLOWED: AdminRankEmojiNotAllowedError,
+    ADMIN_RANK_INVALID: AdminRankInvalidError,
+    API_ID_INVALID: ApiIdInvalidError,
+    API_ID_PUBLISHED_FLOOD: ApiIdPublishedFloodError,
+    ARTICLE_TITLE_EMPTY: ArticleTitleEmptyError,
+    AUTH_BYTES_INVALID: AuthBytesInvalidError,
+    AUTH_KEY_DUPLICATED: AuthKeyDuplicatedError,
+    AUTH_KEY_INVALID: AuthKeyInvalidError,
+    AUTH_KEY_PERM_EMPTY: AuthKeyPermEmptyError,
+    AUTH_KEY_UNREGISTERED: AuthKeyUnregisteredError,
+    AUTH_RESTART: AuthRestartError,
+    BANNED_RIGHTS_INVALID: BannedRightsInvalidError,
+    BOTS_TOO_MUCH: BotsTooMuchError,
+    BOT_CHANNELS_NA: BotChannelsNaError,
+    BOT_GROUPS_BLOCKED: BotGroupsBlockedError,
+    BOT_INLINE_DISABLED: BotInlineDisabledError,
+    BOT_INVALID: BotInvalidError,
+    BOT_METHOD_INVALID: BotMethodInvalidError,
+    BOT_MISSING: BotMissingError,
+    BOT_PAYMENTS_DISABLED: BotPaymentsDisabledError,
+    BOT_POLLS_DISABLED: BotPollsDisabledError,
+    BROADCAST_ID_INVALID: BroadcastIdInvalidError,
+    BUTTON_DATA_INVALID: ButtonDataInvalidError,
+    BUTTON_TYPE_INVALID: ButtonTypeInvalidError,
+    BUTTON_URL_INVALID: ButtonUrlInvalidError,
+    CALL_ALREADY_ACCEPTED: CallAlreadyAcceptedError,
+    CALL_ALREADY_DECLINED: CallAlreadyDeclinedError,
+    CALL_OCCUPY_FAILED: CallOccupyFailedError,
+    CALL_PEER_INVALID: CallPeerInvalidError,
+    CALL_PROTOCOL_FLAGS_INVALID: CallProtocolFlagsInvalidError,
+    CDN_METHOD_INVALID: CdnMethodInvalidError,
+    CHANNELS_ADMIN_PUBLIC_TOO_MUCH: ChannelsAdminPublicTooMuchError,
+    CHANNELS_TOO_MUCH: ChannelsTooMuchError,
+    CHANNEL_INVALID: ChannelInvalidError,
+    CHANNEL_PRIVATE: ChannelPrivateError,
+    CHANNEL_PUBLIC_GROUP_NA: ChannelPublicGroupNaError,
+    CHAT_ABOUT_NOT_MODIFIED: ChatAboutNotModifiedError,
+    CHAT_ABOUT_TOO_LONG: ChatAboutTooLongError,
+    CHAT_ADMIN_INVITE_REQUIRED: ChatAdminInviteRequiredError,
+    CHAT_ADMIN_REQUIRED: ChatAdminRequiredError,
+    CHAT_FORBIDDEN: ChatForbiddenError,
+    CHAT_ID_EMPTY: ChatIdEmptyError,
+    CHAT_ID_INVALID: ChatIdInvalidError,
+    CHAT_INVALID: ChatInvalidError,
+    CHAT_LINK_EXISTS: ChatLinkExistsError,
+    CHAT_NOT_MODIFIED: ChatNotModifiedError,
+    CHAT_RESTRICTED: ChatRestrictedError,
+    CHAT_SEND_GIFS_FORBIDDEN: ChatSendGifsForbiddenError,
+    CHAT_SEND_INLINE_FORBIDDEN: ChatSendInlineForbiddenError,
+    CHAT_SEND_MEDIA_FORBIDDEN: ChatSendMediaForbiddenError,
+    CHAT_SEND_STICKERS_FORBIDDEN: ChatSendStickersForbiddenError,
+    CHAT_TITLE_EMPTY: ChatTitleEmptyError,
+    CHAT_WRITE_FORBIDDEN: ChatWriteForbiddenError,
+    CODE_EMPTY: CodeEmptyError,
+    CODE_HASH_INVALID: CodeHashInvalidError,
+    CODE_INVALID: CodeInvalidError,
+    CONNECTION_API_ID_INVALID: ConnectionApiIdInvalidError,
+    CONNECTION_DEVICE_MODEL_EMPTY: ConnectionDeviceModelEmptyError,
+    CONNECTION_LANG_PACK_INVALID: ConnectionLangPackInvalidError,
+    CONNECTION_LAYER_INVALID: ConnectionLayerInvalidError,
+    CONNECTION_NOT_INITED: ConnectionNotInitedError,
+    CONNECTION_SYSTEM_EMPTY: ConnectionSystemEmptyError,
+    CONTACT_ID_INVALID: ContactIdInvalidError,
+    DATA_INVALID: DataInvalidError,
+    DATA_JSON_INVALID: DataJsonInvalidError,
+    DATE_EMPTY: DateEmptyError,
+    DC_ID_INVALID: DcIdInvalidError,
+    DH_G_A_INVALID: DhGAInvalidError,
+    EMAIL_HASH_EXPIRED: EmailHashExpiredError,
+    EMAIL_INVALID: EmailInvalidError,
+    EMOTICON_EMPTY: EmoticonEmptyError,
+    ENCRYPTED_MESSAGE_INVALID: EncryptedMessageInvalidError,
+    ENCRYPTION_ALREADY_ACCEPTED: EncryptionAlreadyAcceptedError,
+    ENCRYPTION_ALREADY_DECLINED: EncryptionAlreadyDeclinedError,
+    ENCRYPTION_DECLINED: EncryptionDeclinedError,
+    ENCRYPTION_ID_INVALID: EncryptionIdInvalidError,
+    ENCRYPTION_OCCUPY_FAILED: EncryptionOccupyFailedError,
+    ENTITIES_TOO_LONG: EntitiesTooLongError,
+    ENTITY_MENTION_USER_INVALID: EntityMentionUserInvalidError,
+    ERROR_TEXT_EMPTY: ErrorTextEmptyError,
+    EXPORT_CARD_INVALID: ExportCardInvalidError,
+    EXTERNAL_URL_INVALID: ExternalUrlInvalidError,
+    FIELD_NAME_EMPTY: FieldNameEmptyError,
+    FIELD_NAME_INVALID: FieldNameInvalidError,
+    FILE_ID_INVALID: FileIdInvalidError,
+    FILE_PARTS_INVALID: FilePartsInvalidError,
+    FILE_PART_0_MISSING: FilePart0MissingError,
+    FILE_PART_EMPTY: FilePartEmptyError,
+    FILE_PART_INVALID: FilePartInvalidError,
+    FILE_PART_LENGTH_INVALID: FilePartLengthInvalidError,
+    FILE_PART_SIZE_INVALID: FilePartSizeInvalidError,
+    FILEREF_UPGRADE_NEEDED: FilerefUpgradeNeededError,
+    FIRSTNAME_INVALID: FirstNameInvalidError,
+    FOLDER_ID_EMPTY: FolderIdEmptyError,
+    FOLDER_ID_INVALID: FolderIdInvalidError,
+    FRESH_RESET_AUTHORISATION_FORBIDDEN: FreshResetAuthorisationForbiddenError,
+    GIF_ID_INVALID: GifIdInvalidError,
+    GROUPED_MEDIA_INVALID: GroupedMediaInvalidError,
+    HASH_INVALID: HashInvalidError,
+    HISTORY_GET_FAILED: HistoryGetFailedError,
+    IMAGE_PROCESS_FAILED: ImageProcessFailedError,
+    INLINE_RESULT_EXPIRED: InlineResultExpiredError,
+    INPUT_CONSTRUCTOR_INVALID: InputConstructorInvalidError,
+    INPUT_FETCH_ERROR: InputFetchErrorError,
+    INPUT_FETCH_FAIL: InputFetchFailError,
+    INPUT_LAYER_INVALID: InputLayerInvalidError,
+    INPUT_METHOD_INVALID: InputMethodInvalidError,
+    INPUT_REQUEST_TOO_LONG: InputRequestTooLongError,
+    INPUT_USER_DEACTIVATED: InputUserDeactivatedError,
+    INVITE_HASH_EMPTY: InviteHashEmptyError,
+    INVITE_HASH_EXPIRED: InviteHashExpiredError,
+    INVITE_HASH_INVALID: InviteHashInvalidError,
+    LANG_PACK_INVALID: LangPackInvalidError,
+    LASTNAME_INVALID: LastnameInvalidError,
+    LIMIT_INVALID: LimitInvalidError,
+    LINK_NOT_MODIFIED: LinkNotModifiedError,
+    LOCATION_INVALID: LocationInvalidError,
+    MAX_ID_INVALID: MaxIdInvalidError,
+    MAX_QTS_INVALID: MaxQtsInvalidError,
+    MD5_CHECKSUM_INVALID: Md5ChecksumInvalidError,
+    MEDIA_CAPTION_TOO_LONG: MediaCaptionTooLongError,
+    MEDIA_EMPTY: MediaEmptyError,
+    MEDIA_INVALID: MediaInvalidError,
+    MEDIA_NEW_INVALID: MediaNewInvalidError,
+    MEDIA_PREV_INVALID: MediaPrevInvalidError,
+    MEGAGROUP_ID_INVALID: MegagroupIdInvalidError,
+    MEGAGROUP_PREHISTORY_HIDDEN: MegagroupPrehistoryHiddenError,
+    MEMBER_NO_LOCATION: MemberNoLocationError,
+    MEMBER_OCCUPY_PRIMARY_LOC_FAILED: MemberOccupyPrimaryLocFailedError,
+    MESSAGE_AUTHOR_REQUIRED: MessageAuthorRequiredError,
+    MESSAGE_DELETE_FORBIDDEN: MessageDeleteForbiddenError,
+    MESSAGE_EDIT_TIME_EXPIRED: MessageEditTimeExpiredError,
+    MESSAGE_EMPTY: MessageEmptyError,
+    MESSAGE_IDS_EMPTY: MessageIdsEmptyError,
+    MESSAGE_ID_INVALID: MessageIdInvalidError,
+    MESSAGE_NOT_MODIFIED: MessageNotModifiedError,
+    MESSAGE_TOO_LONG: MessageTooLongError,
+    MSG_WAIT_FAILED: MsgWaitFailedError,
+    MT_SEND_QUEUE_TOO_LONG: MtSendQueueTooLongError,
+    NEED_CHAT_INVALID: NeedChatInvalidError,
+    NEED_MEMBER_INVALID: NeedMemberInvalidError,
+    NEW_SALT_INVALID: NewSaltInvalidError,
+    NEW_SETTINGS_INVALID: NewSettingsInvalidError,
+    OFFSET_INVALID: OffsetInvalidError,
+    OFFSET_PEER_ID_INVALID: OffsetPeerIdInvalidError,
+    OPTIONS_TOO_MUCH: OptionsTooMuchError,
+    PACK_SHORT_NAME_INVALID: PackShortNameInvalidError,
+    PACK_SHORT_NAME_OCCUPIED: PackShortNameOccupiedError,
+    PARTICIPANTS_TOO_FEW: ParticipantsTooFewError,
+    PARTICIPANT_CALL_FAILED: ParticipantCallFailedError,
+    PARTICIPANT_VERSION_OUTDATED: ParticipantVersionOutdatedError,
+    PASSWORD_EMPTY: PasswordEmptyError,
+    PASSWORD_HASH_INVALID: PasswordHashInvalidError,
+    PASSWORD_REQUIRED: PasswordRequiredError,
+    PAYMENT_PROVIDER_INVALID: PaymentProviderInvalidError,
+    PEER_FLOOD: PeerFloodError,
+    PEER_ID_INVALID: PeerIdInvalidError,
+    PEER_ID_NOT_SUPPORTED: PeerIdNotSupportedError,
+    PERSISTENT_TIMESTAMP_EMPTY: PersistentTimestampEmptyError,
+    PERSISTENT_TIMESTAMP_INVALID: PersistentTimestampInvalidError,
+    PERSISTENT_TIMESTAMP_OUTDATED: PersistentTimestampOutdatedError,
+    PHONE_CODE_EMPTY: PhoneCodeEmptyError,
+    PHONE_CODE_EXPIRED: PhoneCodeExpiredError,
+    PHONE_CODE_HASH_EMPTY: PhoneCodeHashEmptyError,
+    PHONE_CODE_INVALID: PhoneCodeInvalidError,
+    PHONE_NUMBER_APP_SIGNUP_FORBIDDEN: PhoneNumberAppSignupForbiddenError,
+    PHONE_NUMBER_BANNED: PhoneNumberBannedError,
+    PHONE_NUMBER_FLOOD: PhoneNumberFloodError,
+    PHONE_NUMBER_INVALID: PhoneNumberInvalidError,
+    PHONE_NUMBER_OCCUPIED: PhoneNumberOccupiedError,
+    PHONE_NUMBER_UNOCCUPIED: PhoneNumberUnoccupiedError,
+    PHONE_PASSWORD_FLOOD: PhonePasswordFloodError,
+    PHONE_PASSWORD_PROTECTED: PhonePasswordProtectedError,
+    PHOTO_CONTENT_URL_EMPTY: PhotoContentUrlEmptyError,
+    PHOTO_CROP_SIZE_SMALL: PhotoCropSizeSmallError,
+    PHOTO_EXT_INVALID: PhotoExtInvalidError,
+    PHOTO_INVALID: PhotoInvalidError,
+    PHOTO_INVALID_DIMENSIONS: PhotoInvalidDimensionsError,
+    PHOTO_SAVE_FILE_INVALID: PhotoSaveFileInvalidError,
+    PHOTO_THUMB_URL_EMPTY: PhotoThumbUrlEmptyError,
+    PIN_RESTRICTED: PinRestrictedError,
+    POLL_OPTION_DUPLICATE: PollOptionDuplicateError,
+    POLL_UNSUPPORTED: PollUnsupportedError,
+    PRIVACY_KEY_INVALID: PrivacyKeyInvalidError,
+    PTS_CHANGE_EMPTY: PtsChangeEmptyError,
+    QUERY_ID_EMPTY: QueryIdEmptyError,
+    QUERY_ID_INVALID: QueryIdInvalidError,
+    QUERY_TOO_SHORT: QueryTooShortError,
+    RANDOM_ID_DUPLICATE: RandomIdDuplicateError,
+    RANDOM_ID_INVALID: RandomIdInvalidError,
+    RANDOM_LENGTH_INVALID: RandomLengthInvalidError,
+    RANGES_INVALID: RangesInvalidError,
+    REACTION_EMPTY: ReactionEmptyError,
+    REACTION_INVALID: ReactionInvalidError,
+    REG_ID_GENERATE_FAILED: RegIdGenerateFailedError,
+    REPLY_MARKUP_INVALID: ReplyMarkupInvalidError,
+    REPLY_MARKUP_TOO_LONG: ReplyMarkupTooLongError,
+    RESULT_ID_DUPLICATE: ResultIdDuplicateError,
+    RESULT_TYPE_INVALID: ResultTypeInvalidError,
+    RESULTS_TOO_MUCH: ResultsTooMuchError,
+    RIGHT_FORBIDDEN: RightForbiddenError,
+    RPC_CALL_FAIL: RpcCallFailError,
+    RPC_MCGET_FAIL: RpcMcgetFailError,
+    RSA_DECRYPT_FAILED: RsaDecryptFailedError,
+    SCHEDULE_DATE_TOO_LATE: ScheduleDateTooLateError,
+    SCHEDULE_TOO_MUCH: ScheduleTooMuchError,
+    SEARCH_QUERY_EMPTY: SearchQueryEmptyError,
+    SECONDS_INVALID: SecondsInvalidError,
+    SEND_MESSAGE_MEDIA_INVALID: SendMessageMediaInvalidError,
+    SEND_MESSAGE_TYPE_INVALID: SendMessageTypeInvalidError,
+    SESSION_EXPIRED: SessionExpiredError,
+    SESSION_PASSWORD_NEEDED: SessionPasswordNeededError,
+    SESSION_REVOKED: SessionRevokedError,
+    SHA256_HASH_INVALID: Sha256HashInvalidError,
+    SHORTNAME_OCCUPY_FAILED: ShortnameOccupyFailedError,
+    START_PARAM_EMPTY: StartParamEmptyError,
+    START_PARAM_INVALID: StartParamInvalidError,
+    STICKERSET_INVALID: StickersetInvalidError,
+    STICKERS_EMPTY: StickersEmptyError,
+    STICKER_EMOJI_INVALID: StickerEmojiInvalidError,
+    STICKER_FILE_INVALID: StickerFileInvalidError,
+    STICKER_ID_INVALID: StickerIdInvalidError,
+    STICKER_INVALID: StickerInvalidError,
+    STICKER_PNG_DIMENSIONS: StickerPngDimensionsError,
+    STORAGE_CHECK_FAILED: StorageCheckFailedError,
+    STORE_INVALID_SCALAR_TYPE: StoreInvalidScalarTypeError,
+    TAKEOUT_INVALID: TakeoutInvalidError,
+    TAKEOUT_REQUIRED: TakeoutRequiredError,
+    TEMP_AUTH_KEY_EMPTY: TempAuthKeyEmptyError,
+    Timeout: TimeoutError,
+    TMP_PASSWORD_DISABLED: TmpPasswordDisabledError,
+    TOKEN_INVALID: TokenInvalidError,
+    TTL_DAYS_INVALID: TtlDaysInvalidError,
+    TYPES_EMPTY: TypesEmptyError,
+    TYPE_CONSTRUCTOR_INVALID: TypeConstructorInvalidError,
+    UNKNOWN_METHOD: UnknownMethodError,
+    UNTIL_DATE_INVALID: UntilDateInvalidError,
+    URL_INVALID: UrlInvalidError,
+    USERNAME_INVALID: UsernameInvalidError,
+    USERNAME_NOT_MODIFIED: UsernameNotModifiedError,
+    USERNAME_NOT_OCCUPIED: UsernameNotOccupiedError,
+    USERNAME_OCCUPIED: UsernameOccupiedError,
+    USERS_TOO_FEW: UsersTooFewError,
+    USERS_TOO_MUCH: UsersTooMuchError,
+    USER_ADMIN_INVALID: UserAdminInvalidError,
+    USER_ALREADY_PARTICIPANT: UserAlreadyParticipantError,
+    USER_BANNED_IN_CHANNEL: UserBannedInChannelError,
+    USER_BLOCKED: UserBlockedError,
+    USER_BOT: UserBotError,
+    USER_BOT_INVALID: UserBotInvalidError,
+    USER_BOT_REQUIRED: UserBotRequiredError,
+    USER_CHANNELS_TOO_MUCH: UserChannelsTooMuchError,
+    USER_CREATOR: UserCreatorError,
+    USER_DEACTIVATED: UserDeactivatedError,
+    USER_DEACTIVATED_BAN: UserDeactivatedBanError,
+    USER_ID_INVALID: UserIdInvalidError,
+    USER_INVALID: UserInvalidError,
+    USER_IS_BLOCKED: UserIsBlockedError,
+    USER_IS_BOT: UserIsBotError,
+    USER_KICKED: UserKickedError,
+    USER_NOT_MUTUAL_CONTACT: UserNotMutualContactError,
+    USER_NOT_PARTICIPANT: UserNotParticipantError,
+    USER_PRIVACY_RESTRICTED: UserPrivacyRestrictedError,
+    USER_RESTRICTED: UserRestrictedError,
+    VIDEO_CONTENT_TYPE_INVALID: VideoContentTypeInvalidError,
+    WALLPAPER_FILE_INVALID: WallpaperFileInvalidError,
+    WALLPAPER_INVALID: WallpaperInvalidError,
+    WC_CONVERT_URL_INVALID: WcConvertUrlInvalidError,
+    WEBPAGE_CURL_FAILED: WebpageCurlFailedError,
+    WEBPAGE_MEDIA_EMPTY: WebpageMediaEmptyError,
+    WORKER_BUSY_TOO_LONG_RETRY: WorkerBusyTooLongRetryError,
+    YOU_BLOCKED_USER: YouBlockedUserError,
+};
+
+const rpcErrorRe = [
+    [/EMAIL_UNCONFIRMED_(\d+)/, EmailUnconfirmedError],
+    [/FILE_MIGRATE_(\d+)/, FileMigrateError],
+    [/FILE_PART_(\d+)_MISSING/, FilePartMissingError],
+    [/FLOOD_TEST_PHONE_WAIT_(\d+)/, FloodTestPhoneWaitError],
+    [/FLOOD_WAIT_(\d+)/, FloodWaitError],
+    [/INTERDC_(\d+)_CALL_ERROR/, InterdcCallErrorError],
+    [/INTERDC_(\d+)_CALL_RICH_ERROR/, InterdcCallRichErrorError],
+    [/NETWORK_MIGRATE_(\d+)/, NetworkMigrateError],
+    [/PHONE_MIGRATE_(\d+)/, PhoneMigrateError],
+    [/SLOWMODE_WAIT_(\d+)/, SlowModeWaitError],
+    [/TAKEOUT_INIT_DELAY_(\d+)/, TakeoutInitDelayError],
+    [/USER_MIGRATE_(\d+)/, UserMigrateError],
+];module.exports = {     EmailUnconfirmedError,
+     FileMigrateError,
+     FilePartMissingError,
+     FloodTestPhoneWaitError,
+     FloodWaitError,
+     InterdcCallErrorError,
+     InterdcCallRichErrorError,
+     NetworkMigrateError,
+     PhoneMigrateError,
+     SlowModeWaitError,
+     TakeoutInitDelayError,
+     UserMigrateError,
+     AboutTooLongError,
+     AccessTokenExpiredError,
+     AccessTokenInvalidError,
+     ActiveUserRequiredError,
+     AdminsTooMuchError,
+     AdminRankEmojiNotAllowedError,
+     AdminRankInvalidError,
+     ApiIdInvalidError,
+     ApiIdPublishedFloodError,
+     ArticleTitleEmptyError,
+     AuthBytesInvalidError,
+     AuthKeyDuplicatedError,
+     AuthKeyInvalidError,
+     AuthKeyPermEmptyError,
+     AuthKeyUnregisteredError,
+     AuthRestartError,
+     BannedRightsInvalidError,
+     BotsTooMuchError,
+     BotChannelsNaError,
+     BotGroupsBlockedError,
+     BotInlineDisabledError,
+     BotInvalidError,
+     BotMethodInvalidError,
+     BotMissingError,
+     BotPaymentsDisabledError,
+     BotPollsDisabledError,
+     BroadcastIdInvalidError,
+     ButtonDataInvalidError,
+     ButtonTypeInvalidError,
+     ButtonUrlInvalidError,
+     CallAlreadyAcceptedError,
+     CallAlreadyDeclinedError,
+     CallOccupyFailedError,
+     CallPeerInvalidError,
+     CallProtocolFlagsInvalidError,
+     CdnMethodInvalidError,
+     ChannelsAdminPublicTooMuchError,
+     ChannelsTooMuchError,
+     ChannelInvalidError,
+     ChannelPrivateError,
+     ChannelPublicGroupNaError,
+     ChatAboutNotModifiedError,
+     ChatAboutTooLongError,
+     ChatAdminInviteRequiredError,
+     ChatAdminRequiredError,
+     ChatForbiddenError,
+     ChatIdEmptyError,
+     ChatIdInvalidError,
+     ChatInvalidError,
+     ChatLinkExistsError,
+     ChatNotModifiedError,
+     ChatRestrictedError,
+     ChatSendGifsForbiddenError,
+     ChatSendInlineForbiddenError,
+     ChatSendMediaForbiddenError,
+     ChatSendStickersForbiddenError,
+     ChatTitleEmptyError,
+     ChatWriteForbiddenError,
+     CodeEmptyError,
+     CodeHashInvalidError,
+     CodeInvalidError,
+     ConnectionApiIdInvalidError,
+     ConnectionDeviceModelEmptyError,
+     ConnectionLangPackInvalidError,
+     ConnectionLayerInvalidError,
+     ConnectionNotInitedError,
+     ConnectionSystemEmptyError,
+     ContactIdInvalidError,
+     DataInvalidError,
+     DataJsonInvalidError,
+     DateEmptyError,
+     DcIdInvalidError,
+     DhGAInvalidError,
+     EmailHashExpiredError,
+     EmailInvalidError,
+     EmoticonEmptyError,
+     EncryptedMessageInvalidError,
+     EncryptionAlreadyAcceptedError,
+     EncryptionAlreadyDeclinedError,
+     EncryptionDeclinedError,
+     EncryptionIdInvalidError,
+     EncryptionOccupyFailedError,
+     EntitiesTooLongError,
+     EntityMentionUserInvalidError,
+     ErrorTextEmptyError,
+     ExportCardInvalidError,
+     ExternalUrlInvalidError,
+     FieldNameEmptyError,
+     FieldNameInvalidError,
+     FileIdInvalidError,
+     FilePartsInvalidError,
+     FilePart0MissingError,
+     FilePartEmptyError,
+     FilePartInvalidError,
+     FilePartLengthInvalidError,
+     FilePartSizeInvalidError,
+     FilerefUpgradeNeededError,
+     FirstNameInvalidError,
+     FolderIdEmptyError,
+     FolderIdInvalidError,
+     FreshResetAuthorisationForbiddenError,
+     GifIdInvalidError,
+     GroupedMediaInvalidError,
+     HashInvalidError,
+     HistoryGetFailedError,
+     ImageProcessFailedError,
+     InlineResultExpiredError,
+     InputConstructorInvalidError,
+     InputFetchErrorError,
+     InputFetchFailError,
+     InputLayerInvalidError,
+     InputMethodInvalidError,
+     InputRequestTooLongError,
+     InputUserDeactivatedError,
+     InviteHashEmptyError,
+     InviteHashExpiredError,
+     InviteHashInvalidError,
+     LangPackInvalidError,
+     LastnameInvalidError,
+     LimitInvalidError,
+     LinkNotModifiedError,
+     LocationInvalidError,
+     MaxIdInvalidError,
+     MaxQtsInvalidError,
+     Md5ChecksumInvalidError,
+     MediaCaptionTooLongError,
+     MediaEmptyError,
+     MediaInvalidError,
+     MediaNewInvalidError,
+     MediaPrevInvalidError,
+     MegagroupIdInvalidError,
+     MegagroupPrehistoryHiddenError,
+     MemberNoLocationError,
+     MemberOccupyPrimaryLocFailedError,
+     MessageAuthorRequiredError,
+     MessageDeleteForbiddenError,
+     MessageEditTimeExpiredError,
+     MessageEmptyError,
+     MessageIdsEmptyError,
+     MessageIdInvalidError,
+     MessageNotModifiedError,
+     MessageTooLongError,
+     MsgWaitFailedError,
+     MtSendQueueTooLongError,
+     NeedChatInvalidError,
+     NeedMemberInvalidError,
+     NewSaltInvalidError,
+     NewSettingsInvalidError,
+     OffsetInvalidError,
+     OffsetPeerIdInvalidError,
+     OptionsTooMuchError,
+     PackShortNameInvalidError,
+     PackShortNameOccupiedError,
+     ParticipantsTooFewError,
+     ParticipantCallFailedError,
+     ParticipantVersionOutdatedError,
+     PasswordEmptyError,
+     PasswordHashInvalidError,
+     PasswordRequiredError,
+     PaymentProviderInvalidError,
+     PeerFloodError,
+     PeerIdInvalidError,
+     PeerIdNotSupportedError,
+     PersistentTimestampEmptyError,
+     PersistentTimestampInvalidError,
+     PersistentTimestampOutdatedError,
+     PhoneCodeEmptyError,
+     PhoneCodeExpiredError,
+     PhoneCodeHashEmptyError,
+     PhoneCodeInvalidError,
+     PhoneNumberAppSignupForbiddenError,
+     PhoneNumberBannedError,
+     PhoneNumberFloodError,
+     PhoneNumberInvalidError,
+     PhoneNumberOccupiedError,
+     PhoneNumberUnoccupiedError,
+     PhonePasswordFloodError,
+     PhonePasswordProtectedError,
+     PhotoContentUrlEmptyError,
+     PhotoCropSizeSmallError,
+     PhotoExtInvalidError,
+     PhotoInvalidError,
+     PhotoInvalidDimensionsError,
+     PhotoSaveFileInvalidError,
+     PhotoThumbUrlEmptyError,
+     PinRestrictedError,
+     PollOptionDuplicateError,
+     PollUnsupportedError,
+     PrivacyKeyInvalidError,
+     PtsChangeEmptyError,
+     QueryIdEmptyError,
+     QueryIdInvalidError,
+     QueryTooShortError,
+     RandomIdDuplicateError,
+     RandomIdInvalidError,
+     RandomLengthInvalidError,
+     RangesInvalidError,
+     ReactionEmptyError,
+     ReactionInvalidError,
+     RegIdGenerateFailedError,
+     ReplyMarkupInvalidError,
+     ReplyMarkupTooLongError,
+     ResultIdDuplicateError,
+     ResultTypeInvalidError,
+     ResultsTooMuchError,
+     RightForbiddenError,
+     RpcCallFailError,
+     RpcMcgetFailError,
+     RsaDecryptFailedError,
+     ScheduleDateTooLateError,
+     ScheduleTooMuchError,
+     SearchQueryEmptyError,
+     SecondsInvalidError,
+     SendMessageMediaInvalidError,
+     SendMessageTypeInvalidError,
+     SessionExpiredError,
+     SessionPasswordNeededError,
+     SessionRevokedError,
+     Sha256HashInvalidError,
+     ShortnameOccupyFailedError,
+     StartParamEmptyError,
+     StartParamInvalidError,
+     StickersetInvalidError,
+     StickersEmptyError,
+     StickerEmojiInvalidError,
+     StickerFileInvalidError,
+     StickerIdInvalidError,
+     StickerInvalidError,
+     StickerPngDimensionsError,
+     StorageCheckFailedError,
+     StoreInvalidScalarTypeError,
+     TakeoutInvalidError,
+     TakeoutRequiredError,
+     TempAuthKeyEmptyError,
+     TimeoutError,
+     TmpPasswordDisabledError,
+     TokenInvalidError,
+     TtlDaysInvalidError,
+     TypesEmptyError,
+     TypeConstructorInvalidError,
+     UnknownMethodError,
+     UntilDateInvalidError,
+     UrlInvalidError,
+     UsernameInvalidError,
+     UsernameNotModifiedError,
+     UsernameNotOccupiedError,
+     UsernameOccupiedError,
+     UsersTooFewError,
+     UsersTooMuchError,
+     UserAdminInvalidError,
+     UserAlreadyParticipantError,
+     UserBannedInChannelError,
+     UserBlockedError,
+     UserBotError,
+     UserBotInvalidError,
+     UserBotRequiredError,
+     UserChannelsTooMuchError,
+     UserCreatorError,
+     UserDeactivatedError,
+     UserDeactivatedBanError,
+     UserIdInvalidError,
+     UserInvalidError,
+     UserIsBlockedError,
+     UserIsBotError,
+     UserKickedError,
+     UserNotMutualContactError,
+     UserNotParticipantError,
+     UserPrivacyRestrictedError,
+     UserRestrictedError,
+     VideoContentTypeInvalidError,
+     WallpaperFileInvalidError,
+     WallpaperInvalidError,
+     WcConvertUrlInvalidError,
+     WebpageCurlFailedError,
+     WebpageMediaEmptyError,
+     WorkerBusyTooLongRetryError,
+     YouBlockedUserError,
+     rpcErrorsObject,
+     rpcErrorRe,
+}

+ 102 - 0
src/lib/gramjs/extensions/Logger.js

@@ -0,0 +1,102 @@
+let logger = null
+
+class Logger {
+    static levels = ['debug', 'info', 'warn', 'error']
+
+    constructor(level) {
+        this.level = level
+        this.isBrowser = typeof process === 'undefined' ||
+            process.type === 'renderer' ||
+            process.browser === true ||
+            process.__nwjs
+        if (!this.isBrowser) {
+            this.colors = {
+                start: '\x1b[2m',
+                warn: '\x1b[35m',
+                info: '\x1b[33m',
+                debug: '\x1b[36m',
+                error: '\x1b[31m',
+                end: '\x1b[0m',
+            }
+        } else {
+            this.colors = {
+                start: '%c',
+                warn: 'color : #ff00ff',
+                info: 'color : #ffff00',
+                debug: 'color : #00ffff',
+                error: 'color : #ff0000',
+                end: '',
+            }
+        }
+        this.messageFormat = '[%t] [%l] - [%m]'
+    }
+
+    /**
+     *
+     * @param level {string}
+     * @returns {boolean}
+     */
+    canSend(level) {
+        return (Logger.levels.indexOf(this.level) <= Logger.levels.indexOf(level))
+    }
+
+    /**
+     * @param message {string}
+     */
+    warn(message) {
+        this._log('warn', message, this.colors.warn)
+    }
+
+    /**
+     * @param message {string}
+     */
+    info(message) {
+        this._log('info', message, this.colors.info)
+    }
+
+    /**
+     * @param message {string}
+     */
+    debug(message) {
+        this._log('debug', message, this.colors.debug)
+    }
+
+    /**
+     * @param message {string}
+     */
+    error(message) {
+        this._log('error', message, this.colors.error)
+    }
+
+    format(message, level) {
+        return this.messageFormat.replace('%t', new Date().toISOString())
+            .replace('%l', level.toUpperCase())
+            .replace('%m', message)
+    }
+
+    static getLogger() {
+        if (!logger) {
+            logger = new Logger('debug')
+        }
+        return logger
+    }
+
+    /**
+     * @param level {string}
+     * @param message {string}
+     * @param color {string}
+     */
+    _log(level, message, color) {
+        if (this.canSend(level)) {
+            if (!this.isBrowser) {
+                console.log(color + this.format(message, level) + this.colors.end)
+            } else {
+                console.log(this.colors.start + this.format(message, level), color)
+            }
+        } else {
+
+        }
+    }
+}
+
+module.exports = Logger

+ 14 - 0
src/lib/gramjs/extensions/index.js

@@ -0,0 +1,14 @@
+const Logger = require('./Logger')
+const BinaryWriter = require('./BinaryWriter')
+const BinaryReader = require('./BinaryReader')
+const PromisedWebSockets = require('./PromisedWebSockets')
+const MessagePacker = require('./MessagePacker')
+const AsyncQueue = require('./AsyncQueue')
+module.exports = {
+    BinaryWriter,
+    BinaryReader,
+    MessagePacker,
+    AsyncQueue,
+    Logger,
+    PromisedWebSockets,
+}

+ 198 - 0
src/lib/gramjs/network/Authenticator.js

@@ -0,0 +1,198 @@
+const AES = require('../crypto/AES')
+const AuthKey = require('../crypto/AuthKey')
+const Factorizator = require('../crypto/FactorizatorLeemon')
+const RSA = require('../crypto/RSA')
+const modExp = require('../crypto/modPowLeemon');
+const Helpers = require('../Helpers')
+const { ServerDHParamsFail } = require('../tl/types')
+const { ServerDHParamsOk } = require('../tl/types')
+const { ReqDHParamsRequest } = require('../tl/functions')
+const { SecurityError } = require('../errors/Common')
+const { PQInnerData } = require('../tl/types')
+const BinaryReader = require('../extensions/BinaryReader')
+const { ClientDHInnerData } = require('../tl/types')
+const { DhGenFail } = require('../tl/types')
+const { DhGenRetry } = require('../tl/types')
+const { DhGenOk } = require('../tl/types')
+const { SetClientDHParamsRequest } = require('../tl/functions')
+const { ServerDHInnerData } = require('../tl/types')
+const { ResPQ } = require('../tl/types')
+const { ReqPqMultiRequest } = require('../tl/functions')
+const JSBI = require('jsbi')
+
+/**
+ * Executes the authentication process with the Telegram servers.
+ * @param sender a connected {MTProtoPlainSender}.
+ * @param log
+ * @returns {Promise<{authKey: *, timeOffset: *}>}
+ */
+async function doAuthentication(sender, log) {
+    // Step 1 sending: PQ Request, endianness doesn't matter since it's random
+    let bytes = Helpers.generateRandomBytes(16)
+
+    const nonce = Helpers.readBigIntFromBuffer(bytes, false, true)
+
+    const resPQ = await sender.send(new ReqPqMultiRequest({ nonce: nonce }))
+    log.debug('Starting authKey generation step 1')
+
+    if (!(resPQ instanceof ResPQ)) {
+        throw new Error(`Step 1 answer was ${resPQ}`)
+    }
+    if (JSBI.notEqual(resPQ.nonce, nonce)) {
+        throw new SecurityError('Step 1 invalid nonce from server')
+    }
+    const pq = Helpers.readBigIntFromBuffer(resPQ.pq, false, true)
+    log.debug('Finished authKey generation step 1')
+    log.debug('Starting authKey generation step 2')
+    // Step 2 sending: DH Exchange
+    let { p, q } = Factorizator.factorize(resPQ.pq)
+
+    p = Buffer.from(p)
+    q = Buffer.from(q)
+
+    bytes = Helpers.generateRandomBytes(32)
+    const newNonce = Helpers.readBigIntFromBuffer(bytes, true, true)
+
+    const pqInnerData = new PQInnerData({
+        pq: getByteArray(pq), // unsigned
+        p: p,
+        q: q,
+        nonce: resPQ.nonce,
+        serverNonce: resPQ.serverNonce,
+        newNonce: newNonce,
+    })
+
+    // sha_digest + data + random_bytes
+    let cipherText = null
+    let targetFingerprint = null
+    for (const fingerprint of resPQ.serverPublicKeyFingerprints) {
+        cipherText = RSA.encrypt(fingerprint.toString(), pqInnerData.getBytes())
+        if (cipherText !== null && cipherText !== undefined) {
+            targetFingerprint = fingerprint
+            break
+        }
+    }
+    if (cipherText === null || cipherText === undefined) {
+        throw new SecurityError('Step 2 could not find a valid key for fingerprints')
+    }
+
+    const serverDhParams = await sender.send(
+        new ReqDHParamsRequest({
+            nonce: resPQ.nonce,
+            serverNonce: resPQ.serverNonce,
+            p: p,
+            q: q,
+            publicKeyFingerprint: targetFingerprint,
+            encryptedData: cipherText,
+        }),
+    )
+    if (!(serverDhParams instanceof ServerDHParamsOk || serverDhParams instanceof ServerDHParamsFail)) {
+        throw new Error(`Step 2.1 answer was ${serverDhParams}`)
+    }
+    if (JSBI.notEqual(serverDhParams.nonce, resPQ.nonce)) {
+        throw new SecurityError('Step 2 invalid nonce from server')
+    }
+
+    if (JSBI.notEqual(serverDhParams.serverNonce, resPQ.serverNonce)) {
+        throw new SecurityError('Step 2 invalid server nonce from server')
+    }
+
+    if (serverDhParams instanceof ServerDHParamsFail) {
+        const sh = Helpers.sha1(Helpers.readBufferFromBigInt(newNonce, 32, true, true).slice(4, 20))
+        const nnh = Helpers.readBigIntFromBuffer(sh, true, true)
+        if (JSBI.notEqual(serverDhParams.newNonceHash, nnh)) {
+            throw new SecurityError('Step 2 invalid DH fail nonce from server')
+        }
+    }
+    if (!(serverDhParams instanceof ServerDHParamsOk)) {
+        throw new Error(`Step 2.2 answer was ${serverDhParams}`)
+    }
+    log.debug('Finished authKey generation step 2')
+    log.debug('Starting authKey generation step 3')
+
+    // Step 3 sending: Complete DH Exchange
+    const { key, iv } = Helpers.generateKeyDataFromNonce(resPQ.serverNonce, newNonce)
+    if (serverDhParams.encryptedAnswer.length % 16 !== 0) {
+        // See PR#453
+        throw new SecurityError('Step 3 AES block size mismatch')
+    }
+    const plainTextAnswer = AES.decryptIge(serverDhParams.encryptedAnswer, key, iv)
+    const reader = new BinaryReader(plainTextAnswer)
+    reader.read(20) // hash sum
+    const serverDhInner = reader.tgReadObject()
+    if (!(serverDhInner instanceof ServerDHInnerData)) {
+        throw new Error(`Step 3 answer was ${serverDhInner}`)
+    }
+
+    if (JSBI.notEqual(serverDhInner.nonce, resPQ.nonce)) {
+        throw new SecurityError('Step 3 Invalid nonce in encrypted answer')
+    }
+    if (JSBI.notEqual(serverDhInner.serverNonce, resPQ.serverNonce)) {
+        throw new SecurityError('Step 3 Invalid server nonce in encrypted answer')
+    }
+    const timeOffset = serverDhInner.serverTime - Math.floor(new Date().getTime() / 1000)
+
+    const bBytes = Helpers.generateRandomBytes(256);
+    const gb = modExp(getByteArray(serverDhInner.g), bBytes, serverDhInner.dhPrime)
+    const gab = modExp(serverDhInner.gA, bBytes, serverDhInner.dhPrime)
+
+    // Prepare client DH Inner Data
+    const clientDhInner  = new ClientDHInnerData({
+        nonce: resPQ.nonce,
+        serverNonce: resPQ.serverNonce,
+        retryId: 0, // TODO Actual retry ID
+        gB: Buffer.from(gb),
+    }).getBytes()
+
+    const clientDdhInnerHashed = Buffer.concat([Helpers.sha1(clientDhInner), clientDhInner])
+    // Encryption
+    const clientDhEncrypted = AES.encryptIge(clientDdhInnerHashed, key, iv)
+    const dhGen = await sender.send(
+        new SetClientDHParamsRequest({
+            nonce: resPQ.nonce,
+            serverNonce: resPQ.serverNonce,
+            encryptedData: clientDhEncrypted,
+        }),
+    )
+    const nonceTypes = [DhGenOk, DhGenRetry, DhGenFail]
+    if (!(dhGen instanceof nonceTypes[0] || dhGen instanceof nonceTypes[1] || dhGen instanceof nonceTypes[2])) {
+        throw new Error(`Step 3.1 answer was ${dhGen}`)
+    }
+    const { name } = dhGen.constructor
+    if (JSBI.notEqual(dhGen.nonce, resPQ.nonce)) {
+        throw new SecurityError(`Step 3 invalid ${name} nonce from server`)
+    }
+    if (JSBI.notEqual(dhGen.serverNonce, resPQ.serverNonce)) {
+        throw new SecurityError(`Step 3 invalid ${name} server nonce from server`)
+    }
+    const authKey = new AuthKey(Buffer.from(gab))
+    const nonceNumber = 1 + nonceTypes.indexOf(dhGen.constructor)
+
+    const newNonceHash = authKey.calcNewNonceHash(newNonce, nonceNumber)
+    const dhHash = dhGen[`newNonceHash${nonceNumber}`]
+
+    if (JSBI.notEqual(dhHash, newNonceHash)) {
+        throw new SecurityError('Step 3 invalid new nonce hash')
+    }
+
+    if (!(dhGen instanceof DhGenOk)) {
+        throw new Error(`Step 3.2 answer was ${dhGen}`)
+    }
+    log.debug('Finished authKey generation step 3')
+
+    return { authKey, timeOffset }
+}
+
+/**
+ * Gets the arbitrary-length byte array corresponding to the given integer
+ * @param integer {number,JSBI.BigInt}
+ * @param signed {boolean}
+ * @returns {Buffer}
+ */
+function getByteArray(integer, signed = false) {
+    const bits = integer.toString(2).length
+    const byteLength = Math.floor((bits + 8 - 1) / 8)
+    return Helpers.readBufferFromBigInt(JSBI.BigInt(integer), byteLength, false, signed)
+}
+
+module.exports = doAuthentication

+ 1 - 1
src/lib/gramjs/network/MTProtoPlainSender.js

@@ -30,7 +30,7 @@ class MTProtoPlainSender {
      */
     async send(request) {
 
-        let body = request.bytes
+        let body = request.getBytes()
         let msgId = this._state._getNewMsgId()
         const res = Buffer.concat([struct.pack('<qqi', [0, msgId.toString(), body.length]), body])
 

+ 16 - 0
src/lib/gramjs/network/RequestState.js

@@ -0,0 +1,16 @@
+class RequestState {
+    constructor(request, after = null) {
+        this.containerId = null
+        this.msgId = null
+        this.request = request
+        this.data = request.getBytes()
+        this.after = after
+        this.result = null
+        this.promise = new Promise((resolve, reject) => {
+            this.resolve = resolve
+            this.reject = reject
+        })
+    }
+}
+
+module.exports = RequestState

+ 2333 - 0
src/lib/gramjs/tl/functions/account.js

@@ -0,0 +1,2333 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class RegisterDeviceRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x68976c6f;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x68976c6f;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.noMuted = args.noMuted || null;
+        this.tokenType = args.tokenType;
+        this.token = args.token;
+        this.appSandbox = args.appSandbox;
+        this.secret = args.secret;
+        this.otherUids = args.otherUids;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6f6c9768","hex"),
+            struct.pack('<I', (this.noMuted === undefined || this.noMuted === false || this.noMuted === null) ? 0 : 1),
+            struct.pack('<i', this.tokenType),
+            TLObject.serializeBytes(this.token),
+            this.appSandbox ? 0xb5757299 : 0x379779bc,
+            TLObject.serializeBytes(this.secret),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUids.length),Buffer.concat(this.otherUids.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _no_muted;
+        let _token_type;
+        let _token;
+        let _app_sandbox;
+        let _secret;
+        let _other_uids;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _no_muted = Boolean(flags & 1);
+        _token_type = reader.readInt();
+        _token = reader.tgReadString();
+        _app_sandbox = reader.tgReadBool();
+        _secret = reader.tgReadBytes();
+        reader.readInt();
+        _other_uids = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _other_uids.push(_x);
+            }
+            return new this({noMuted:_no_muted,
+	tokenType:_token_type,
+	token:_token,
+	appSandbox:_app_sandbox,
+	secret:_secret,
+	otherUids:_other_uids})
+        }
+    }
+
+
+class UnregisterDeviceRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3076c4bf;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3076c4bf;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.tokenType = args.tokenType;
+        this.token = args.token;
+        this.otherUids = args.otherUids;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bfc47630","hex"),
+            struct.pack('<i', this.tokenType),
+            TLObject.serializeBytes(this.token),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUids.length),Buffer.concat(this.otherUids.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _token_type;
+        let _token;
+        let _other_uids;
+        let _x;
+        let len;
+        _token_type = reader.readInt();
+        _token = reader.tgReadString();
+        reader.readInt();
+        _other_uids = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _other_uids.push(_x);
+            }
+            return new this({tokenType:_token_type,
+	token:_token,
+	otherUids:_other_uids})
+        }
+    }
+
+
+class UpdateNotifySettingsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x84be5b93;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x84be5b93;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+        this.settings = args.settings;
+    }
+    async resolve(client, utils) {
+        this.peer = await client._getInputNotify(this.peer)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("935bbe84","hex"),
+            this.peer.getBytes(),
+            this.settings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _settings;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _settings = reader.tgReadObject();
+        return new this({peer:_peer,
+	settings:_settings})
+    }
+}
+
+
+class GetNotifySettingsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x12b3ad31;
+    static SUBCLASS_OF_ID = 0xcf20c074;
+
+    /**
+    :returns PeerNotifySettings: Instance of PeerNotifySettings
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x12b3ad31;
+        this.SUBCLASS_OF_ID = 0xcf20c074;
+
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = await client._getInputNotify(this.peer)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("31adb312","hex"),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        return new this({peer:_peer})
+    }
+}
+
+
+class ResetNotifySettingsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xdb7e1747;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xdb7e1747;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("47177edb","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class UpdateProfileRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x78515775;
+    static SUBCLASS_OF_ID = 0x2da17977;
+
+    /**
+    :returns User: Instance of either UserEmpty, User
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x78515775;
+        this.SUBCLASS_OF_ID = 0x2da17977;
+
+        this.firstName = args.firstName || null;
+        this.lastName = args.lastName || null;
+        this.about = args.about || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("75575178","hex"),
+            struct.pack('<I', (this.firstName === undefined || this.firstName === false || this.firstName === null) ? 0 : 1 | (this.lastName === undefined || this.lastName === false || this.lastName === null) ? 0 : 2 | (this.about === undefined || this.about === false || this.about === null) ? 0 : 4),
+            (this.firstName === undefined || this.firstName === false || this.firstName ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.firstName)],
+            (this.lastName === undefined || this.lastName === false || this.lastName ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.lastName)],
+            (this.about === undefined || this.about === false || this.about ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.about)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _first_name;
+        let _last_name;
+        let _about;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        if (flags & 1) {
+            _first_name = reader.tgReadString();
+        }
+        else {
+            _first_name = null
+        }
+        if (flags & 2) {
+            _last_name = reader.tgReadString();
+        }
+        else {
+            _last_name = null
+        }
+        if (flags & 4) {
+            _about = reader.tgReadString();
+        }
+        else {
+            _about = null
+        }
+        return new this({firstName:_first_name,
+	lastName:_last_name,
+	about:_about})
+    }
+}
+
+
+class UpdateStatusRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x6628562c;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x6628562c;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.offline = args.offline;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2c562866","hex"),
+            this.offline ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _offline;
+        let _x;
+        let len;
+        _offline = reader.tgReadBool();
+        return new this({offline:_offline})
+    }
+}
+
+
+class GetWallPapersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xaabb1763;
+    static SUBCLASS_OF_ID = 0xa2c548fd;
+
+    /**
+    :returns account.WallPapers: Instance of either WallPapersNotModified, WallPapers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xaabb1763;
+        this.SUBCLASS_OF_ID = 0xa2c548fd;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6317bbaa","hex"),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        return new this({hash:_hash})
+    }
+}
+
+
+class ReportPeerRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xae189d5f;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xae189d5f;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+        this.reason = args.reason;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5f9d18ae","hex"),
+            this.peer.getBytes(),
+            this.reason.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _reason;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _reason = reader.tgReadObject();
+        return new this({peer:_peer,
+	reason:_reason})
+    }
+}
+
+
+class CheckUsernameRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2714d86c;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2714d86c;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.username = args.username;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6cd81427","hex"),
+            TLObject.serializeBytes(this.username),
+            ])
+        }
+    static fromReader(reader) {
+        let _username;
+        let _x;
+        let len;
+        _username = reader.tgReadString();
+        return new this({username:_username})
+    }
+}
+
+
+class UpdateUsernameRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3e0bdd7c;
+    static SUBCLASS_OF_ID = 0x2da17977;
+
+    /**
+    :returns User: Instance of either UserEmpty, User
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3e0bdd7c;
+        this.SUBCLASS_OF_ID = 0x2da17977;
+
+        this.username = args.username;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("7cdd0b3e","hex"),
+            TLObject.serializeBytes(this.username),
+            ])
+        }
+    static fromReader(reader) {
+        let _username;
+        let _x;
+        let len;
+        _username = reader.tgReadString();
+        return new this({username:_username})
+    }
+}
+
+
+class GetPrivacyRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xdadbc950;
+    static SUBCLASS_OF_ID = 0xb55aba82;
+
+    /**
+    :returns account.PrivacyRules: Instance of PrivacyRules
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xdadbc950;
+        this.SUBCLASS_OF_ID = 0xb55aba82;
+
+        this.key = args.key;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("50c9dbda","hex"),
+            this.key.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _key;
+        let _x;
+        let len;
+        _key = reader.tgReadObject();
+        return new this({key:_key})
+    }
+}
+
+
+class SetPrivacyRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc9f81ce8;
+    static SUBCLASS_OF_ID = 0xb55aba82;
+
+    /**
+    :returns account.PrivacyRules: Instance of PrivacyRules
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc9f81ce8;
+        this.SUBCLASS_OF_ID = 0xb55aba82;
+
+        this.key = args.key;
+        this.rules = args.rules;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e81cf8c9","hex"),
+            this.key.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.rules.length),Buffer.concat(this.rules.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _key;
+        let _rules;
+        let _x;
+        let len;
+        _key = reader.tgReadObject();
+        reader.readInt();
+        _rules = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _rules.push(_x);
+            }
+            return new this({key:_key,
+	rules:_rules})
+        }
+    }
+
+
+class DeleteAccountRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x418d4e0b;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x418d4e0b;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.reason = args.reason;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0b4e8d41","hex"),
+            TLObject.serializeBytes(this.reason),
+            ])
+        }
+    static fromReader(reader) {
+        let _reason;
+        let _x;
+        let len;
+        _reason = reader.tgReadString();
+        return new this({reason:_reason})
+    }
+}
+
+
+class GetAccountTTLRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x08fc711d;
+    static SUBCLASS_OF_ID = 0xbaa39d88;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x08fc711d;
+        this.SUBCLASS_OF_ID = 0xbaa39d88;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1d71fc08","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class SetAccountTTLRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2442485e;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2442485e;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.ttl = args.ttl;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5e484224","hex"),
+            this.ttl.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _ttl;
+        let _x;
+        let len;
+        _ttl = reader.tgReadObject();
+        return new this({ttl:_ttl})
+    }
+}
+
+
+class SendChangePhoneCodeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x82574ae5;
+    static SUBCLASS_OF_ID = 0x6ce87081;
+
+    /**
+    :returns auth.SentCode: Instance of SentCode
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x82574ae5;
+        this.SUBCLASS_OF_ID = 0x6ce87081;
+
+        this.phoneNumber = args.phoneNumber;
+        this.settings = args.settings;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e54a5782","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            this.settings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _settings;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _settings = reader.tgReadObject();
+        return new this({phoneNumber:_phone_number,
+	settings:_settings})
+    }
+}
+
+
+class ChangePhoneRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x70c32edb;
+    static SUBCLASS_OF_ID = 0x2da17977;
+
+    /**
+    :returns User: Instance of either UserEmpty, User
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x70c32edb;
+        this.SUBCLASS_OF_ID = 0x2da17977;
+
+        this.phoneNumber = args.phoneNumber;
+        this.phoneCodeHash = args.phoneCodeHash;
+        this.phoneCode = args.phoneCode;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("db2ec370","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            TLObject.serializeBytes(this.phoneCodeHash),
+            TLObject.serializeBytes(this.phoneCode),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _phone_code_hash;
+        let _phone_code;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _phone_code_hash = reader.tgReadString();
+        _phone_code = reader.tgReadString();
+        return new this({phoneNumber:_phone_number,
+	phoneCodeHash:_phone_code_hash,
+	phoneCode:_phone_code})
+    }
+}
+
+
+class UpdateDeviceLockedRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x38df3532;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x38df3532;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.period = args.period;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3235df38","hex"),
+            struct.pack('<i', this.period),
+            ])
+        }
+    static fromReader(reader) {
+        let _period;
+        let _x;
+        let len;
+        _period = reader.readInt();
+        return new this({period:_period})
+    }
+}
+
+
+class GetAuthorizationsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe320c158;
+    static SUBCLASS_OF_ID = 0xbf5e0ff;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xe320c158;
+        this.SUBCLASS_OF_ID = 0xbf5e0ff;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("58c120e3","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class ResetAuthorizationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xdf77f3bc;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xdf77f3bc;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bcf377df","hex"),
+            readBufferFromBigInt(this.hash,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readLong();
+        return new this({hash:_hash})
+    }
+}
+
+
+class GetPasswordRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x548a30f5;
+    static SUBCLASS_OF_ID = 0x53a211a3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x548a30f5;
+        this.SUBCLASS_OF_ID = 0x53a211a3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f5308a54","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetPasswordSettingsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x9cd4eaf9;
+    static SUBCLASS_OF_ID = 0xd23fb078;
+
+    /**
+    :returns account.PasswordSettings: Instance of PasswordSettings
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x9cd4eaf9;
+        this.SUBCLASS_OF_ID = 0xd23fb078;
+
+        this.password = args.password;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f9ead49c","hex"),
+            this.password.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _password;
+        let _x;
+        let len;
+        _password = reader.tgReadObject();
+        return new this({password:_password})
+    }
+}
+
+
+class UpdatePasswordSettingsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa59b102f;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa59b102f;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.password = args.password;
+        this.newSettings = args.newSettings;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2f109ba5","hex"),
+            this.password.getBytes(),
+            this.newSettings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _password;
+        let _new_settings;
+        let _x;
+        let len;
+        _password = reader.tgReadObject();
+        _new_settings = reader.tgReadObject();
+        return new this({password:_password,
+	newSettings:_new_settings})
+    }
+}
+
+
+class SendConfirmPhoneCodeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1b3faa88;
+    static SUBCLASS_OF_ID = 0x6ce87081;
+
+    /**
+    :returns auth.SentCode: Instance of SentCode
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1b3faa88;
+        this.SUBCLASS_OF_ID = 0x6ce87081;
+
+        this.hash = args.hash;
+        this.settings = args.settings;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("88aa3f1b","hex"),
+            TLObject.serializeBytes(this.hash),
+            this.settings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _settings;
+        let _x;
+        let len;
+        _hash = reader.tgReadString();
+        _settings = reader.tgReadObject();
+        return new this({hash:_hash,
+	settings:_settings})
+    }
+}
+
+
+class ConfirmPhoneRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x5f2178c3;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x5f2178c3;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.phoneCodeHash = args.phoneCodeHash;
+        this.phoneCode = args.phoneCode;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c378215f","hex"),
+            TLObject.serializeBytes(this.phoneCodeHash),
+            TLObject.serializeBytes(this.phoneCode),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_code_hash;
+        let _phone_code;
+        let _x;
+        let len;
+        _phone_code_hash = reader.tgReadString();
+        _phone_code = reader.tgReadString();
+        return new this({phoneCodeHash:_phone_code_hash,
+	phoneCode:_phone_code})
+    }
+}
+
+
+class GetTmpPasswordRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x449e0b51;
+    static SUBCLASS_OF_ID = 0xb064992d;
+
+    /**
+    :returns account.TmpPassword: Instance of TmpPassword
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x449e0b51;
+        this.SUBCLASS_OF_ID = 0xb064992d;
+
+        this.password = args.password;
+        this.period = args.period;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("510b9e44","hex"),
+            this.password.getBytes(),
+            struct.pack('<i', this.period),
+            ])
+        }
+    static fromReader(reader) {
+        let _password;
+        let _period;
+        let _x;
+        let len;
+        _password = reader.tgReadObject();
+        _period = reader.readInt();
+        return new this({password:_password,
+	period:_period})
+    }
+}
+
+
+class GetWebAuthorizationsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x182e6d6f;
+    static SUBCLASS_OF_ID = 0x9a365b32;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x182e6d6f;
+        this.SUBCLASS_OF_ID = 0x9a365b32;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6f6d2e18","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class ResetWebAuthorizationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2d01b9ef;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2d01b9ef;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("efb9012d","hex"),
+            readBufferFromBigInt(this.hash,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readLong();
+        return new this({hash:_hash})
+    }
+}
+
+
+class ResetWebAuthorizationsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x682d2594;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x682d2594;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("94252d68","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetAllSecureValuesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xb288bc7d;
+    static SUBCLASS_OF_ID = 0xe82e4121;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xb288bc7d;
+        this.SUBCLASS_OF_ID = 0xe82e4121;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("7dbc88b2","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetSecureValueRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x73665bc2;
+    static SUBCLASS_OF_ID = 0xe82e4121;
+
+    /**
+    :returns Vector<SecureValue>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x73665bc2;
+        this.SUBCLASS_OF_ID = 0xe82e4121;
+
+        this.types = args.types;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c25b6673","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.types.length),Buffer.concat(this.types.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _types;
+        let _x;
+        let len;
+        reader.readInt();
+        _types = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _types.push(_x);
+            }
+            return new this({types:_types})
+        }
+    }
+
+
+class SaveSecureValueRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x899fe31d;
+    static SUBCLASS_OF_ID = 0x51138ae;
+
+    /**
+    :returns SecureValue: Instance of SecureValue
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x899fe31d;
+        this.SUBCLASS_OF_ID = 0x51138ae;
+
+        this.value = args.value;
+        this.secureSecretId = args.secureSecretId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1de39f89","hex"),
+            this.value.getBytes(),
+            readBufferFromBigInt(this.secureSecretId,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _value;
+        let _secure_secret_id;
+        let _x;
+        let len;
+        _value = reader.tgReadObject();
+        _secure_secret_id = reader.readLong();
+        return new this({value:_value,
+	secureSecretId:_secure_secret_id})
+    }
+}
+
+
+class DeleteSecureValueRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xb880bc4b;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb880bc4b;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.types = args.types;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4bbc80b8","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.types.length),Buffer.concat(this.types.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _types;
+        let _x;
+        let len;
+        reader.readInt();
+        _types = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _types.push(_x);
+            }
+            return new this({types:_types})
+        }
+    }
+
+
+class GetAuthorizationFormRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xb86ba8e1;
+    static SUBCLASS_OF_ID = 0x78049a94;
+
+    /**
+    :returns account.AuthorizationForm: Instance of AuthorizationForm
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb86ba8e1;
+        this.SUBCLASS_OF_ID = 0x78049a94;
+
+        this.botId = args.botId;
+        this.scope = args.scope;
+        this.publicKey = args.publicKey;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e1a86bb8","hex"),
+            struct.pack('<i', this.botId),
+            TLObject.serializeBytes(this.scope),
+            TLObject.serializeBytes(this.publicKey),
+            ])
+        }
+    static fromReader(reader) {
+        let _bot_id;
+        let _scope;
+        let _public_key;
+        let _x;
+        let len;
+        _bot_id = reader.readInt();
+        _scope = reader.tgReadString();
+        _public_key = reader.tgReadString();
+        return new this({botId:_bot_id,
+	scope:_scope,
+	publicKey:_public_key})
+    }
+}
+
+
+class AcceptAuthorizationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe7027c94;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe7027c94;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.botId = args.botId;
+        this.scope = args.scope;
+        this.publicKey = args.publicKey;
+        this.valueHashes = args.valueHashes;
+        this.credentials = args.credentials;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("947c02e7","hex"),
+            struct.pack('<i', this.botId),
+            TLObject.serializeBytes(this.scope),
+            TLObject.serializeBytes(this.publicKey),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.valueHashes.length),Buffer.concat(this.valueHashes.map(x => x.getBytes())),
+            this.credentials.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _bot_id;
+        let _scope;
+        let _public_key;
+        let _value_hashes;
+        let _credentials;
+        let _x;
+        let len;
+        _bot_id = reader.readInt();
+        _scope = reader.tgReadString();
+        _public_key = reader.tgReadString();
+        reader.readInt();
+        _value_hashes = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _value_hashes.push(_x);
+            }
+            _credentials = reader.tgReadObject();
+            return new this({botId:_bot_id,
+	scope:_scope,
+	publicKey:_public_key,
+	valueHashes:_value_hashes,
+	credentials:_credentials})
+        }
+    }
+
+
+class SendVerifyPhoneCodeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa5a356f9;
+    static SUBCLASS_OF_ID = 0x6ce87081;
+
+    /**
+    :returns auth.SentCode: Instance of SentCode
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa5a356f9;
+        this.SUBCLASS_OF_ID = 0x6ce87081;
+
+        this.phoneNumber = args.phoneNumber;
+        this.settings = args.settings;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f956a3a5","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            this.settings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _settings;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _settings = reader.tgReadObject();
+        return new this({phoneNumber:_phone_number,
+	settings:_settings})
+    }
+}
+
+
+class VerifyPhoneRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x4dd3a7f6;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4dd3a7f6;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.phoneNumber = args.phoneNumber;
+        this.phoneCodeHash = args.phoneCodeHash;
+        this.phoneCode = args.phoneCode;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f6a7d34d","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            TLObject.serializeBytes(this.phoneCodeHash),
+            TLObject.serializeBytes(this.phoneCode),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _phone_code_hash;
+        let _phone_code;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _phone_code_hash = reader.tgReadString();
+        _phone_code = reader.tgReadString();
+        return new this({phoneNumber:_phone_number,
+	phoneCodeHash:_phone_code_hash,
+	phoneCode:_phone_code})
+    }
+}
+
+
+class SendVerifyEmailCodeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x7011509f;
+    static SUBCLASS_OF_ID = 0x69f3c06e;
+
+    /**
+    :returns account.SentEmailCode: Instance of SentEmailCode
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x7011509f;
+        this.SUBCLASS_OF_ID = 0x69f3c06e;
+
+        this.email = args.email;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9f501170","hex"),
+            TLObject.serializeBytes(this.email),
+            ])
+        }
+    static fromReader(reader) {
+        let _email;
+        let _x;
+        let len;
+        _email = reader.tgReadString();
+        return new this({email:_email})
+    }
+}
+
+
+class VerifyEmailRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xecba39db;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xecba39db;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.email = args.email;
+        this.code = args.code;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("db39baec","hex"),
+            TLObject.serializeBytes(this.email),
+            TLObject.serializeBytes(this.code),
+            ])
+        }
+    static fromReader(reader) {
+        let _email;
+        let _code;
+        let _x;
+        let len;
+        _email = reader.tgReadString();
+        _code = reader.tgReadString();
+        return new this({email:_email,
+	code:_code})
+    }
+}
+
+
+class InitTakeoutSessionRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf05b4804;
+    static SUBCLASS_OF_ID = 0x843ebe85;
+
+    /**
+    :returns account.Takeout: Instance of Takeout
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf05b4804;
+        this.SUBCLASS_OF_ID = 0x843ebe85;
+
+        this.contacts = args.contacts || null;
+        this.messageUsers = args.messageUsers || null;
+        this.messageChats = args.messageChats || null;
+        this.messageMegagroups = args.messageMegagroups || null;
+        this.messageChannels = args.messageChannels || null;
+        this.files = args.files || null;
+        this.fileMaxSize = args.fileMaxSize || null;
+    }
+    getBytes() {
+        if (!((this.files || this.files!==null && this.file_max_size || this.file_max_size!==null) && (this.files===null || this.files===false && this.file_max_size===null || this.file_max_size===false)))
+	 throw new Error('files, file_max_size paramaters must all be false-y or all true')
+        return Buffer.concat([
+            Buffer.from("04485bf0","hex"),
+            struct.pack('<I', (this.contacts === undefined || this.contacts === false || this.contacts === null) ? 0 : 1 | (this.messageUsers === undefined || this.messageUsers === false || this.messageUsers === null) ? 0 : 2 | (this.messageChats === undefined || this.messageChats === false || this.messageChats === null) ? 0 : 4 | (this.messageMegagroups === undefined || this.messageMegagroups === false || this.messageMegagroups === null) ? 0 : 8 | (this.messageChannels === undefined || this.messageChannels === false || this.messageChannels === null) ? 0 : 16 | (this.files === undefined || this.files === false || this.files === null) ? 0 : 32 | (this.fileMaxSize === undefined || this.fileMaxSize === false || this.fileMaxSize === null) ? 0 : 32),
+            (this.fileMaxSize === undefined || this.fileMaxSize === false || this.fileMaxSize ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.fileMaxSize)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _contacts;
+        let _message_users;
+        let _message_chats;
+        let _message_megagroups;
+        let _message_channels;
+        let _files;
+        let _file_max_size;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _contacts = Boolean(flags & 1);
+        _message_users = Boolean(flags & 2);
+        _message_chats = Boolean(flags & 4);
+        _message_megagroups = Boolean(flags & 8);
+        _message_channels = Boolean(flags & 16);
+        _files = Boolean(flags & 32);
+        if (flags & 32) {
+            _file_max_size = reader.readInt();
+        }
+        else {
+            _file_max_size = null
+        }
+        return new this({contacts:_contacts,
+	messageUsers:_message_users,
+	messageChats:_message_chats,
+	messageMegagroups:_message_megagroups,
+	messageChannels:_message_channels,
+	files:_files,
+	fileMaxSize:_file_max_size})
+    }
+}
+
+
+class FinishTakeoutSessionRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1d2652ee;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1d2652ee;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.success = args.success || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ee52261d","hex"),
+            struct.pack('<I', (this.success === undefined || this.success === false || this.success === null) ? 0 : 1),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _success;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _success = Boolean(flags & 1);
+        return new this({success:_success})
+    }
+}
+
+
+class ConfirmPasswordEmailRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8fdf1920;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8fdf1920;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.code = args.code;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2019df8f","hex"),
+            TLObject.serializeBytes(this.code),
+            ])
+        }
+    static fromReader(reader) {
+        let _code;
+        let _x;
+        let len;
+        _code = reader.tgReadString();
+        return new this({code:_code})
+    }
+}
+
+
+class ResendPasswordEmailRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x7a7f2a15;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x7a7f2a15;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("152a7f7a","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class CancelPasswordEmailRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc1cbd5b6;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xc1cbd5b6;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b6d5cbc1","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetContactSignUpNotificationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x9f07c728;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x9f07c728;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("28c7079f","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class SetContactSignUpNotificationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xcff43f61;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xcff43f61;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.silent = args.silent;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("613ff4cf","hex"),
+            this.silent ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _silent;
+        let _x;
+        let len;
+        _silent = reader.tgReadBool();
+        return new this({silent:_silent})
+    }
+}
+
+
+class GetNotifyExceptionsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x53577479;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x53577479;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.compareSound = args.compareSound || null;
+        this.peer = args.peer || null;
+    }
+    async resolve(client, utils) {
+        if (this.peer) {
+            this.peer = await client._getInputNotify(this.peer)
+        }
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("79745753","hex"),
+            struct.pack('<I', (this.compareSound === undefined || this.compareSound === false || this.compareSound === null) ? 0 : 2 | (this.peer === undefined || this.peer === false || this.peer === null) ? 0 : 1),
+            (this.peer === undefined || this.peer === false || this.peer ===null) ? Buffer.alloc(0) : [this.peer.getBytes()],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _compare_sound;
+        let _peer;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _compare_sound = Boolean(flags & 2);
+        if (flags & 1) {
+            _peer = reader.tgReadObject();
+        }
+        else {
+            _peer = null
+        }
+        return new this({compareSound:_compare_sound,
+	peer:_peer})
+    }
+}
+
+
+class GetWallPaperRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xfc8ddbea;
+    static SUBCLASS_OF_ID = 0x96a2c98b;
+
+    /**
+    :returns WallPaper: Instance of WallPaper
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xfc8ddbea;
+        this.SUBCLASS_OF_ID = 0x96a2c98b;
+
+        this.wallpaper = args.wallpaper;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("eadb8dfc","hex"),
+            this.wallpaper.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _wallpaper;
+        let _x;
+        let len;
+        _wallpaper = reader.tgReadObject();
+        return new this({wallpaper:_wallpaper})
+    }
+}
+
+
+class UploadWallPaperRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xdd853661;
+    static SUBCLASS_OF_ID = 0x96a2c98b;
+
+    /**
+    :returns WallPaper: Instance of WallPaper
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xdd853661;
+        this.SUBCLASS_OF_ID = 0x96a2c98b;
+
+        this.file = args.file;
+        this.mimeType = args.mimeType;
+        this.settings = args.settings;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("613685dd","hex"),
+            this.file.getBytes(),
+            TLObject.serializeBytes(this.mimeType),
+            this.settings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _file;
+        let _mime_type;
+        let _settings;
+        let _x;
+        let len;
+        _file = reader.tgReadObject();
+        _mime_type = reader.tgReadString();
+        _settings = reader.tgReadObject();
+        return new this({file:_file,
+	mimeType:_mime_type,
+	settings:_settings})
+    }
+}
+
+
+class SaveWallPaperRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x6c5a5b37;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x6c5a5b37;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.wallpaper = args.wallpaper;
+        this.unsave = args.unsave;
+        this.settings = args.settings;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("375b5a6c","hex"),
+            this.wallpaper.getBytes(),
+            this.unsave ? 0xb5757299 : 0x379779bc,
+            this.settings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _wallpaper;
+        let _unsave;
+        let _settings;
+        let _x;
+        let len;
+        _wallpaper = reader.tgReadObject();
+        _unsave = reader.tgReadBool();
+        _settings = reader.tgReadObject();
+        return new this({wallpaper:_wallpaper,
+	unsave:_unsave,
+	settings:_settings})
+    }
+}
+
+
+class InstallWallPaperRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xfeed5769;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xfeed5769;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.wallpaper = args.wallpaper;
+        this.settings = args.settings;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6957edfe","hex"),
+            this.wallpaper.getBytes(),
+            this.settings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _wallpaper;
+        let _settings;
+        let _x;
+        let len;
+        _wallpaper = reader.tgReadObject();
+        _settings = reader.tgReadObject();
+        return new this({wallpaper:_wallpaper,
+	settings:_settings})
+    }
+}
+
+
+class ResetWallPapersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbb3b9804;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xbb3b9804;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("04983bbb","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetAutoDownloadSettingsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x56da0b3f;
+    static SUBCLASS_OF_ID = 0x2fb85921;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x56da0b3f;
+        this.SUBCLASS_OF_ID = 0x2fb85921;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3f0bda56","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class SaveAutoDownloadSettingsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x76f36233;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x76f36233;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.low = args.low || null;
+        this.high = args.high || null;
+        this.settings = args.settings;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3362f376","hex"),
+            struct.pack('<I', (this.low === undefined || this.low === false || this.low === null) ? 0 : 1 | (this.high === undefined || this.high === false || this.high === null) ? 0 : 2),
+            this.settings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _low;
+        let _high;
+        let _settings;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _low = Boolean(flags & 1);
+        _high = Boolean(flags & 2);
+        _settings = reader.tgReadObject();
+        return new this({low:_low,
+	high:_high,
+	settings:_settings})
+    }
+}
+
+
+class UploadThemeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1c3db333;
+    static SUBCLASS_OF_ID = 0x211fe820;
+
+    /**
+    :returns Document: Instance of either DocumentEmpty, Document
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1c3db333;
+        this.SUBCLASS_OF_ID = 0x211fe820;
+
+        this.file = args.file;
+        this.thumb = args.thumb || null;
+        this.fileName = args.fileName;
+        this.mimeType = args.mimeType;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("33b33d1c","hex"),
+            struct.pack('<I', (this.thumb === undefined || this.thumb === false || this.thumb === null) ? 0 : 1),
+            this.file.getBytes(),
+            (this.thumb === undefined || this.thumb === false || this.thumb ===null) ? Buffer.alloc(0) : [this.thumb.getBytes()],
+            TLObject.serializeBytes(this.fileName),
+            TLObject.serializeBytes(this.mimeType),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _file;
+        let _thumb;
+        let _file_name;
+        let _mime_type;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _file = reader.tgReadObject();
+        if (flags & 1) {
+            _thumb = reader.tgReadObject();
+        }
+        else {
+            _thumb = null
+        }
+        _file_name = reader.tgReadString();
+        _mime_type = reader.tgReadString();
+        return new this({file:_file,
+	thumb:_thumb,
+	fileName:_file_name,
+	mimeType:_mime_type})
+    }
+}
+
+
+class CreateThemeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2b7ffd7f;
+    static SUBCLASS_OF_ID = 0x56b4c80c;
+
+    /**
+    :returns Theme: Instance of either ThemeDocumentNotModified, Theme
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2b7ffd7f;
+        this.SUBCLASS_OF_ID = 0x56b4c80c;
+
+        this.slug = args.slug;
+        this.title = args.title;
+        this.document = args.document;
+    }
+    async resolve(client, utils) {
+        this.document = utils.getInputDocument(this.document)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("7ffd7f2b","hex"),
+            TLObject.serializeBytes(this.slug),
+            TLObject.serializeBytes(this.title),
+            this.document.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _slug;
+        let _title;
+        let _document;
+        let _x;
+        let len;
+        _slug = reader.tgReadString();
+        _title = reader.tgReadString();
+        _document = reader.tgReadObject();
+        return new this({slug:_slug,
+	title:_title,
+	document:_document})
+    }
+}
+
+
+class UpdateThemeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3b8ea202;
+    static SUBCLASS_OF_ID = 0x56b4c80c;
+
+    /**
+    :returns Theme: Instance of either ThemeDocumentNotModified, Theme
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3b8ea202;
+        this.SUBCLASS_OF_ID = 0x56b4c80c;
+
+        this.format = args.format;
+        this.theme = args.theme;
+        this.slug = args.slug || null;
+        this.title = args.title || null;
+        this.document = args.document || null;
+    }
+    async resolve(client, utils) {
+        if (this.document) {
+            this.document = utils.getInputDocument(this.document)
+        }
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("02a28e3b","hex"),
+            struct.pack('<I', (this.slug === undefined || this.slug === false || this.slug === null) ? 0 : 1 | (this.title === undefined || this.title === false || this.title === null) ? 0 : 2 | (this.document === undefined || this.document === false || this.document === null) ? 0 : 4),
+            TLObject.serializeBytes(this.format),
+            this.theme.getBytes(),
+            (this.slug === undefined || this.slug === false || this.slug ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.slug)],
+            (this.title === undefined || this.title === false || this.title ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.title)],
+            (this.document === undefined || this.document === false || this.document ===null) ? Buffer.alloc(0) : [this.document.getBytes()],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _format;
+        let _theme;
+        let _slug;
+        let _title;
+        let _document;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _format = reader.tgReadString();
+        _theme = reader.tgReadObject();
+        if (flags & 1) {
+            _slug = reader.tgReadString();
+        }
+        else {
+            _slug = null
+        }
+        if (flags & 2) {
+            _title = reader.tgReadString();
+        }
+        else {
+            _title = null
+        }
+        if (flags & 4) {
+            _document = reader.tgReadObject();
+        }
+        else {
+            _document = null
+        }
+        return new this({format:_format,
+	theme:_theme,
+	slug:_slug,
+	title:_title,
+	document:_document})
+    }
+}
+
+
+class SaveThemeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf257106c;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf257106c;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.theme = args.theme;
+        this.unsave = args.unsave;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6c1057f2","hex"),
+            this.theme.getBytes(),
+            this.unsave ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _theme;
+        let _unsave;
+        let _x;
+        let len;
+        _theme = reader.tgReadObject();
+        _unsave = reader.tgReadBool();
+        return new this({theme:_theme,
+	unsave:_unsave})
+    }
+}
+
+
+class InstallThemeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x7ae43737;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x7ae43737;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.dark = args.dark || null;
+        this.format = args.format || null;
+        this.theme = args.theme || null;
+    }
+    getBytes() {
+        if (!((this.format || this.format!==null && this.theme || this.theme!==null) && (this.format===null || this.format===false && this.theme===null || this.theme===false)))
+	 throw new Error('format, theme paramaters must all be false-y or all true')
+        return Buffer.concat([
+            Buffer.from("3737e47a","hex"),
+            struct.pack('<I', (this.dark === undefined || this.dark === false || this.dark === null) ? 0 : 1 | (this.format === undefined || this.format === false || this.format === null) ? 0 : 2 | (this.theme === undefined || this.theme === false || this.theme === null) ? 0 : 2),
+            (this.format === undefined || this.format === false || this.format ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.format)],
+            (this.theme === undefined || this.theme === false || this.theme ===null) ? Buffer.alloc(0) : [this.theme.getBytes()],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _dark;
+        let _format;
+        let _theme;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _dark = Boolean(flags & 1);
+        if (flags & 2) {
+            _format = reader.tgReadString();
+        }
+        else {
+            _format = null
+        }
+        if (flags & 2) {
+            _theme = reader.tgReadObject();
+        }
+        else {
+            _theme = null
+        }
+        return new this({dark:_dark,
+	format:_format,
+	theme:_theme})
+    }
+}
+
+
+class GetThemeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8d9d742b;
+    static SUBCLASS_OF_ID = 0x56b4c80c;
+
+    /**
+    :returns Theme: Instance of either ThemeDocumentNotModified, Theme
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8d9d742b;
+        this.SUBCLASS_OF_ID = 0x56b4c80c;
+
+        this.format = args.format;
+        this.theme = args.theme;
+        this.documentId = args.documentId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2b749d8d","hex"),
+            TLObject.serializeBytes(this.format),
+            this.theme.getBytes(),
+            readBufferFromBigInt(this.documentId,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _format;
+        let _theme;
+        let _document_id;
+        let _x;
+        let len;
+        _format = reader.tgReadString();
+        _theme = reader.tgReadObject();
+        _document_id = reader.readLong();
+        return new this({format:_format,
+	theme:_theme,
+	documentId:_document_id})
+    }
+}
+
+
+class GetThemesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x285946f8;
+    static SUBCLASS_OF_ID = 0x7fc52204;
+
+    /**
+    :returns account.Themes: Instance of either ThemesNotModified, Themes
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x285946f8;
+        this.SUBCLASS_OF_ID = 0x7fc52204;
+
+        this.format = args.format;
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f8465928","hex"),
+            TLObject.serializeBytes(this.format),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _format;
+        let _hash;
+        let _x;
+        let len;
+        _format = reader.tgReadString();
+        _hash = reader.readInt();
+        return new this({format:_format,
+	hash:_hash})
+    }
+}
+
+module.exports = {
+    RegisterDeviceRequest,
+    UnregisterDeviceRequest,
+    UpdateNotifySettingsRequest,
+    GetNotifySettingsRequest,
+    ResetNotifySettingsRequest,
+    UpdateProfileRequest,
+    UpdateStatusRequest,
+    GetWallPapersRequest,
+    ReportPeerRequest,
+    CheckUsernameRequest,
+    UpdateUsernameRequest,
+    GetPrivacyRequest,
+    SetPrivacyRequest,
+    DeleteAccountRequest,
+    GetAccountTTLRequest,
+    SetAccountTTLRequest,
+    SendChangePhoneCodeRequest,
+    ChangePhoneRequest,
+    UpdateDeviceLockedRequest,
+    GetAuthorizationsRequest,
+    ResetAuthorizationRequest,
+    GetPasswordRequest,
+    GetPasswordSettingsRequest,
+    UpdatePasswordSettingsRequest,
+    SendConfirmPhoneCodeRequest,
+    ConfirmPhoneRequest,
+    GetTmpPasswordRequest,
+    GetWebAuthorizationsRequest,
+    ResetWebAuthorizationRequest,
+    ResetWebAuthorizationsRequest,
+    GetAllSecureValuesRequest,
+    GetSecureValueRequest,
+    SaveSecureValueRequest,
+    DeleteSecureValueRequest,
+    GetAuthorizationFormRequest,
+    AcceptAuthorizationRequest,
+    SendVerifyPhoneCodeRequest,
+    VerifyPhoneRequest,
+    SendVerifyEmailCodeRequest,
+    VerifyEmailRequest,
+    InitTakeoutSessionRequest,
+    FinishTakeoutSessionRequest,
+    ConfirmPasswordEmailRequest,
+    ResendPasswordEmailRequest,
+    CancelPasswordEmailRequest,
+    GetContactSignUpNotificationRequest,
+    SetContactSignUpNotificationRequest,
+    GetNotifyExceptionsRequest,
+    GetWallPaperRequest,
+    UploadWallPaperRequest,
+    SaveWallPaperRequest,
+    InstallWallPaperRequest,
+    ResetWallPapersRequest,
+    GetAutoDownloadSettingsRequest,
+    SaveAutoDownloadSettingsRequest,
+    UploadThemeRequest,
+    CreateThemeRequest,
+    UpdateThemeRequest,
+    SaveThemeRequest,
+    InstallThemeRequest,
+    GetThemeRequest,
+    GetThemesRequest,
+};

+ 556 - 0
src/lib/gramjs/tl/functions/auth.js

@@ -0,0 +1,556 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class SendCodeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa677244f;
+    static SUBCLASS_OF_ID = 0x6ce87081;
+
+    /**
+    :returns auth.SentCode: Instance of SentCode
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa677244f;
+        this.SUBCLASS_OF_ID = 0x6ce87081;
+
+        this.phoneNumber = args.phoneNumber;
+        this.apiId = args.apiId;
+        this.apiHash = args.apiHash;
+        this.settings = args.settings;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4f2477a6","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            struct.pack('<i', this.apiId),
+            TLObject.serializeBytes(this.apiHash),
+            this.settings.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _api_id;
+        let _api_hash;
+        let _settings;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _api_id = reader.readInt();
+        _api_hash = reader.tgReadString();
+        _settings = reader.tgReadObject();
+        return new this({phoneNumber:_phone_number,
+	apiId:_api_id,
+	apiHash:_api_hash,
+	settings:_settings})
+    }
+}
+
+
+class SignUpRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x80eee427;
+    static SUBCLASS_OF_ID = 0xb9e04e39;
+
+    /**
+    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x80eee427;
+        this.SUBCLASS_OF_ID = 0xb9e04e39;
+
+        this.phoneNumber = args.phoneNumber;
+        this.phoneCodeHash = args.phoneCodeHash;
+        this.firstName = args.firstName;
+        this.lastName = args.lastName;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("27e4ee80","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            TLObject.serializeBytes(this.phoneCodeHash),
+            TLObject.serializeBytes(this.firstName),
+            TLObject.serializeBytes(this.lastName),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _phone_code_hash;
+        let _first_name;
+        let _last_name;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _phone_code_hash = reader.tgReadString();
+        _first_name = reader.tgReadString();
+        _last_name = reader.tgReadString();
+        return new this({phoneNumber:_phone_number,
+	phoneCodeHash:_phone_code_hash,
+	firstName:_first_name,
+	lastName:_last_name})
+    }
+}
+
+
+class SignInRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbcd51581;
+    static SUBCLASS_OF_ID = 0xb9e04e39;
+
+    /**
+    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbcd51581;
+        this.SUBCLASS_OF_ID = 0xb9e04e39;
+
+        this.phoneNumber = args.phoneNumber;
+        this.phoneCodeHash = args.phoneCodeHash;
+        this.phoneCode = args.phoneCode;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8115d5bc","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            TLObject.serializeBytes(this.phoneCodeHash),
+            TLObject.serializeBytes(this.phoneCode),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _phone_code_hash;
+        let _phone_code;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _phone_code_hash = reader.tgReadString();
+        _phone_code = reader.tgReadString();
+        return new this({phoneNumber:_phone_number,
+	phoneCodeHash:_phone_code_hash,
+	phoneCode:_phone_code})
+    }
+}
+
+
+class LogOutRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x5717da40;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x5717da40;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("40da1757","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class ResetAuthorizationsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x9fab0d1a;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x9fab0d1a;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1a0dab9f","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class ExportAuthorizationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe5bfffcd;
+    static SUBCLASS_OF_ID = 0x5fd1ec51;
+
+    /**
+    :returns auth.ExportedAuthorization: Instance of ExportedAuthorization
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe5bfffcd;
+        this.SUBCLASS_OF_ID = 0x5fd1ec51;
+
+        this.dcId = args.dcId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("cdffbfe5","hex"),
+            struct.pack('<i', this.dcId),
+            ])
+        }
+    static fromReader(reader) {
+        let _dc_id;
+        let _x;
+        let len;
+        _dc_id = reader.readInt();
+        return new this({dcId:_dc_id})
+    }
+}
+
+
+class ImportAuthorizationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe3ef9613;
+    static SUBCLASS_OF_ID = 0xb9e04e39;
+
+    /**
+    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe3ef9613;
+        this.SUBCLASS_OF_ID = 0xb9e04e39;
+
+        this.id = args.id;
+        this.bytes = args.bytes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1396efe3","hex"),
+            struct.pack('<i', this.id),
+            TLObject.serializeBytes(this.bytes),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _bytes;
+        let _x;
+        let len;
+        _id = reader.readInt();
+        _bytes = reader.tgReadBytes();
+        return new this({id:_id,
+	bytes:_bytes})
+    }
+}
+
+
+class BindTempAuthKeyRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xcdd42a05;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xcdd42a05;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.permAuthKeyId = args.permAuthKeyId;
+        this.nonce = args.nonce;
+        this.expiresAt = args.expiresAt;
+        this.encryptedMessage = args.encryptedMessage;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("052ad4cd","hex"),
+            readBufferFromBigInt(this.permAuthKeyId,8,true,true),
+            readBufferFromBigInt(this.nonce,8,true,true),
+            struct.pack('<i', this.expiresAt),
+            TLObject.serializeBytes(this.encryptedMessage),
+            ])
+        }
+    static fromReader(reader) {
+        let _perm_auth_key_id;
+        let _nonce;
+        let _expires_at;
+        let _encrypted_message;
+        let _x;
+        let len;
+        _perm_auth_key_id = reader.readLong();
+        _nonce = reader.readLong();
+        _expires_at = reader.readInt();
+        _encrypted_message = reader.tgReadBytes();
+        return new this({permAuthKeyId:_perm_auth_key_id,
+	nonce:_nonce,
+	expiresAt:_expires_at,
+	encryptedMessage:_encrypted_message})
+    }
+}
+
+
+class ImportBotAuthorizationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x67a3ff2c;
+    static SUBCLASS_OF_ID = 0xb9e04e39;
+
+    /**
+    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x67a3ff2c;
+        this.SUBCLASS_OF_ID = 0xb9e04e39;
+
+        this.flags = args.flags;
+        this.apiId = args.apiId;
+        this.apiHash = args.apiHash;
+        this.botAuthToken = args.botAuthToken;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2cffa367","hex"),
+            struct.pack('<i', this.flags),
+            struct.pack('<i', this.apiId),
+            TLObject.serializeBytes(this.apiHash),
+            TLObject.serializeBytes(this.botAuthToken),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _api_id;
+        let _api_hash;
+        let _bot_auth_token;
+        let _x;
+        let len;
+        _flags = reader.readInt();
+        _api_id = reader.readInt();
+        _api_hash = reader.tgReadString();
+        _bot_auth_token = reader.tgReadString();
+        return new this({flags:_flags,
+	apiId:_api_id,
+	apiHash:_api_hash,
+	botAuthToken:_bot_auth_token})
+    }
+}
+
+
+class CheckPasswordRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd18b4d16;
+    static SUBCLASS_OF_ID = 0xb9e04e39;
+
+    /**
+    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd18b4d16;
+        this.SUBCLASS_OF_ID = 0xb9e04e39;
+
+        this.password = args.password;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("164d8bd1","hex"),
+            this.password.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _password;
+        let _x;
+        let len;
+        _password = reader.tgReadObject();
+        return new this({password:_password})
+    }
+}
+
+
+class RequestPasswordRecoveryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd897bc66;
+    static SUBCLASS_OF_ID = 0xfa72d43a;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xd897bc66;
+        this.SUBCLASS_OF_ID = 0xfa72d43a;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("66bc97d8","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class RecoverPasswordRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x4ea56e92;
+    static SUBCLASS_OF_ID = 0xb9e04e39;
+
+    /**
+    :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4ea56e92;
+        this.SUBCLASS_OF_ID = 0xb9e04e39;
+
+        this.code = args.code;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("926ea54e","hex"),
+            TLObject.serializeBytes(this.code),
+            ])
+        }
+    static fromReader(reader) {
+        let _code;
+        let _x;
+        let len;
+        _code = reader.tgReadString();
+        return new this({code:_code})
+    }
+}
+
+
+class ResendCodeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3ef1a9bf;
+    static SUBCLASS_OF_ID = 0x6ce87081;
+
+    /**
+    :returns auth.SentCode: Instance of SentCode
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3ef1a9bf;
+        this.SUBCLASS_OF_ID = 0x6ce87081;
+
+        this.phoneNumber = args.phoneNumber;
+        this.phoneCodeHash = args.phoneCodeHash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bfa9f13e","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            TLObject.serializeBytes(this.phoneCodeHash),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _phone_code_hash;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _phone_code_hash = reader.tgReadString();
+        return new this({phoneNumber:_phone_number,
+	phoneCodeHash:_phone_code_hash})
+    }
+}
+
+
+class CancelCodeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1f040578;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1f040578;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.phoneNumber = args.phoneNumber;
+        this.phoneCodeHash = args.phoneCodeHash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("7805041f","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            TLObject.serializeBytes(this.phoneCodeHash),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _phone_code_hash;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _phone_code_hash = reader.tgReadString();
+        return new this({phoneNumber:_phone_number,
+	phoneCodeHash:_phone_code_hash})
+    }
+}
+
+
+class DropTempAuthKeysRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8e48a188;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8e48a188;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.exceptAuthKeys = args.exceptAuthKeys;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("88a1488e","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.exceptAuthKeys.length),Buffer.concat(this.exceptAuthKeys.map(x => readBufferFromBigInt(x,8,true,true))),
+            ])
+        }
+    static fromReader(reader) {
+        let _except_auth_keys;
+        let _x;
+        let len;
+        reader.readInt();
+        _except_auth_keys = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readLong();
+            _except_auth_keys.push(_x);
+            }
+            return new this({exceptAuthKeys:_except_auth_keys})
+        }
+    }
+
+module.exports = {
+    SendCodeRequest,
+    SignUpRequest,
+    SignInRequest,
+    LogOutRequest,
+    ResetAuthorizationsRequest,
+    ExportAuthorizationRequest,
+    ImportAuthorizationRequest,
+    BindTempAuthKeyRequest,
+    ImportBotAuthorizationRequest,
+    CheckPasswordRequest,
+    RequestPasswordRecoveryRequest,
+    RecoverPasswordRequest,
+    ResendCodeRequest,
+    CancelCodeRequest,
+    DropTempAuthKeysRequest,
+};

+ 83 - 0
src/lib/gramjs/tl/functions/bots.js

@@ -0,0 +1,83 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class SendCustomRequestRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xaa2769ed;
+    static SUBCLASS_OF_ID = 0xad0352e8;
+
+    /**
+    :returns DataJSON: Instance of DataJSON
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xaa2769ed;
+        this.SUBCLASS_OF_ID = 0xad0352e8;
+
+        this.customMethod = args.customMethod;
+        this.params = args.params;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ed6927aa","hex"),
+            TLObject.serializeBytes(this.customMethod),
+            this.params.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _custom_method;
+        let _params;
+        let _x;
+        let len;
+        _custom_method = reader.tgReadString();
+        _params = reader.tgReadObject();
+        return new this({customMethod:_custom_method,
+	params:_params})
+    }
+}
+
+
+class AnswerWebhookJSONQueryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe6213f4d;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe6213f4d;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.queryId = args.queryId;
+        this.data = args.data;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4d3f21e6","hex"),
+            readBufferFromBigInt(this.queryId,8,true,true),
+            this.data.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _query_id;
+        let _data;
+        let _x;
+        let len;
+        _query_id = reader.readLong();
+        _data = reader.tgReadObject();
+        return new this({queryId:_query_id,
+	data:_data})
+    }
+}
+
+module.exports = {
+    SendCustomRequestRequest,
+    AnswerWebhookJSONQueryRequest,
+};

+ 1506 - 0
src/lib/gramjs/tl/functions/channels.js

@@ -0,0 +1,1506 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class ReadHistoryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xcc104937;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xcc104937;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.channel = args.channel;
+        this.maxId = args.maxId;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("374910cc","hex"),
+            this.channel.getBytes(),
+            struct.pack('<i', this.maxId),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _max_id;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _max_id = reader.readInt();
+        return new this({channel:_channel,
+	maxId:_max_id})
+    }
+}
+
+
+class DeleteMessagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x84c1fd4e;
+    static SUBCLASS_OF_ID = 0xced3c06e;
+
+    /**
+    :returns messages.AffectedMessages: Instance of AffectedMessages
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x84c1fd4e;
+        this.SUBCLASS_OF_ID = 0xced3c06e;
+
+        this.channel = args.channel;
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4efdc184","hex"),
+            this.channel.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _id;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            return new this({channel:_channel,
+	id:_id})
+        }
+    }
+
+
+class DeleteUserHistoryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd10dd71b;
+    static SUBCLASS_OF_ID = 0x2c49c116;
+
+    /**
+    :returns messages.AffectedHistory: Instance of AffectedHistory
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd10dd71b;
+        this.SUBCLASS_OF_ID = 0x2c49c116;
+
+        this.channel = args.channel;
+        this.userId = args.userId;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1bd70dd1","hex"),
+            this.channel.getBytes(),
+            this.userId.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _user_id;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _user_id = reader.tgReadObject();
+        return new this({channel:_channel,
+	userId:_user_id})
+    }
+}
+
+
+class ReportSpamRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xfe087810;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xfe087810;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.channel = args.channel;
+        this.userId = args.userId;
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("107808fe","hex"),
+            this.channel.getBytes(),
+            this.userId.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _user_id;
+        let _id;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _user_id = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            return new this({channel:_channel,
+	userId:_user_id,
+	id:_id})
+        }
+    }
+
+
+class GetMessagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xad8c9a23;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xad8c9a23;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.channel = args.channel;
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        const _tmp = [];for (const _x of this.id) {
+            _tmp.push(utils.getInputMessage(_x));
+        }
+        this.id = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("239a8cad","hex"),
+            this.channel.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _id;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _id.push(_x);
+            }
+            return new this({channel:_channel,
+	id:_id})
+        }
+    }
+
+
+class GetParticipantsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x123e05e9;
+    static SUBCLASS_OF_ID = 0xe60a6e64;
+
+    /**
+    :returns channels.ChannelParticipants: Instance of either ChannelParticipants, ChannelParticipantsNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x123e05e9;
+        this.SUBCLASS_OF_ID = 0xe60a6e64;
+
+        this.channel = args.channel;
+        this.filter = args.filter;
+        this.offset = args.offset;
+        this.limit = args.limit;
+        this.hash = args.hash;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e9053e12","hex"),
+            this.channel.getBytes(),
+            this.filter.getBytes(),
+            struct.pack('<i', this.offset),
+            struct.pack('<i', this.limit),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _filter;
+        let _offset;
+        let _limit;
+        let _hash;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _filter = reader.tgReadObject();
+        _offset = reader.readInt();
+        _limit = reader.readInt();
+        _hash = reader.readInt();
+        return new this({channel:_channel,
+	filter:_filter,
+	offset:_offset,
+	limit:_limit,
+	hash:_hash})
+    }
+}
+
+
+class GetParticipantRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x546dd7a6;
+    static SUBCLASS_OF_ID = 0x6658151a;
+
+    /**
+    :returns channels.ChannelParticipant: Instance of ChannelParticipant
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x546dd7a6;
+        this.SUBCLASS_OF_ID = 0x6658151a;
+
+        this.channel = args.channel;
+        this.userId = args.userId;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a6d76d54","hex"),
+            this.channel.getBytes(),
+            this.userId.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _user_id;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _user_id = reader.tgReadObject();
+        return new this({channel:_channel,
+	userId:_user_id})
+    }
+}
+
+
+class GetChannelsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x0a7f6bbb;
+    static SUBCLASS_OF_ID = 0x99d5cb14;
+
+    /**
+    :returns messages.Chats: Instance of either Chats, ChatsSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x0a7f6bbb;
+        this.SUBCLASS_OF_ID = 0x99d5cb14;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        const _tmp = [];for (const _x of this.id) {
+            _tmp.push(utils.getInputChannel(await client.getInputEntity(_x)));
+        }
+        this.id = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bb6b7f0a","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _id.push(_x);
+            }
+            return new this({id:_id})
+        }
+    }
+
+
+class GetFullChannelRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x08736a09;
+    static SUBCLASS_OF_ID = 0x225a5109;
+
+    /**
+    :returns messages.ChatFull: Instance of ChatFull
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x08736a09;
+        this.SUBCLASS_OF_ID = 0x225a5109;
+
+        this.channel = args.channel;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("096a7308","hex"),
+            this.channel.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        return new this({channel:_channel})
+    }
+}
+
+
+class CreateChannelRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3d5fb10f;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3d5fb10f;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.broadcast = args.broadcast || null;
+        this.megagroup = args.megagroup || null;
+        this.title = args.title;
+        this.about = args.about;
+        this.geoPoint = args.geoPoint || null;
+        this.address = args.address || null;
+    }
+    getBytes() {
+        if (!((this.geo_point || this.geo_point!==null && this.address || this.address!==null) && (this.geo_point===null || this.geo_point===false && this.address===null || this.address===false)))
+	 throw new Error('geo_point, address paramaters must all be false-y or all true')
+        return Buffer.concat([
+            Buffer.from("0fb15f3d","hex"),
+            struct.pack('<I', (this.broadcast === undefined || this.broadcast === false || this.broadcast === null) ? 0 : 1 | (this.megagroup === undefined || this.megagroup === false || this.megagroup === null) ? 0 : 2 | (this.geoPoint === undefined || this.geoPoint === false || this.geoPoint === null) ? 0 : 4 | (this.address === undefined || this.address === false || this.address === null) ? 0 : 4),
+            TLObject.serializeBytes(this.title),
+            TLObject.serializeBytes(this.about),
+            (this.geoPoint === undefined || this.geoPoint === false || this.geoPoint ===null) ? Buffer.alloc(0) : [this.geoPoint.getBytes()],
+            (this.address === undefined || this.address === false || this.address ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.address)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _broadcast;
+        let _megagroup;
+        let _title;
+        let _about;
+        let _geo_point;
+        let _address;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _broadcast = Boolean(flags & 1);
+        _megagroup = Boolean(flags & 2);
+        _title = reader.tgReadString();
+        _about = reader.tgReadString();
+        if (flags & 4) {
+            _geo_point = reader.tgReadObject();
+        }
+        else {
+            _geo_point = null
+        }
+        if (flags & 4) {
+            _address = reader.tgReadString();
+        }
+        else {
+            _address = null
+        }
+        return new this({broadcast:_broadcast,
+	megagroup:_megagroup,
+	title:_title,
+	about:_about,
+	geoPoint:_geo_point,
+	address:_address})
+    }
+}
+
+
+class EditAdminRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd33c8902;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd33c8902;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+        this.userId = args.userId;
+        this.adminRights = args.adminRights;
+        this.rank = args.rank;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("02893cd3","hex"),
+            this.channel.getBytes(),
+            this.userId.getBytes(),
+            this.adminRights.getBytes(),
+            TLObject.serializeBytes(this.rank),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _user_id;
+        let _admin_rights;
+        let _rank;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _user_id = reader.tgReadObject();
+        _admin_rights = reader.tgReadObject();
+        _rank = reader.tgReadString();
+        return new this({channel:_channel,
+	userId:_user_id,
+	adminRights:_admin_rights,
+	rank:_rank})
+    }
+}
+
+
+class EditTitleRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x566decd0;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x566decd0;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+        this.title = args.title;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d0ec6d56","hex"),
+            this.channel.getBytes(),
+            TLObject.serializeBytes(this.title),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _title;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _title = reader.tgReadString();
+        return new this({channel:_channel,
+	title:_title})
+    }
+}
+
+
+class EditPhotoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf12e57c9;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf12e57c9;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+        this.photo = args.photo;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        this.photo = utils.getInputChatPhoto(this.photo)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c9572ef1","hex"),
+            this.channel.getBytes(),
+            this.photo.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _photo;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _photo = reader.tgReadObject();
+        return new this({channel:_channel,
+	photo:_photo})
+    }
+}
+
+
+class CheckUsernameRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x10e6bd2c;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x10e6bd2c;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.channel = args.channel;
+        this.username = args.username;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2cbde610","hex"),
+            this.channel.getBytes(),
+            TLObject.serializeBytes(this.username),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _username;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _username = reader.tgReadString();
+        return new this({channel:_channel,
+	username:_username})
+    }
+}
+
+
+class UpdateUsernameRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3514b3de;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3514b3de;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.channel = args.channel;
+        this.username = args.username;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("deb31435","hex"),
+            this.channel.getBytes(),
+            TLObject.serializeBytes(this.username),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _username;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _username = reader.tgReadString();
+        return new this({channel:_channel,
+	username:_username})
+    }
+}
+
+
+class JoinChannelRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x24b524c5;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x24b524c5;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c524b524","hex"),
+            this.channel.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        return new this({channel:_channel})
+    }
+}
+
+
+class LeaveChannelRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf836aa95;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf836aa95;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("95aa36f8","hex"),
+            this.channel.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        return new this({channel:_channel})
+    }
+}
+
+
+class InviteToChannelRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x199f3a6c;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x199f3a6c;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+        this.users = args.users;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        const _tmp = [];for (const _x of this.users) {
+            _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
+        }
+        this.users = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6c3a9f19","hex"),
+            this.channel.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _users;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        reader.readInt();
+        _users = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _users.push(_x);
+            }
+            return new this({channel:_channel,
+	users:_users})
+        }
+    }
+
+
+class DeleteChannelRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc0111fe3;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc0111fe3;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e31f11c0","hex"),
+            this.channel.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        return new this({channel:_channel})
+    }
+}
+
+
+class ExportMessageLinkRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xceb77163;
+    static SUBCLASS_OF_ID = 0xdee644cc;
+
+    /**
+    :returns ExportedMessageLink: Instance of ExportedMessageLink
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xceb77163;
+        this.SUBCLASS_OF_ID = 0xdee644cc;
+
+        this.channel = args.channel;
+        this.id = args.id;
+        this.grouped = args.grouped;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6371b7ce","hex"),
+            this.channel.getBytes(),
+            struct.pack('<i', this.id),
+            this.grouped ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _id;
+        let _grouped;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _id = reader.readInt();
+        _grouped = reader.tgReadBool();
+        return new this({channel:_channel,
+	id:_id,
+	grouped:_grouped})
+    }
+}
+
+
+class ToggleSignaturesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1f69b606;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1f69b606;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+        this.enabled = args.enabled;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("06b6691f","hex"),
+            this.channel.getBytes(),
+            this.enabled ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _enabled;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _enabled = reader.tgReadBool();
+        return new this({channel:_channel,
+	enabled:_enabled})
+    }
+}
+
+
+class GetAdminedPublicChannelsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf8b036af;
+    static SUBCLASS_OF_ID = 0x99d5cb14;
+
+    /**
+    :returns messages.Chats: Instance of either Chats, ChatsSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf8b036af;
+        this.SUBCLASS_OF_ID = 0x99d5cb14;
+
+        this.byLocation = args.byLocation || null;
+        this.checkLimit = args.checkLimit || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("af36b0f8","hex"),
+            struct.pack('<I', (this.byLocation === undefined || this.byLocation === false || this.byLocation === null) ? 0 : 1 | (this.checkLimit === undefined || this.checkLimit === false || this.checkLimit === null) ? 0 : 2),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _by_location;
+        let _check_limit;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _by_location = Boolean(flags & 1);
+        _check_limit = Boolean(flags & 2);
+        return new this({byLocation:_by_location,
+	checkLimit:_check_limit})
+    }
+}
+
+
+class EditBannedRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x72796912;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x72796912;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+        this.userId = args.userId;
+        this.bannedRights = args.bannedRights;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("12697972","hex"),
+            this.channel.getBytes(),
+            this.userId.getBytes(),
+            this.bannedRights.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _user_id;
+        let _banned_rights;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _user_id = reader.tgReadObject();
+        _banned_rights = reader.tgReadObject();
+        return new this({channel:_channel,
+	userId:_user_id,
+	bannedRights:_banned_rights})
+    }
+}
+
+
+class GetAdminLogRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x33ddf480;
+    static SUBCLASS_OF_ID = 0x51f076bc;
+
+    /**
+    :returns channels.AdminLogResults: Instance of AdminLogResults
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x33ddf480;
+        this.SUBCLASS_OF_ID = 0x51f076bc;
+
+        this.channel = args.channel;
+        this.q = args.q;
+        this.eventsFilter = args.eventsFilter || null;
+        this.admins = args.admins || null;
+        this.maxId = args.maxId;
+        this.minId = args.minId;
+        this.limit = args.limit;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        if (this.admins) {
+            const _tmp = [];for (const _x of this.admins) {
+                _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
+            }
+            this.admins = _tmp;
+        }
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("80f4dd33","hex"),
+            struct.pack('<I', (this.eventsFilter === undefined || this.eventsFilter === false || this.eventsFilter === null) ? 0 : 1 | (this.admins === undefined || this.admins === false || this.admins === null) ? 0 : 2),
+            this.channel.getBytes(),
+            TLObject.serializeBytes(this.q),
+            (this.eventsFilter === undefined || this.eventsFilter === false || this.eventsFilter ===null) ? Buffer.alloc(0) : [this.eventsFilter.getBytes()],
+            (this.admins === undefined || this.admins === false || this.admins ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.admins.length),Buffer.concat(this.admins.map(x => x.getBytes()))]),
+            readBufferFromBigInt(this.maxId,8,true,true),
+            readBufferFromBigInt(this.minId,8,true,true),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _channel;
+        let _q;
+        let _events_filter;
+        let _admins;
+        let _max_id;
+        let _min_id;
+        let _limit;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _channel = reader.tgReadObject();
+        _q = reader.tgReadString();
+        if (flags & 1) {
+            _events_filter = reader.tgReadObject();
+        }
+        else {
+            _events_filter = null
+        }
+        if (flags & 2) {
+            reader.readInt();
+            _admins = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _admins.push(_x);
+                }
+            }
+            else {
+                _admins = null
+            }
+            _max_id = reader.readLong();
+            _min_id = reader.readLong();
+            _limit = reader.readInt();
+            return new this({channel:_channel,
+	q:_q,
+	eventsFilter:_events_filter,
+	admins:_admins,
+	maxId:_max_id,
+	minId:_min_id,
+	limit:_limit})
+        }
+    }
+
+
+class SetStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xea8ca4f9;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xea8ca4f9;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.channel = args.channel;
+        this.stickerset = args.stickerset;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f9a48cea","hex"),
+            this.channel.getBytes(),
+            this.stickerset.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _stickerset;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _stickerset = reader.tgReadObject();
+        return new this({channel:_channel,
+	stickerset:_stickerset})
+    }
+}
+
+
+class ReadMessageContentsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xeab5dc38;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xeab5dc38;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.channel = args.channel;
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("38dcb5ea","hex"),
+            this.channel.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _id;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            return new this({channel:_channel,
+	id:_id})
+        }
+    }
+
+
+class DeleteHistoryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xaf369d42;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xaf369d42;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.channel = args.channel;
+        this.maxId = args.maxId;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("429d36af","hex"),
+            this.channel.getBytes(),
+            struct.pack('<i', this.maxId),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _max_id;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _max_id = reader.readInt();
+        return new this({channel:_channel,
+	maxId:_max_id})
+    }
+}
+
+
+class TogglePreHistoryHiddenRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xeabbb94c;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xeabbb94c;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+        this.enabled = args.enabled;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4cb9bbea","hex"),
+            this.channel.getBytes(),
+            this.enabled ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _enabled;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _enabled = reader.tgReadBool();
+        return new this({channel:_channel,
+	enabled:_enabled})
+    }
+}
+
+
+class GetLeftChannelsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8341ecc0;
+    static SUBCLASS_OF_ID = 0x99d5cb14;
+
+    /**
+    :returns messages.Chats: Instance of either Chats, ChatsSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8341ecc0;
+        this.SUBCLASS_OF_ID = 0x99d5cb14;
+
+        this.offset = args.offset;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c0ec4183","hex"),
+            struct.pack('<i', this.offset),
+            ])
+        }
+    static fromReader(reader) {
+        let _offset;
+        let _x;
+        let len;
+        _offset = reader.readInt();
+        return new this({offset:_offset})
+    }
+}
+
+
+class GetGroupsForDiscussionRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf5dad378;
+    static SUBCLASS_OF_ID = 0x99d5cb14;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xf5dad378;
+        this.SUBCLASS_OF_ID = 0x99d5cb14;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("78d3daf5","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class SetDiscussionGroupRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x40582bb2;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x40582bb2;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.broadcast = args.broadcast;
+        this.group = args.group;
+    }
+    async resolve(client, utils) {
+        this.broadcast = utils.getInputChannel(await client.getInputEntity(this.broadcast))
+        this.group = utils.getInputChannel(await client.getInputEntity(this.group))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b22b5840","hex"),
+            this.broadcast.getBytes(),
+            this.group.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _broadcast;
+        let _group;
+        let _x;
+        let len;
+        _broadcast = reader.tgReadObject();
+        _group = reader.tgReadObject();
+        return new this({broadcast:_broadcast,
+	group:_group})
+    }
+}
+
+
+class EditCreatorRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8f38cd1f;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8f38cd1f;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+        this.userId = args.userId;
+        this.password = args.password;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1fcd388f","hex"),
+            this.channel.getBytes(),
+            this.userId.getBytes(),
+            this.password.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _user_id;
+        let _password;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _user_id = reader.tgReadObject();
+        _password = reader.tgReadObject();
+        return new this({channel:_channel,
+	userId:_user_id,
+	password:_password})
+    }
+}
+
+
+class EditLocationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x58e63f6d;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x58e63f6d;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.channel = args.channel;
+        this.geoPoint = args.geoPoint;
+        this.address = args.address;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6d3fe658","hex"),
+            this.channel.getBytes(),
+            this.geoPoint.getBytes(),
+            TLObject.serializeBytes(this.address),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _geo_point;
+        let _address;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _geo_point = reader.tgReadObject();
+        _address = reader.tgReadString();
+        return new this({channel:_channel,
+	geoPoint:_geo_point,
+	address:_address})
+    }
+}
+
+
+class ToggleSlowModeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xedd49ef0;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xedd49ef0;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.channel = args.channel;
+        this.seconds = args.seconds;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f09ed4ed","hex"),
+            this.channel.getBytes(),
+            struct.pack('<i', this.seconds),
+            ])
+        }
+    static fromReader(reader) {
+        let _channel;
+        let _seconds;
+        let _x;
+        let len;
+        _channel = reader.tgReadObject();
+        _seconds = reader.readInt();
+        return new this({channel:_channel,
+	seconds:_seconds})
+    }
+}
+
+module.exports = {
+    ReadHistoryRequest,
+    DeleteMessagesRequest,
+    DeleteUserHistoryRequest,
+    ReportSpamRequest,
+    GetMessagesRequest,
+    GetParticipantsRequest,
+    GetParticipantRequest,
+    GetChannelsRequest,
+    GetFullChannelRequest,
+    CreateChannelRequest,
+    EditAdminRequest,
+    EditTitleRequest,
+    EditPhotoRequest,
+    CheckUsernameRequest,
+    UpdateUsernameRequest,
+    JoinChannelRequest,
+    LeaveChannelRequest,
+    InviteToChannelRequest,
+    DeleteChannelRequest,
+    ExportMessageLinkRequest,
+    ToggleSignaturesRequest,
+    GetAdminedPublicChannelsRequest,
+    EditBannedRequest,
+    GetAdminLogRequest,
+    SetStickersRequest,
+    ReadMessageContentsRequest,
+    DeleteHistoryRequest,
+    TogglePreHistoryHiddenRequest,
+    GetLeftChannelsRequest,
+    GetGroupsForDiscussionRequest,
+    SetDiscussionGroupRequest,
+    EditCreatorRequest,
+    EditLocationRequest,
+    ToggleSlowModeRequest,
+};

+ 725 - 0
src/lib/gramjs/tl/functions/contacts.js

@@ -0,0 +1,725 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class GetContactIDsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2caa4a42;
+    static SUBCLASS_OF_ID = 0x5026710f;
+
+    /**
+    :returns Vector<int>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2caa4a42;
+        this.SUBCLASS_OF_ID = 0x5026710f;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("424aaa2c","hex"),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        return new this({hash:_hash})
+    }
+    readResult(reader){
+        reader.readInt();  // Vector ID
+        let temp = [];
+        let len = reader.readInt(); //fix this
+        for (let i=0;i<len;i++){
+            temp.push(reader.readInt())
+        }
+        return temp
+    }
+}
+
+
+class GetStatusesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc4a353ee;
+    static SUBCLASS_OF_ID = 0xdf815c90;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xc4a353ee;
+        this.SUBCLASS_OF_ID = 0xdf815c90;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ee53a3c4","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetContactsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc023849f;
+    static SUBCLASS_OF_ID = 0x38be25f6;
+
+    /**
+    :returns contacts.Contacts: Instance of either ContactsNotModified, Contacts
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc023849f;
+        this.SUBCLASS_OF_ID = 0x38be25f6;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9f8423c0","hex"),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        return new this({hash:_hash})
+    }
+}
+
+
+class ImportContactsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2c800be5;
+    static SUBCLASS_OF_ID = 0x8172ad93;
+
+    /**
+    :returns contacts.ImportedContacts: Instance of ImportedContacts
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2c800be5;
+        this.SUBCLASS_OF_ID = 0x8172ad93;
+
+        this.contacts = args.contacts;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e50b802c","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.contacts.length),Buffer.concat(this.contacts.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _contacts;
+        let _x;
+        let len;
+        reader.readInt();
+        _contacts = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _contacts.push(_x);
+            }
+            return new this({contacts:_contacts})
+        }
+    }
+
+
+class DeleteContactsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x096a0e00;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x096a0e00;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        const _tmp = [];for (const _x of this.id) {
+            _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
+        }
+        this.id = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("000e6a09","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _id.push(_x);
+            }
+            return new this({id:_id})
+        }
+    }
+
+
+class DeleteByPhonesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1013fd9e;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1013fd9e;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.phones = args.phones;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9efd1310","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.phones.length),Buffer.concat(this.phones.map(x => TLObject.serializeBytes(x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _phones;
+        let _x;
+        let len;
+        reader.readInt();
+        _phones = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadString();
+            _phones.push(_x);
+            }
+            return new this({phones:_phones})
+        }
+    }
+
+
+class BlockRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x332b49fc;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x332b49fc;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputUser(await client.getInputEntity(this.id))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("fc492b33","hex"),
+            this.id.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        return new this({id:_id})
+    }
+}
+
+
+class UnblockRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe54100bd;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe54100bd;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputUser(await client.getInputEntity(this.id))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bd0041e5","hex"),
+            this.id.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        return new this({id:_id})
+    }
+}
+
+
+class GetBlockedRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf57c350f;
+    static SUBCLASS_OF_ID = 0xffba4f4f;
+
+    /**
+    :returns contacts.Blocked: Instance of either Blocked, BlockedSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf57c350f;
+        this.SUBCLASS_OF_ID = 0xffba4f4f;
+
+        this.offset = args.offset;
+        this.limit = args.limit;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0f357cf5","hex"),
+            struct.pack('<i', this.offset),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _offset;
+        let _limit;
+        let _x;
+        let len;
+        _offset = reader.readInt();
+        _limit = reader.readInt();
+        return new this({offset:_offset,
+	limit:_limit})
+    }
+}
+
+
+class SearchRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x11f812d8;
+    static SUBCLASS_OF_ID = 0x4386a2e3;
+
+    /**
+    :returns contacts.Found: Instance of Found
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x11f812d8;
+        this.SUBCLASS_OF_ID = 0x4386a2e3;
+
+        this.q = args.q;
+        this.limit = args.limit;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d812f811","hex"),
+            TLObject.serializeBytes(this.q),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _q;
+        let _limit;
+        let _x;
+        let len;
+        _q = reader.tgReadString();
+        _limit = reader.readInt();
+        return new this({q:_q,
+	limit:_limit})
+    }
+}
+
+
+class ResolveUsernameRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf93ccba3;
+    static SUBCLASS_OF_ID = 0xf065b3a8;
+
+    /**
+    :returns contacts.ResolvedPeer: Instance of ResolvedPeer
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf93ccba3;
+        this.SUBCLASS_OF_ID = 0xf065b3a8;
+
+        this.username = args.username;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a3cb3cf9","hex"),
+            TLObject.serializeBytes(this.username),
+            ])
+        }
+    static fromReader(reader) {
+        let _username;
+        let _x;
+        let len;
+        _username = reader.tgReadString();
+        return new this({username:_username})
+    }
+}
+
+
+class GetTopPeersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd4982db5;
+    static SUBCLASS_OF_ID = 0x9ee8bb88;
+
+    /**
+    :returns contacts.TopPeers: Instance of either TopPeersNotModified, TopPeers, TopPeersDisabled
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd4982db5;
+        this.SUBCLASS_OF_ID = 0x9ee8bb88;
+
+        this.correspondents = args.correspondents || null;
+        this.botsPm = args.botsPm || null;
+        this.botsInline = args.botsInline || null;
+        this.phoneCalls = args.phoneCalls || null;
+        this.forwardUsers = args.forwardUsers || null;
+        this.forwardChats = args.forwardChats || null;
+        this.groups = args.groups || null;
+        this.channels = args.channels || null;
+        this.offset = args.offset;
+        this.limit = args.limit;
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b52d98d4","hex"),
+            struct.pack('<I', (this.correspondents === undefined || this.correspondents === false || this.correspondents === null) ? 0 : 1 | (this.botsPm === undefined || this.botsPm === false || this.botsPm === null) ? 0 : 2 | (this.botsInline === undefined || this.botsInline === false || this.botsInline === null) ? 0 : 4 | (this.phoneCalls === undefined || this.phoneCalls === false || this.phoneCalls === null) ? 0 : 8 | (this.forwardUsers === undefined || this.forwardUsers === false || this.forwardUsers === null) ? 0 : 16 | (this.forwardChats === undefined || this.forwardChats === false || this.forwardChats === null) ? 0 : 32 | (this.groups === undefined || this.groups === false || this.groups === null) ? 0 : 1024 | (this.channels === undefined || this.channels === false || this.channels === null) ? 0 : 32768),
+            struct.pack('<i', this.offset),
+            struct.pack('<i', this.limit),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _correspondents;
+        let _bots_pm;
+        let _bots_inline;
+        let _phone_calls;
+        let _forward_users;
+        let _forward_chats;
+        let _groups;
+        let _channels;
+        let _offset;
+        let _limit;
+        let _hash;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _correspondents = Boolean(flags & 1);
+        _bots_pm = Boolean(flags & 2);
+        _bots_inline = Boolean(flags & 4);
+        _phone_calls = Boolean(flags & 8);
+        _forward_users = Boolean(flags & 16);
+        _forward_chats = Boolean(flags & 32);
+        _groups = Boolean(flags & 1024);
+        _channels = Boolean(flags & 32768);
+        _offset = reader.readInt();
+        _limit = reader.readInt();
+        _hash = reader.readInt();
+        return new this({correspondents:_correspondents,
+	botsPm:_bots_pm,
+	botsInline:_bots_inline,
+	phoneCalls:_phone_calls,
+	forwardUsers:_forward_users,
+	forwardChats:_forward_chats,
+	groups:_groups,
+	channels:_channels,
+	offset:_offset,
+	limit:_limit,
+	hash:_hash})
+    }
+}
+
+
+class ResetTopPeerRatingRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1ae373ac;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1ae373ac;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.category = args.category;
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ac73e31a","hex"),
+            this.category.getBytes(),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _category;
+        let _peer;
+        let _x;
+        let len;
+        _category = reader.tgReadObject();
+        _peer = reader.tgReadObject();
+        return new this({category:_category,
+	peer:_peer})
+    }
+}
+
+
+class ResetSavedRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x879537f1;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x879537f1;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f1379587","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetSavedRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x82f1e39f;
+    static SUBCLASS_OF_ID = 0x975dbef;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x82f1e39f;
+        this.SUBCLASS_OF_ID = 0x975dbef;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9fe3f182","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class ToggleTopPeersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8514bdda;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8514bdda;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.enabled = args.enabled;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("dabd1485","hex"),
+            this.enabled ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _enabled;
+        let _x;
+        let len;
+        _enabled = reader.tgReadBool();
+        return new this({enabled:_enabled})
+    }
+}
+
+
+class AddContactRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe8f463d0;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe8f463d0;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.addPhonePrivacyException = args.addPhonePrivacyException || null;
+        this.id = args.id;
+        this.firstName = args.firstName;
+        this.lastName = args.lastName;
+        this.phone = args.phone;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputUser(await client.getInputEntity(this.id))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d063f4e8","hex"),
+            struct.pack('<I', (this.addPhonePrivacyException === undefined || this.addPhonePrivacyException === false || this.addPhonePrivacyException === null) ? 0 : 1),
+            this.id.getBytes(),
+            TLObject.serializeBytes(this.firstName),
+            TLObject.serializeBytes(this.lastName),
+            TLObject.serializeBytes(this.phone),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _add_phone_privacy_exception;
+        let _id;
+        let _first_name;
+        let _last_name;
+        let _phone;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _add_phone_privacy_exception = Boolean(flags & 1);
+        _id = reader.tgReadObject();
+        _first_name = reader.tgReadString();
+        _last_name = reader.tgReadString();
+        _phone = reader.tgReadString();
+        return new this({addPhonePrivacyException:_add_phone_privacy_exception,
+	id:_id,
+	firstName:_first_name,
+	lastName:_last_name,
+	phone:_phone})
+    }
+}
+
+
+class AcceptContactRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf831a20f;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf831a20f;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputUser(await client.getInputEntity(this.id))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0fa231f8","hex"),
+            this.id.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        return new this({id:_id})
+    }
+}
+
+
+class GetLocatedRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x0a356056;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x0a356056;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.geoPoint = args.geoPoint;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5660350a","hex"),
+            this.geoPoint.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _geo_point;
+        let _x;
+        let len;
+        _geo_point = reader.tgReadObject();
+        return new this({geoPoint:_geo_point})
+    }
+}
+
+module.exports = {
+    GetContactIDsRequest,
+    GetStatusesRequest,
+    GetContactsRequest,
+    ImportContactsRequest,
+    DeleteContactsRequest,
+    DeleteByPhonesRequest,
+    BlockRequest,
+    UnblockRequest,
+    GetBlockedRequest,
+    SearchRequest,
+    ResolveUsernameRequest,
+    GetTopPeersRequest,
+    ResetTopPeerRatingRequest,
+    ResetSavedRequest,
+    GetSavedRequest,
+    ToggleTopPeersRequest,
+    AddContactRequest,
+    AcceptContactRequest,
+    GetLocatedRequest,
+};

+ 79 - 0
src/lib/gramjs/tl/functions/folders.js

@@ -0,0 +1,79 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class EditPeerFoldersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x6847d0ab;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x6847d0ab;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.folderPeers = args.folderPeers;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("abd04768","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.folderPeers.length),Buffer.concat(this.folderPeers.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _folder_peers;
+        let _x;
+        let len;
+        reader.readInt();
+        _folder_peers = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _folder_peers.push(_x);
+            }
+            return new this({folderPeers:_folder_peers})
+        }
+    }
+
+
+class DeleteFolderRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1c295881;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1c295881;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.folderId = args.folderId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8158291c","hex"),
+            struct.pack('<i', this.folderId),
+            ])
+        }
+    static fromReader(reader) {
+        let _folder_id;
+        let _x;
+        let len;
+        _folder_id = reader.readInt();
+        return new this({folderId:_folder_id})
+    }
+}
+
+module.exports = {
+    EditPeerFoldersRequest,
+    DeleteFolderRequest,
+};

+ 578 - 0
src/lib/gramjs/tl/functions/help.js

@@ -0,0 +1,578 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class GetConfigRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc4f9186b;
+    static SUBCLASS_OF_ID = 0xd3262a4a;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xc4f9186b;
+        this.SUBCLASS_OF_ID = 0xd3262a4a;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6b18f9c4","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetNearestDcRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1fb33026;
+    static SUBCLASS_OF_ID = 0x3877045f;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x1fb33026;
+        this.SUBCLASS_OF_ID = 0x3877045f;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2630b31f","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetAppUpdateRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x522d5a7d;
+    static SUBCLASS_OF_ID = 0x5897069e;
+
+    /**
+    :returns help.AppUpdate: Instance of either AppUpdate, NoAppUpdate
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x522d5a7d;
+        this.SUBCLASS_OF_ID = 0x5897069e;
+
+        this.source = args.source;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("7d5a2d52","hex"),
+            TLObject.serializeBytes(this.source),
+            ])
+        }
+    static fromReader(reader) {
+        let _source;
+        let _x;
+        let len;
+        _source = reader.tgReadString();
+        return new this({source:_source})
+    }
+}
+
+
+class GetInviteTextRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x4d392343;
+    static SUBCLASS_OF_ID = 0xcf70aa35;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x4d392343;
+        this.SUBCLASS_OF_ID = 0xcf70aa35;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4323394d","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetSupportRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x9cdf08cd;
+    static SUBCLASS_OF_ID = 0x7159bceb;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x9cdf08cd;
+        this.SUBCLASS_OF_ID = 0x7159bceb;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("cd08df9c","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetAppChangelogRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x9010ef6f;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x9010ef6f;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.prevAppVersion = args.prevAppVersion;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6fef1090","hex"),
+            TLObject.serializeBytes(this.prevAppVersion),
+            ])
+        }
+    static fromReader(reader) {
+        let _prev_app_version;
+        let _x;
+        let len;
+        _prev_app_version = reader.tgReadString();
+        return new this({prevAppVersion:_prev_app_version})
+    }
+}
+
+
+class SetBotUpdatesStatusRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xec22cfcd;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xec22cfcd;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.pendingUpdatesCount = args.pendingUpdatesCount;
+        this.message = args.message;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("cdcf22ec","hex"),
+            struct.pack('<i', this.pendingUpdatesCount),
+            TLObject.serializeBytes(this.message),
+            ])
+        }
+    static fromReader(reader) {
+        let _pending_updates_count;
+        let _message;
+        let _x;
+        let len;
+        _pending_updates_count = reader.readInt();
+        _message = reader.tgReadString();
+        return new this({pendingUpdatesCount:_pending_updates_count,
+	message:_message})
+    }
+}
+
+
+class GetCdnConfigRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x52029342;
+    static SUBCLASS_OF_ID = 0xecda397c;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x52029342;
+        this.SUBCLASS_OF_ID = 0xecda397c;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("42930252","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetRecentMeUrlsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3dc0f114;
+    static SUBCLASS_OF_ID = 0xf269c477;
+
+    /**
+    :returns help.RecentMeUrls: Instance of RecentMeUrls
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3dc0f114;
+        this.SUBCLASS_OF_ID = 0xf269c477;
+
+        this.referer = args.referer;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("14f1c03d","hex"),
+            TLObject.serializeBytes(this.referer),
+            ])
+        }
+    static fromReader(reader) {
+        let _referer;
+        let _x;
+        let len;
+        _referer = reader.tgReadString();
+        return new this({referer:_referer})
+    }
+}
+
+
+class GetProxyDataRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3d7758e1;
+    static SUBCLASS_OF_ID = 0x21e2a448;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x3d7758e1;
+        this.SUBCLASS_OF_ID = 0x21e2a448;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e158773d","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetTermsOfServiceUpdateRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2ca51fd1;
+    static SUBCLASS_OF_ID = 0x293c2977;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x2ca51fd1;
+        this.SUBCLASS_OF_ID = 0x293c2977;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d11fa52c","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class AcceptTermsOfServiceRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xee72f79a;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xee72f79a;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.id = args.id;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9af772ee","hex"),
+            this.id.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        return new this({id:_id})
+    }
+}
+
+
+class GetDeepLinkInfoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3fedc75f;
+    static SUBCLASS_OF_ID = 0x984aac38;
+
+    /**
+    :returns help.DeepLinkInfo: Instance of either DeepLinkInfoEmpty, DeepLinkInfo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3fedc75f;
+        this.SUBCLASS_OF_ID = 0x984aac38;
+
+        this.path = args.path;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5fc7ed3f","hex"),
+            TLObject.serializeBytes(this.path),
+            ])
+        }
+    static fromReader(reader) {
+        let _path;
+        let _x;
+        let len;
+        _path = reader.tgReadString();
+        return new this({path:_path})
+    }
+}
+
+
+class GetAppConfigRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x98914110;
+    static SUBCLASS_OF_ID = 0xeb9987b3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x98914110;
+        this.SUBCLASS_OF_ID = 0xeb9987b3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("10419198","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class SaveAppLogRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x6f02f748;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x6f02f748;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.events = args.events;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("48f7026f","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.events.length),Buffer.concat(this.events.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _events;
+        let _x;
+        let len;
+        reader.readInt();
+        _events = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _events.push(_x);
+            }
+            return new this({events:_events})
+        }
+    }
+
+
+class GetPassportConfigRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc661ad08;
+    static SUBCLASS_OF_ID = 0xc666c0ad;
+
+    /**
+    :returns help.PassportConfig: Instance of either PassportConfigNotModified, PassportConfig
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc661ad08;
+        this.SUBCLASS_OF_ID = 0xc666c0ad;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("08ad61c6","hex"),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        return new this({hash:_hash})
+    }
+}
+
+
+class GetSupportNameRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd360e72c;
+    static SUBCLASS_OF_ID = 0x7f50b7c2;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xd360e72c;
+        this.SUBCLASS_OF_ID = 0x7f50b7c2;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2ce760d3","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetUserInfoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x038a08d3;
+    static SUBCLASS_OF_ID = 0x5c53d7d8;
+
+    /**
+    :returns help.UserInfo: Instance of either UserInfoEmpty, UserInfo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x038a08d3;
+        this.SUBCLASS_OF_ID = 0x5c53d7d8;
+
+        this.userId = args.userId;
+    }
+    async resolve(client, utils) {
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d3088a03","hex"),
+            this.userId.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _user_id;
+        let _x;
+        let len;
+        _user_id = reader.tgReadObject();
+        return new this({userId:_user_id})
+    }
+}
+
+
+class EditUserInfoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x66b91b70;
+    static SUBCLASS_OF_ID = 0x5c53d7d8;
+
+    /**
+    :returns help.UserInfo: Instance of either UserInfoEmpty, UserInfo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x66b91b70;
+        this.SUBCLASS_OF_ID = 0x5c53d7d8;
+
+        this.userId = args.userId;
+        this.message = args.message;
+        this.entities = args.entities;
+    }
+    async resolve(client, utils) {
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("701bb966","hex"),
+            this.userId.getBytes(),
+            TLObject.serializeBytes(this.message),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _user_id;
+        let _message;
+        let _entities;
+        let _x;
+        let len;
+        _user_id = reader.tgReadObject();
+        _message = reader.tgReadString();
+        reader.readInt();
+        _entities = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _entities.push(_x);
+            }
+            return new this({userId:_user_id,
+	message:_message,
+	entities:_entities})
+        }
+    }
+
+module.exports = {
+    GetConfigRequest,
+    GetNearestDcRequest,
+    GetAppUpdateRequest,
+    GetInviteTextRequest,
+    GetSupportRequest,
+    GetAppChangelogRequest,
+    SetBotUpdatesStatusRequest,
+    GetCdnConfigRequest,
+    GetRecentMeUrlsRequest,
+    GetProxyDataRequest,
+    GetTermsOfServiceUpdateRequest,
+    AcceptTermsOfServiceRequest,
+    GetDeepLinkInfoRequest,
+    GetAppConfigRequest,
+    SaveAppLogRequest,
+    GetPassportConfigRequest,
+    GetSupportNameRequest,
+    GetUserInfoRequest,
+    EditUserInfoRequest,
+};

+ 704 - 0
src/lib/gramjs/tl/functions/index.js

@@ -0,0 +1,704 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class InvokeAfterMsgRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xcb9f372d;
+    static SUBCLASS_OF_ID = 0xb7b2364b;
+
+    /**
+    :returns X: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xcb9f372d;
+        this.SUBCLASS_OF_ID = 0xb7b2364b;
+
+        this.msgId = args.msgId;
+        this.query = args.query;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2d379fcb","hex"),
+            readBufferFromBigInt(this.msgId,8,true,true),
+            this.query.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _X;
+        let _msg_id;
+        let _query;
+        let _x;
+        let len;
+        _msg_id = reader.readLong();
+        _query = reader.tgReadObject();
+        return new this({msgId:_msg_id,
+	query:_query})
+    }
+}
+
+
+class InvokeAfterMsgsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3dc4b4f0;
+    static SUBCLASS_OF_ID = 0xb7b2364b;
+
+    /**
+    :returns X: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3dc4b4f0;
+        this.SUBCLASS_OF_ID = 0xb7b2364b;
+
+        this.msgIds = args.msgIds;
+        this.query = args.query;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f0b4c43d","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.msgIds.length),Buffer.concat(this.msgIds.map(x => readBufferFromBigInt(x,8,true,true))),
+            this.query.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _X;
+        let _msg_ids;
+        let _query;
+        let _x;
+        let len;
+        reader.readInt();
+        _msg_ids = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readLong();
+            _msg_ids.push(_x);
+            }
+            _query = reader.tgReadObject();
+            return new this({msgIds:_msg_ids,
+	query:_query})
+        }
+    }
+
+
+class InitConnectionRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x785188b8;
+    static SUBCLASS_OF_ID = 0xb7b2364b;
+
+    /**
+    :returns X: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x785188b8;
+        this.SUBCLASS_OF_ID = 0xb7b2364b;
+
+        this.apiId = args.apiId;
+        this.deviceModel = args.deviceModel;
+        this.systemVersion = args.systemVersion;
+        this.appVersion = args.appVersion;
+        this.systemLangCode = args.systemLangCode;
+        this.langPack = args.langPack;
+        this.langCode = args.langCode;
+        this.proxy = args.proxy || null;
+        this.query = args.query;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b8885178","hex"),
+            struct.pack('<I', (this.proxy === undefined || this.proxy === false || this.proxy === null) ? 0 : 1),
+            struct.pack('<i', this.apiId),
+            TLObject.serializeBytes(this.deviceModel),
+            TLObject.serializeBytes(this.systemVersion),
+            TLObject.serializeBytes(this.appVersion),
+            TLObject.serializeBytes(this.systemLangCode),
+            TLObject.serializeBytes(this.langPack),
+            TLObject.serializeBytes(this.langCode),
+            (this.proxy === undefined || this.proxy === false || this.proxy ===null) ? Buffer.alloc(0) : [this.proxy.getBytes()],
+            this.query.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _X;
+        let _flags;
+        let _api_id;
+        let _device_model;
+        let _system_version;
+        let _app_version;
+        let _system_lang_code;
+        let _lang_pack;
+        let _lang_code;
+        let _proxy;
+        let _query;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _api_id = reader.readInt();
+        _device_model = reader.tgReadString();
+        _system_version = reader.tgReadString();
+        _app_version = reader.tgReadString();
+        _system_lang_code = reader.tgReadString();
+        _lang_pack = reader.tgReadString();
+        _lang_code = reader.tgReadString();
+        if (flags & 1) {
+            _proxy = reader.tgReadObject();
+        }
+        else {
+            _proxy = null
+        }
+        _query = reader.tgReadObject();
+        return new this({apiId:_api_id,
+	deviceModel:_device_model,
+	systemVersion:_system_version,
+	appVersion:_app_version,
+	systemLangCode:_system_lang_code,
+	langPack:_lang_pack,
+	langCode:_lang_code,
+	proxy:_proxy,
+	query:_query})
+    }
+}
+
+
+class InvokeWithLayerRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xda9b0d0d;
+    static SUBCLASS_OF_ID = 0xb7b2364b;
+
+    /**
+    :returns X: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xda9b0d0d;
+        this.SUBCLASS_OF_ID = 0xb7b2364b;
+
+        this.layer = args.layer;
+        this.query = args.query;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0d0d9bda","hex"),
+            struct.pack('<i', this.layer),
+            this.query.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _X;
+        let _layer;
+        let _query;
+        let _x;
+        let len;
+        _layer = reader.readInt();
+        _query = reader.tgReadObject();
+        return new this({layer:_layer,
+	query:_query})
+    }
+}
+
+
+class InvokeWithoutUpdatesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbf9459b7;
+    static SUBCLASS_OF_ID = 0xb7b2364b;
+
+    /**
+    :returns X: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbf9459b7;
+        this.SUBCLASS_OF_ID = 0xb7b2364b;
+
+        this.query = args.query;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b75994bf","hex"),
+            this.query.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _X;
+        let _query;
+        let _x;
+        let len;
+        _query = reader.tgReadObject();
+        return new this({query:_query})
+    }
+}
+
+
+class InvokeWithMessagesRangeRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x365275f2;
+    static SUBCLASS_OF_ID = 0xb7b2364b;
+
+    /**
+    :returns X: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x365275f2;
+        this.SUBCLASS_OF_ID = 0xb7b2364b;
+
+        this.range = args.range;
+        this.query = args.query;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f2755236","hex"),
+            this.range.getBytes(),
+            this.query.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _X;
+        let _range;
+        let _query;
+        let _x;
+        let len;
+        _range = reader.tgReadObject();
+        _query = reader.tgReadObject();
+        return new this({range:_range,
+	query:_query})
+    }
+}
+
+
+class InvokeWithTakeoutRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xaca9fd2e;
+    static SUBCLASS_OF_ID = 0xb7b2364b;
+
+    /**
+    :returns X: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xaca9fd2e;
+        this.SUBCLASS_OF_ID = 0xb7b2364b;
+
+        this.takeoutId = args.takeoutId;
+        this.query = args.query;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2efda9ac","hex"),
+            readBufferFromBigInt(this.takeoutId,8,true,true),
+            this.query.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _X;
+        let _takeout_id;
+        let _query;
+        let _x;
+        let len;
+        _takeout_id = reader.readLong();
+        _query = reader.tgReadObject();
+        return new this({takeoutId:_takeout_id,
+	query:_query})
+    }
+}
+
+
+class ReqPqRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x60469778;
+    static SUBCLASS_OF_ID = 0x786986b8;
+
+    /**
+    :returns ResPQ: Instance of ResPQ
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x60469778;
+        this.SUBCLASS_OF_ID = 0x786986b8;
+
+        this.nonce = args.nonce;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("78974660","hex"),
+            readBufferFromBigInt(this.nonce,16,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _nonce;
+        let _x;
+        let len;
+        _nonce = reader.readLargeInt(128);
+        return new this({nonce:_nonce})
+    }
+}
+
+
+class ReqPqMultiRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbe7e8ef1;
+    static SUBCLASS_OF_ID = 0x786986b8;
+
+    /**
+    :returns ResPQ: Instance of ResPQ
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbe7e8ef1;
+        this.SUBCLASS_OF_ID = 0x786986b8;
+
+        this.nonce = args.nonce;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f18e7ebe","hex"),
+            readBufferFromBigInt(this.nonce,16,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _nonce;
+        let _x;
+        let len;
+        _nonce = reader.readLargeInt(128);
+        return new this({nonce:_nonce})
+    }
+}
+
+
+class ReqDHParamsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd712e4be;
+    static SUBCLASS_OF_ID = 0xa6188d9e;
+
+    /**
+    :returns Server_DH_Params: Instance of either ServerDHParamsFail, ServerDHParamsOk
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd712e4be;
+        this.SUBCLASS_OF_ID = 0xa6188d9e;
+
+        this.nonce = args.nonce;
+        this.serverNonce = args.serverNonce;
+        this.p = args.p;
+        this.q = args.q;
+        this.publicKeyFingerprint = args.publicKeyFingerprint;
+        this.encryptedData = args.encryptedData;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bee412d7","hex"),
+            readBufferFromBigInt(this.nonce,16,true,true),
+            readBufferFromBigInt(this.serverNonce,16,true,true),
+            TLObject.serializeBytes(this.p),
+            TLObject.serializeBytes(this.q),
+            readBufferFromBigInt(this.publicKeyFingerprint,8,true,true),
+            TLObject.serializeBytes(this.encryptedData),
+            ])
+        }
+    static fromReader(reader) {
+        let _nonce;
+        let _server_nonce;
+        let _p;
+        let _q;
+        let _public_key_fingerprint;
+        let _encrypted_data;
+        let _x;
+        let len;
+        _nonce = reader.readLargeInt(128);
+        _server_nonce = reader.readLargeInt(128);
+        _p = reader.tgReadBytes();
+        _q = reader.tgReadBytes();
+        _public_key_fingerprint = reader.readLong();
+        _encrypted_data = reader.tgReadBytes();
+        return new this({nonce:_nonce,
+	serverNonce:_server_nonce,
+	p:_p,
+	q:_q,
+	publicKeyFingerprint:_public_key_fingerprint,
+	encryptedData:_encrypted_data})
+    }
+}
+
+
+class SetClientDHParamsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf5045f1f;
+    static SUBCLASS_OF_ID = 0x55dd6cdb;
+
+    /**
+    :returns Set_client_DH_params_answer: Instance of either DhGenOk, DhGenRetry, DhGenFail
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf5045f1f;
+        this.SUBCLASS_OF_ID = 0x55dd6cdb;
+
+        this.nonce = args.nonce;
+        this.serverNonce = args.serverNonce;
+        this.encryptedData = args.encryptedData;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1f5f04f5","hex"),
+            readBufferFromBigInt(this.nonce,16,true,true),
+            readBufferFromBigInt(this.serverNonce,16,true,true),
+            TLObject.serializeBytes(this.encryptedData),
+            ])
+        }
+    static fromReader(reader) {
+        let _nonce;
+        let _server_nonce;
+        let _encrypted_data;
+        let _x;
+        let len;
+        _nonce = reader.readLargeInt(128);
+        _server_nonce = reader.readLargeInt(128);
+        _encrypted_data = reader.tgReadBytes();
+        return new this({nonce:_nonce,
+	serverNonce:_server_nonce,
+	encryptedData:_encrypted_data})
+    }
+}
+
+
+class DestroyAuthKeyRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd1435160;
+    static SUBCLASS_OF_ID = 0x8291e68e;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xd1435160;
+        this.SUBCLASS_OF_ID = 0x8291e68e;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("605143d1","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class RpcDropAnswerRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x58e4a740;
+    static SUBCLASS_OF_ID = 0x4bca7570;
+
+    /**
+    :returns RpcDropAnswer: Instance of either RpcAnswerUnknown, RpcAnswerDroppedRunning, RpcAnswerDropped
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x58e4a740;
+        this.SUBCLASS_OF_ID = 0x4bca7570;
+
+        this.reqMsgId = args.reqMsgId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("40a7e458","hex"),
+            readBufferFromBigInt(this.reqMsgId,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _req_msg_id;
+        let _x;
+        let len;
+        _req_msg_id = reader.readLong();
+        return new this({reqMsgId:_req_msg_id})
+    }
+}
+
+
+class GetFutureSaltsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xb921bd04;
+    static SUBCLASS_OF_ID = 0x1090f517;
+
+    /**
+    :returns FutureSalts: Instance of FutureSalts
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb921bd04;
+        this.SUBCLASS_OF_ID = 0x1090f517;
+
+        this.num = args.num;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("04bd21b9","hex"),
+            struct.pack('<i', this.num),
+            ])
+        }
+    static fromReader(reader) {
+        let _num;
+        let _x;
+        let len;
+        _num = reader.readInt();
+        return new this({num:_num})
+    }
+}
+
+
+class PingRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x7abe77ec;
+    static SUBCLASS_OF_ID = 0x816aee71;
+
+    /**
+    :returns Pong: Instance of Pong
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x7abe77ec;
+        this.SUBCLASS_OF_ID = 0x816aee71;
+
+        this.pingId = args.pingId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ec77be7a","hex"),
+            readBufferFromBigInt(this.pingId,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _ping_id;
+        let _x;
+        let len;
+        _ping_id = reader.readLong();
+        return new this({pingId:_ping_id})
+    }
+}
+
+
+class PingDelayDisconnectRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf3427b8c;
+    static SUBCLASS_OF_ID = 0x816aee71;
+
+    /**
+    :returns Pong: Instance of Pong
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf3427b8c;
+        this.SUBCLASS_OF_ID = 0x816aee71;
+
+        this.pingId = args.pingId;
+        this.disconnectDelay = args.disconnectDelay;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8c7b42f3","hex"),
+            readBufferFromBigInt(this.pingId,8,true,true),
+            struct.pack('<i', this.disconnectDelay),
+            ])
+        }
+    static fromReader(reader) {
+        let _ping_id;
+        let _disconnect_delay;
+        let _x;
+        let len;
+        _ping_id = reader.readLong();
+        _disconnect_delay = reader.readInt();
+        return new this({pingId:_ping_id,
+	disconnectDelay:_disconnect_delay})
+    }
+}
+
+
+class DestroySessionRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe7512126;
+    static SUBCLASS_OF_ID = 0xaf0ce7bd;
+
+    /**
+    :returns DestroySessionRes: Instance of either DestroySessionOk, DestroySessionNone
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe7512126;
+        this.SUBCLASS_OF_ID = 0xaf0ce7bd;
+
+        this.sessionId = args.sessionId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("262151e7","hex"),
+            readBufferFromBigInt(this.sessionId,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _session_id;
+        let _x;
+        let len;
+        _session_id = reader.readLong();
+        return new this({sessionId:_session_id})
+    }
+}
+
+module.exports = {
+    InvokeAfterMsgRequest,
+    InvokeAfterMsgsRequest,
+    InitConnectionRequest,
+    InvokeWithLayerRequest,
+    InvokeWithoutUpdatesRequest,
+    InvokeWithMessagesRangeRequest,
+    InvokeWithTakeoutRequest,
+    ReqPqRequest,
+    ReqPqMultiRequest,
+    ReqDHParamsRequest,
+    SetClientDHParamsRequest,
+    DestroyAuthKeyRequest,
+    RpcDropAnswerRequest,
+    GetFutureSaltsRequest,
+    PingRequest,
+    PingDelayDisconnectRequest,
+    DestroySessionRequest,
+};
+let auth = require('./auth');
+let account = require('./account');
+let users = require('./users');
+let contacts = require('./contacts');
+let messages = require('./messages');
+let updates = require('./updates');
+let photos = require('./photos');
+let upload = require('./upload');
+let help = require('./help');
+let channels = require('./channels');
+let bots = require('./bots');
+let payments = require('./payments');
+let stickers = require('./stickers');
+let phone = require('./phone');
+let langpack = require('./langpack');
+let folders = require('./folders');
+module.exports.auth = auth;
+module.exports.account = account;
+module.exports.users = users;
+module.exports.contacts = contacts;
+module.exports.messages = messages;
+module.exports.updates = updates;
+module.exports.photos = photos;
+module.exports.upload = upload;
+module.exports.help = help;
+module.exports.channels = channels;
+module.exports.bots = bots;
+module.exports.payments = payments;
+module.exports.stickers = stickers;
+module.exports.phone = phone;
+module.exports.langpack = langpack;
+module.exports.folders = folders;

+ 205 - 0
src/lib/gramjs/tl/functions/langpack.js

@@ -0,0 +1,205 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class GetLangPackRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf2f2330a;
+    static SUBCLASS_OF_ID = 0x52662d55;
+
+    /**
+    :returns LangPackDifference: Instance of LangPackDifference
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf2f2330a;
+        this.SUBCLASS_OF_ID = 0x52662d55;
+
+        this.langPack = args.langPack;
+        this.langCode = args.langCode;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0a33f2f2","hex"),
+            TLObject.serializeBytes(this.langPack),
+            TLObject.serializeBytes(this.langCode),
+            ])
+        }
+    static fromReader(reader) {
+        let _lang_pack;
+        let _lang_code;
+        let _x;
+        let len;
+        _lang_pack = reader.tgReadString();
+        _lang_code = reader.tgReadString();
+        return new this({langPack:_lang_pack,
+	langCode:_lang_code})
+    }
+}
+
+
+class GetStringsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xefea3803;
+    static SUBCLASS_OF_ID = 0xc7b7353d;
+
+    /**
+    :returns Vector<LangPackString>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xefea3803;
+        this.SUBCLASS_OF_ID = 0xc7b7353d;
+
+        this.langPack = args.langPack;
+        this.langCode = args.langCode;
+        this.keys = args.keys;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0338eaef","hex"),
+            TLObject.serializeBytes(this.langPack),
+            TLObject.serializeBytes(this.langCode),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.keys.length),Buffer.concat(this.keys.map(x => TLObject.serializeBytes(x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _lang_pack;
+        let _lang_code;
+        let _keys;
+        let _x;
+        let len;
+        _lang_pack = reader.tgReadString();
+        _lang_code = reader.tgReadString();
+        reader.readInt();
+        _keys = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadString();
+            _keys.push(_x);
+            }
+            return new this({langPack:_lang_pack,
+	langCode:_lang_code,
+	keys:_keys})
+        }
+    }
+
+
+class GetDifferenceRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xcd984aa5;
+    static SUBCLASS_OF_ID = 0x52662d55;
+
+    /**
+    :returns LangPackDifference: Instance of LangPackDifference
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xcd984aa5;
+        this.SUBCLASS_OF_ID = 0x52662d55;
+
+        this.langPack = args.langPack;
+        this.langCode = args.langCode;
+        this.fromVersion = args.fromVersion;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a54a98cd","hex"),
+            TLObject.serializeBytes(this.langPack),
+            TLObject.serializeBytes(this.langCode),
+            struct.pack('<i', this.fromVersion),
+            ])
+        }
+    static fromReader(reader) {
+        let _lang_pack;
+        let _lang_code;
+        let _from_version;
+        let _x;
+        let len;
+        _lang_pack = reader.tgReadString();
+        _lang_code = reader.tgReadString();
+        _from_version = reader.readInt();
+        return new this({langPack:_lang_pack,
+	langCode:_lang_code,
+	fromVersion:_from_version})
+    }
+}
+
+
+class GetLanguagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x42c6978f;
+    static SUBCLASS_OF_ID = 0x280912c9;
+
+    /**
+    :returns Vector<LangPackLanguage>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x42c6978f;
+        this.SUBCLASS_OF_ID = 0x280912c9;
+
+        this.langPack = args.langPack;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8f97c642","hex"),
+            TLObject.serializeBytes(this.langPack),
+            ])
+        }
+    static fromReader(reader) {
+        let _lang_pack;
+        let _x;
+        let len;
+        _lang_pack = reader.tgReadString();
+        return new this({langPack:_lang_pack})
+    }
+}
+
+
+class GetLanguageRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x6a596502;
+    static SUBCLASS_OF_ID = 0xabac89b7;
+
+    /**
+    :returns LangPackLanguage: Instance of LangPackLanguage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x6a596502;
+        this.SUBCLASS_OF_ID = 0xabac89b7;
+
+        this.langPack = args.langPack;
+        this.langCode = args.langCode;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0265596a","hex"),
+            TLObject.serializeBytes(this.langPack),
+            TLObject.serializeBytes(this.langCode),
+            ])
+        }
+    static fromReader(reader) {
+        let _lang_pack;
+        let _lang_code;
+        let _x;
+        let len;
+        _lang_pack = reader.tgReadString();
+        _lang_code = reader.tgReadString();
+        return new this({langPack:_lang_pack,
+	langCode:_lang_code})
+    }
+}
+
+module.exports = {
+    GetLangPackRequest,
+    GetStringsRequest,
+    GetDifferenceRequest,
+    GetLanguagesRequest,
+    GetLanguageRequest,
+};

+ 5464 - 0
src/lib/gramjs/tl/functions/messages.js

@@ -0,0 +1,5464 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const {InputPeerEmpty} = require("../types")
+const { readBigIntFromBuffer,
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class GetMessagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x63c66506;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x63c66506;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        const _tmp = [];for (const _x of this.id) {
+            _tmp.push(utils.getInputMessage(_x));
+        }
+        this.id = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0665c663","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _id.push(_x);
+            }
+            return new this({id:_id})
+        }
+    }
+
+
+class GetDialogsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa0ee3b73;
+    static SUBCLASS_OF_ID = 0xe1b52ee;
+
+    /**
+    :returns messages.Dialogs: Instance of either Dialogs, DialogsSlice, DialogsNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa0ee3b73;
+        this.SUBCLASS_OF_ID = 0xe1b52ee;
+
+        this.excludePinned = args.excludePinned || null;
+        this.folderId = args.folderId || null;
+        this.offsetDate = args.offsetDate;
+        this.offsetId = args.offsetId;
+        this.offsetPeer = args.offsetPeer || new InputPeerEmpty();
+        this.limit = args.limit;
+        this.hash = args.hash;
+    }
+    async resolve(client, utils) {
+        this.offset_peer = utils.getInputPeer(await client.getInputEntity(this.offsetPeer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("733beea0","hex"),
+            struct.pack('<I', (this.excludePinned === undefined || this.excludePinned === false || this.excludePinned === null) ? 0 : 1 | (this.folderId === undefined || this.folderId === false || this.folderId === null) ? 0 : 2),
+            (this.folderId === undefined || this.folderId === false || this.folderId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.folderId)],
+            struct.pack('<i', this.offsetDate),
+            struct.pack('<i', this.offsetId),
+            this.offsetPeer.getBytes(),
+            struct.pack('<i', this.limit),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _exclude_pinned;
+        let _folder_id;
+        let _offset_date;
+        let _offset_id;
+        let _offset_peer;
+        let _limit;
+        let _hash;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _exclude_pinned = Boolean(flags & 1);
+        if (flags & 2) {
+            _folder_id = reader.readInt();
+        }
+        else {
+            _folder_id = null
+        }
+        _offset_date = reader.readInt();
+        _offset_id = reader.readInt();
+        _offset_peer = reader.tgReadObject();
+        _limit = reader.readInt();
+        _hash = reader.readInt();
+        return new this({excludePinned:_exclude_pinned,
+	folderId:_folder_id,
+	offsetDate:_offset_date,
+	offsetId:_offset_id,
+	offsetPeer:_offset_peer,
+	limit:_limit,
+	hash:_hash})
+    }
+}
+
+
+class GetHistoryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xdcbb8260;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xdcbb8260;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.peer = args.peer;
+        this.offsetId = args.offsetId;
+        this.offsetDate = args.offsetDate;
+        this.addOffset = args.addOffset;
+        this.limit = args.limit;
+        this.maxId = args.maxId;
+        this.minId = args.minId;
+        this.hash = args.hash;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6082bbdc","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.offsetId),
+            struct.pack('<i', this.offsetDate),
+            struct.pack('<i', this.addOffset),
+            struct.pack('<i', this.limit),
+            struct.pack('<i', this.maxId),
+            struct.pack('<i', this.minId),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _offset_id;
+        let _offset_date;
+        let _add_offset;
+        let _limit;
+        let _max_id;
+        let _min_id;
+        let _hash;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _offset_id = reader.readInt();
+        _offset_date = reader.readInt();
+        _add_offset = reader.readInt();
+        _limit = reader.readInt();
+        _max_id = reader.readInt();
+        _min_id = reader.readInt();
+        _hash = reader.readInt();
+        return new this({peer:_peer,
+	offsetId:_offset_id,
+	offsetDate:_offset_date,
+	addOffset:_add_offset,
+	limit:_limit,
+	maxId:_max_id,
+	minId:_min_id,
+	hash:_hash})
+    }
+}
+
+
+class SearchRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8614ef68;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8614ef68;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.peer = args.peer;
+        this.q = args.q;
+        this.fromId = args.fromId || null;
+        this.filter = args.filter;
+        this.minDate = args.minDate;
+        this.maxDate = args.maxDate;
+        this.offsetId = args.offsetId;
+        this.addOffset = args.addOffset;
+        this.limit = args.limit;
+        this.maxId = args.maxId;
+        this.minId = args.minId;
+        this.hash = args.hash;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+        if (this.fromId) {
+            this.from_id = utils.getInputUser(await client.getInputEntity(this.fromId))
+        }
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("68ef1486","hex"),
+            struct.pack('<I', (this.fromId === undefined || this.fromId === false || this.fromId === null) ? 0 : 1),
+            this.peer.getBytes(),
+            TLObject.serializeBytes(this.q),
+            (this.fromId === undefined || this.fromId === false || this.fromId ===null) ? Buffer.alloc(0) : [this.fromId.getBytes()],
+            this.filter.getBytes(),
+            struct.pack('<i', this.minDate),
+            struct.pack('<i', this.maxDate),
+            struct.pack('<i', this.offsetId),
+            struct.pack('<i', this.addOffset),
+            struct.pack('<i', this.limit),
+            struct.pack('<i', this.maxId),
+            struct.pack('<i', this.minId),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _peer;
+        let _q;
+        let _from_id;
+        let _filter;
+        let _min_date;
+        let _max_date;
+        let _offset_id;
+        let _add_offset;
+        let _limit;
+        let _max_id;
+        let _min_id;
+        let _hash;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _peer = reader.tgReadObject();
+        _q = reader.tgReadString();
+        if (flags & 1) {
+            _from_id = reader.tgReadObject();
+        }
+        else {
+            _from_id = null
+        }
+        _filter = reader.tgReadObject();
+        _min_date = reader.readInt();
+        _max_date = reader.readInt();
+        _offset_id = reader.readInt();
+        _add_offset = reader.readInt();
+        _limit = reader.readInt();
+        _max_id = reader.readInt();
+        _min_id = reader.readInt();
+        _hash = reader.readInt();
+        return new this({peer:_peer,
+	q:_q,
+	fromId:_from_id,
+	filter:_filter,
+	minDate:_min_date,
+	maxDate:_max_date,
+	offsetId:_offset_id,
+	addOffset:_add_offset,
+	limit:_limit,
+	maxId:_max_id,
+	minId:_min_id,
+	hash:_hash})
+    }
+}
+
+
+class ReadHistoryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x0e306d3a;
+    static SUBCLASS_OF_ID = 0xced3c06e;
+
+    /**
+    :returns messages.AffectedMessages: Instance of AffectedMessages
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x0e306d3a;
+        this.SUBCLASS_OF_ID = 0xced3c06e;
+
+        this.peer = args.peer;
+        this.maxId = args.maxId;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3a6d300e","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.maxId),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _max_id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _max_id = reader.readInt();
+        return new this({peer:_peer,
+	maxId:_max_id})
+    }
+}
+
+
+class DeleteHistoryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1c015b09;
+    static SUBCLASS_OF_ID = 0x2c49c116;
+
+    /**
+    :returns messages.AffectedHistory: Instance of AffectedHistory
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1c015b09;
+        this.SUBCLASS_OF_ID = 0x2c49c116;
+
+        this.justClear = args.justClear || null;
+        this.revoke = args.revoke || null;
+        this.peer = args.peer;
+        this.maxId = args.maxId;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("095b011c","hex"),
+            struct.pack('<I', (this.justClear === undefined || this.justClear === false || this.justClear === null) ? 0 : 1 | (this.revoke === undefined || this.revoke === false || this.revoke === null) ? 0 : 2),
+            this.peer.getBytes(),
+            struct.pack('<i', this.maxId),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _just_clear;
+        let _revoke;
+        let _peer;
+        let _max_id;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _just_clear = Boolean(flags & 1);
+        _revoke = Boolean(flags & 2);
+        _peer = reader.tgReadObject();
+        _max_id = reader.readInt();
+        return new this({justClear:_just_clear,
+	revoke:_revoke,
+	peer:_peer,
+	maxId:_max_id})
+    }
+}
+
+
+class DeleteMessagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe58e95d2;
+    static SUBCLASS_OF_ID = 0xced3c06e;
+
+    /**
+    :returns messages.AffectedMessages: Instance of AffectedMessages
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe58e95d2;
+        this.SUBCLASS_OF_ID = 0xced3c06e;
+
+        this.revoke = args.revoke || null;
+        this.id = args.id;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d2958ee5","hex"),
+            struct.pack('<I', (this.revoke === undefined || this.revoke === false || this.revoke === null) ? 0 : 1),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _revoke;
+        let _id;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _revoke = Boolean(flags & 1);
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            return new this({revoke:_revoke,
+	id:_id})
+        }
+    }
+
+
+class ReceivedMessagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x05a954c0;
+    static SUBCLASS_OF_ID = 0x8565f897;
+
+    /**
+    :returns Vector<ReceivedNotifyMessage>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x05a954c0;
+        this.SUBCLASS_OF_ID = 0x8565f897;
+
+        this.maxId = args.maxId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c054a905","hex"),
+            struct.pack('<i', this.maxId),
+            ])
+        }
+    static fromReader(reader) {
+        let _max_id;
+        let _x;
+        let len;
+        _max_id = reader.readInt();
+        return new this({maxId:_max_id})
+    }
+}
+
+
+class SetTypingRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa3825e50;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa3825e50;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+        this.action = args.action;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("505e82a3","hex"),
+            this.peer.getBytes(),
+            this.action.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _action;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _action = reader.tgReadObject();
+        return new this({peer:_peer,
+	action:_action})
+    }
+}
+
+
+class SendMessageRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x520c3870;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x520c3870;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.noWebpage = args.noWebpage || null;
+        this.silent = args.silent || null;
+        this.background = args.background || null;
+        this.clearDraft = args.clearDraft || null;
+        this.peer = args.peer;
+        this.replyToMsgId = args.replyToMsgId || null;
+        this.message = args.message;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
+        this.replyMarkup = args.replyMarkup || null;
+        this.entities = args.entities || null;
+        this.scheduleDate = args.scheduleDate || null;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("70380c52","hex"),
+            struct.pack('<I', (this.noWebpage === undefined || this.noWebpage === false || this.noWebpage === null) ? 0 : 2 | (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.clearDraft === undefined || this.clearDraft === false || this.clearDraft === null) ? 0 : 128 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup === null) ? 0 : 4 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
+            this.peer.getBytes(),
+            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
+            TLObject.serializeBytes(this.message),
+            readBufferFromBigInt(this.randomId,8,true,true),
+            (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup ===null) ? Buffer.alloc(0) : [this.replyMarkup.getBytes()],
+            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
+            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _no_webpage;
+        let _silent;
+        let _background;
+        let _clear_draft;
+        let _peer;
+        let _reply_to_msg_id;
+        let _message;
+        let _random_id;
+        let _reply_markup;
+        let _entities;
+        let _schedule_date;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _no_webpage = Boolean(flags & 2);
+        _silent = Boolean(flags & 32);
+        _background = Boolean(flags & 64);
+        _clear_draft = Boolean(flags & 128);
+        _peer = reader.tgReadObject();
+        if (flags & 1) {
+            _reply_to_msg_id = reader.readInt();
+        }
+        else {
+            _reply_to_msg_id = null
+        }
+        _message = reader.tgReadString();
+        _random_id = reader.readLong();
+        if (flags & 4) {
+            _reply_markup = reader.tgReadObject();
+        }
+        else {
+            _reply_markup = null
+        }
+        if (flags & 8) {
+            reader.readInt();
+            _entities = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _entities.push(_x);
+                }
+            }
+            else {
+                _entities = null
+            }
+            if (flags & 1024) {
+                _schedule_date = reader.readInt();
+            }
+            else {
+                _schedule_date = null
+            }
+            return new this({noWebpage:_no_webpage,
+	silent:_silent,
+	background:_background,
+	clearDraft:_clear_draft,
+	peer:_peer,
+	replyToMsgId:_reply_to_msg_id,
+	message:_message,
+	randomId:_random_id,
+	replyMarkup:_reply_markup,
+	entities:_entities,
+	scheduleDate:_schedule_date})
+        }
+    }
+
+
+class SendMediaRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3491eba9;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3491eba9;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.silent = args.silent || null;
+        this.background = args.background || null;
+        this.clearDraft = args.clearDraft || null;
+        this.peer = args.peer;
+        this.replyToMsgId = args.replyToMsgId || null;
+        this.media = args.media;
+        this.message = args.message;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
+        this.replyMarkup = args.replyMarkup || null;
+        this.entities = args.entities || null;
+        this.scheduleDate = args.scheduleDate || null;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+        this.media = utils.getInputMedia(this.media)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a9eb9134","hex"),
+            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.clearDraft === undefined || this.clearDraft === false || this.clearDraft === null) ? 0 : 128 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup === null) ? 0 : 4 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
+            this.peer.getBytes(),
+            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
+            this.media.getBytes(),
+            TLObject.serializeBytes(this.message),
+            readBufferFromBigInt(this.randomId,8,true,true),
+            (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup ===null) ? Buffer.alloc(0) : [this.replyMarkup.getBytes()],
+            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
+            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _silent;
+        let _background;
+        let _clear_draft;
+        let _peer;
+        let _reply_to_msg_id;
+        let _media;
+        let _message;
+        let _random_id;
+        let _reply_markup;
+        let _entities;
+        let _schedule_date;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _silent = Boolean(flags & 32);
+        _background = Boolean(flags & 64);
+        _clear_draft = Boolean(flags & 128);
+        _peer = reader.tgReadObject();
+        if (flags & 1) {
+            _reply_to_msg_id = reader.readInt();
+        }
+        else {
+            _reply_to_msg_id = null
+        }
+        _media = reader.tgReadObject();
+        _message = reader.tgReadString();
+        _random_id = reader.readLong();
+        if (flags & 4) {
+            _reply_markup = reader.tgReadObject();
+        }
+        else {
+            _reply_markup = null
+        }
+        if (flags & 8) {
+            reader.readInt();
+            _entities = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _entities.push(_x);
+                }
+            }
+            else {
+                _entities = null
+            }
+            if (flags & 1024) {
+                _schedule_date = reader.readInt();
+            }
+            else {
+                _schedule_date = null
+            }
+            return new this({silent:_silent,
+	background:_background,
+	clearDraft:_clear_draft,
+	peer:_peer,
+	replyToMsgId:_reply_to_msg_id,
+	media:_media,
+	message:_message,
+	randomId:_random_id,
+	replyMarkup:_reply_markup,
+	entities:_entities,
+	scheduleDate:_schedule_date})
+        }
+    }
+
+
+class ForwardMessagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd9fee60e;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd9fee60e;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.silent = args.silent || null;
+        this.background = args.background || null;
+        this.withMyScore = args.withMyScore || null;
+        this.grouped = args.grouped || null;
+        this.fromPeer = args.fromPeer;
+        this.id = args.id;
+        this.randomId = args.randomId !== undefined ? args.randomId : new Array(id.length).fill().map(_ => readBigIntFromBuffer(generateRandomBytes(8),false,true));
+        this.toPeer = args.toPeer;
+        this.scheduleDate = args.scheduleDate || null;
+    }
+    async resolve(client, utils) {
+        this.from_peer = utils.getInputPeer(await client.getInputEntity(this.fromPeer))
+        this.to_peer = utils.getInputPeer(await client.getInputEntity(this.toPeer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0ee6fed9","hex"),
+            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.withMyScore === undefined || this.withMyScore === false || this.withMyScore === null) ? 0 : 256 | (this.grouped === undefined || this.grouped === false || this.grouped === null) ? 0 : 512 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
+            this.fromPeer.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.randomId.length),Buffer.concat(this.randomId.map(x => readBufferFromBigInt(x,8,true,true))),
+            this.toPeer.getBytes(),
+            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _silent;
+        let _background;
+        let _with_my_score;
+        let _grouped;
+        let _from_peer;
+        let _id;
+        let _random_id;
+        let _to_peer;
+        let _schedule_date;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _silent = Boolean(flags & 32);
+        _background = Boolean(flags & 64);
+        _with_my_score = Boolean(flags & 256);
+        _grouped = Boolean(flags & 512);
+        _from_peer = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            reader.readInt();
+            _random_id = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.readLong();
+                _random_id.push(_x);
+                }
+                _to_peer = reader.tgReadObject();
+                if (flags & 1024) {
+                    _schedule_date = reader.readInt();
+                }
+                else {
+                    _schedule_date = null
+                }
+                return new this({silent:_silent,
+	background:_background,
+	withMyScore:_with_my_score,
+	grouped:_grouped,
+	fromPeer:_from_peer,
+	id:_id,
+	randomId:_random_id,
+	toPeer:_to_peer,
+	scheduleDate:_schedule_date})
+            }
+        }
+
+
+class ReportSpamRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xcf1592db;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xcf1592db;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("db9215cf","hex"),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        return new this({peer:_peer})
+    }
+}
+
+
+class GetPeerSettingsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3672e09c;
+    static SUBCLASS_OF_ID = 0xf6a79f84;
+
+    /**
+    :returns PeerSettings: Instance of PeerSettings
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3672e09c;
+        this.SUBCLASS_OF_ID = 0xf6a79f84;
+
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9ce07236","hex"),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        return new this({peer:_peer})
+    }
+}
+
+
+class ReportRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbd82b658;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbd82b658;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+        this.id = args.id;
+        this.reason = args.reason;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("58b682bd","hex"),
+            this.peer.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            this.reason.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _id;
+        let _reason;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            _reason = reader.tgReadObject();
+            return new this({peer:_peer,
+	id:_id,
+	reason:_reason})
+        }
+    }
+
+
+class GetChatsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3c6aa187;
+    static SUBCLASS_OF_ID = 0x99d5cb14;
+
+    /**
+    :returns messages.Chats: Instance of either Chats, ChatsSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3c6aa187;
+        this.SUBCLASS_OF_ID = 0x99d5cb14;
+
+        this.id = args.id;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("87a16a3c","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            return new this({id:_id})
+        }
+    }
+
+
+class GetFullChatRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3b831c66;
+    static SUBCLASS_OF_ID = 0x225a5109;
+
+    /**
+    :returns messages.ChatFull: Instance of ChatFull
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3b831c66;
+        this.SUBCLASS_OF_ID = 0x225a5109;
+
+        this.chatId = args.chatId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("661c833b","hex"),
+            struct.pack('<i', this.chatId),
+            ])
+        }
+    static fromReader(reader) {
+        let _chat_id;
+        let _x;
+        let len;
+        _chat_id = reader.readInt();
+        return new this({chatId:_chat_id})
+    }
+}
+
+
+class EditChatTitleRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xdc452855;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xdc452855;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.chatId = args.chatId;
+        this.title = args.title;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("552845dc","hex"),
+            struct.pack('<i', this.chatId),
+            TLObject.serializeBytes(this.title),
+            ])
+        }
+    static fromReader(reader) {
+        let _chat_id;
+        let _title;
+        let _x;
+        let len;
+        _chat_id = reader.readInt();
+        _title = reader.tgReadString();
+        return new this({chatId:_chat_id,
+	title:_title})
+    }
+}
+
+
+class EditChatPhotoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xca4c79d8;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xca4c79d8;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.chatId = args.chatId;
+        this.photo = args.photo;
+    }
+    async resolve(client, utils) {
+        this.chat_id = await client.getPeerId(this.chatId, add_mark=False)
+        this.photo = utils.getInputChatPhoto(this.photo)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d8794cca","hex"),
+            struct.pack('<i', this.chatId),
+            this.photo.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _chat_id;
+        let _photo;
+        let _x;
+        let len;
+        _chat_id = reader.readInt();
+        _photo = reader.tgReadObject();
+        return new this({chatId:_chat_id,
+	photo:_photo})
+    }
+}
+
+
+class AddChatUserRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf9a0aa09;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf9a0aa09;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.chatId = args.chatId;
+        this.userId = args.userId;
+        this.fwdLimit = args.fwdLimit;
+    }
+    async resolve(client, utils) {
+        this.chat_id = await client.getPeerId(this.chatId, add_mark=False)
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("09aaa0f9","hex"),
+            struct.pack('<i', this.chatId),
+            this.userId.getBytes(),
+            struct.pack('<i', this.fwdLimit),
+            ])
+        }
+    static fromReader(reader) {
+        let _chat_id;
+        let _user_id;
+        let _fwd_limit;
+        let _x;
+        let len;
+        _chat_id = reader.readInt();
+        _user_id = reader.tgReadObject();
+        _fwd_limit = reader.readInt();
+        return new this({chatId:_chat_id,
+	userId:_user_id,
+	fwdLimit:_fwd_limit})
+    }
+}
+
+
+class DeleteChatUserRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe0611f16;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe0611f16;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.chatId = args.chatId;
+        this.userId = args.userId;
+    }
+    async resolve(client, utils) {
+        this.chat_id = await client.getPeerId(this.chatId, add_mark=False)
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("161f61e0","hex"),
+            struct.pack('<i', this.chatId),
+            this.userId.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _chat_id;
+        let _user_id;
+        let _x;
+        let len;
+        _chat_id = reader.readInt();
+        _user_id = reader.tgReadObject();
+        return new this({chatId:_chat_id,
+	userId:_user_id})
+    }
+}
+
+
+class CreateChatRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x09cb126e;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x09cb126e;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.users = args.users;
+        this.title = args.title;
+    }
+    async resolve(client, utils) {
+        const _tmp = [];for (const _x of this.users) {
+            _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
+        }
+        this.users = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6e12cb09","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            TLObject.serializeBytes(this.title),
+            ])
+        }
+    static fromReader(reader) {
+        let _users;
+        let _title;
+        let _x;
+        let len;
+        reader.readInt();
+        _users = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _users.push(_x);
+            }
+            _title = reader.tgReadString();
+            return new this({users:_users,
+	title:_title})
+        }
+    }
+
+
+class GetDhConfigRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x26cf8950;
+    static SUBCLASS_OF_ID = 0xe488ed8b;
+
+    /**
+    :returns messages.DhConfig: Instance of either DhConfigNotModified, DhConfig
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x26cf8950;
+        this.SUBCLASS_OF_ID = 0xe488ed8b;
+
+        this.version = args.version;
+        this.randomLength = args.randomLength;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5089cf26","hex"),
+            struct.pack('<i', this.version),
+            struct.pack('<i', this.randomLength),
+            ])
+        }
+    static fromReader(reader) {
+        let _version;
+        let _random_length;
+        let _x;
+        let len;
+        _version = reader.readInt();
+        _random_length = reader.readInt();
+        return new this({version:_version,
+	randomLength:_random_length})
+    }
+}
+
+
+class RequestEncryptionRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf64daf43;
+    static SUBCLASS_OF_ID = 0x6d28a37a;
+
+    /**
+    :returns EncryptedChat: Instance of either EncryptedChatEmpty, EncryptedChatWaiting, EncryptedChatRequested, EncryptedChat, EncryptedChatDiscarded
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf64daf43;
+        this.SUBCLASS_OF_ID = 0x6d28a37a;
+
+        this.userId = args.userId;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(4),false,true);
+        this.gA = args.gA;
+    }
+    async resolve(client, utils) {
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("43af4df6","hex"),
+            this.userId.getBytes(),
+            struct.pack('<i', this.randomId),
+            TLObject.serializeBytes(this.gA),
+            ])
+        }
+    static fromReader(reader) {
+        let _user_id;
+        let _random_id;
+        let _g_a;
+        let _x;
+        let len;
+        _user_id = reader.tgReadObject();
+        _random_id = reader.readInt();
+        _g_a = reader.tgReadBytes();
+        return new this({userId:_user_id,
+	randomId:_random_id,
+	gA:_g_a})
+    }
+}
+
+
+class AcceptEncryptionRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3dbc0415;
+    static SUBCLASS_OF_ID = 0x6d28a37a;
+
+    /**
+    :returns EncryptedChat: Instance of either EncryptedChatEmpty, EncryptedChatWaiting, EncryptedChatRequested, EncryptedChat, EncryptedChatDiscarded
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3dbc0415;
+        this.SUBCLASS_OF_ID = 0x6d28a37a;
+
+        this.peer = args.peer;
+        this.gB = args.gB;
+        this.keyFingerprint = args.keyFingerprint;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1504bc3d","hex"),
+            this.peer.getBytes(),
+            TLObject.serializeBytes(this.gB),
+            readBufferFromBigInt(this.keyFingerprint,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _g_b;
+        let _key_fingerprint;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _g_b = reader.tgReadBytes();
+        _key_fingerprint = reader.readLong();
+        return new this({peer:_peer,
+	gB:_g_b,
+	keyFingerprint:_key_fingerprint})
+    }
+}
+
+
+class DiscardEncryptionRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xedd923c5;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xedd923c5;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.chatId = args.chatId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c523d9ed","hex"),
+            struct.pack('<i', this.chatId),
+            ])
+        }
+    static fromReader(reader) {
+        let _chat_id;
+        let _x;
+        let len;
+        _chat_id = reader.readInt();
+        return new this({chatId:_chat_id})
+    }
+}
+
+
+class SetEncryptedTypingRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x791451ed;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x791451ed;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+        this.typing = args.typing;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ed511479","hex"),
+            this.peer.getBytes(),
+            this.typing ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _typing;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _typing = reader.tgReadBool();
+        return new this({peer:_peer,
+	typing:_typing})
+    }
+}
+
+
+class ReadEncryptedHistoryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x7f4b690a;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x7f4b690a;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+        this.maxDate = args.maxDate;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0a694b7f","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.maxDate),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _max_date;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _max_date = reader.readInt();
+        return new this({peer:_peer,
+	maxDate:_max_date})
+    }
+}
+
+
+class SendEncryptedRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa9776773;
+    static SUBCLASS_OF_ID = 0xc99e3e50;
+
+    /**
+    :returns messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa9776773;
+        this.SUBCLASS_OF_ID = 0xc99e3e50;
+
+        this.peer = args.peer;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
+        this.data = args.data;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("736777a9","hex"),
+            this.peer.getBytes(),
+            readBufferFromBigInt(this.randomId,8,true,true),
+            TLObject.serializeBytes(this.data),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _random_id;
+        let _data;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _random_id = reader.readLong();
+        _data = reader.tgReadBytes();
+        return new this({peer:_peer,
+	randomId:_random_id,
+	data:_data})
+    }
+}
+
+
+class SendEncryptedFileRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x9a901b66;
+    static SUBCLASS_OF_ID = 0xc99e3e50;
+
+    /**
+    :returns messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x9a901b66;
+        this.SUBCLASS_OF_ID = 0xc99e3e50;
+
+        this.peer = args.peer;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
+        this.data = args.data;
+        this.file = args.file;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("661b909a","hex"),
+            this.peer.getBytes(),
+            readBufferFromBigInt(this.randomId,8,true,true),
+            TLObject.serializeBytes(this.data),
+            this.file.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _random_id;
+        let _data;
+        let _file;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _random_id = reader.readLong();
+        _data = reader.tgReadBytes();
+        _file = reader.tgReadObject();
+        return new this({peer:_peer,
+	randomId:_random_id,
+	data:_data,
+	file:_file})
+    }
+}
+
+
+class SendEncryptedServiceRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x32d439a4;
+    static SUBCLASS_OF_ID = 0xc99e3e50;
+
+    /**
+    :returns messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x32d439a4;
+        this.SUBCLASS_OF_ID = 0xc99e3e50;
+
+        this.peer = args.peer;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
+        this.data = args.data;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a439d432","hex"),
+            this.peer.getBytes(),
+            readBufferFromBigInt(this.randomId,8,true,true),
+            TLObject.serializeBytes(this.data),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _random_id;
+        let _data;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _random_id = reader.readLong();
+        _data = reader.tgReadBytes();
+        return new this({peer:_peer,
+	randomId:_random_id,
+	data:_data})
+    }
+}
+
+
+class ReceivedQueueRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x55a5bb66;
+    static SUBCLASS_OF_ID = 0x8918e168;
+
+    /**
+    :returns Vector<long>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x55a5bb66;
+        this.SUBCLASS_OF_ID = 0x8918e168;
+
+        this.maxQts = args.maxQts;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("66bba555","hex"),
+            struct.pack('<i', this.maxQts),
+            ])
+        }
+    static fromReader(reader) {
+        let _max_qts;
+        let _x;
+        let len;
+        _max_qts = reader.readInt();
+        return new this({maxQts:_max_qts})
+    }
+    readResult(reader){
+        reader.readInt();  // Vector ID
+        let temp = [];
+        let len = reader.readInt(); //fix this
+        for (let i=0;i<len;i++){
+            temp.push(reader.readLong())
+        }
+        return temp
+    }
+}
+
+
+class ReportEncryptedSpamRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x4b0c8c0f;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4b0c8c0f;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0f8c0c4b","hex"),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        return new this({peer:_peer})
+    }
+}
+
+
+class ReadMessageContentsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x36a73f77;
+    static SUBCLASS_OF_ID = 0xced3c06e;
+
+    /**
+    :returns messages.AffectedMessages: Instance of AffectedMessages
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x36a73f77;
+        this.SUBCLASS_OF_ID = 0xced3c06e;
+
+        this.id = args.id;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("773fa736","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            return new this({id:_id})
+        }
+    }
+
+
+class GetStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x043d4f2c;
+    static SUBCLASS_OF_ID = 0xd73bb9de;
+
+    /**
+    :returns messages.Stickers: Instance of either StickersNotModified, Stickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x043d4f2c;
+        this.SUBCLASS_OF_ID = 0xd73bb9de;
+
+        this.emoticon = args.emoticon;
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2c4f3d04","hex"),
+            TLObject.serializeBytes(this.emoticon),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _emoticon;
+        let _hash;
+        let _x;
+        let len;
+        _emoticon = reader.tgReadString();
+        _hash = reader.readInt();
+        return new this({emoticon:_emoticon,
+	hash:_hash})
+    }
+}
+
+
+class GetAllStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1c9618b1;
+    static SUBCLASS_OF_ID = 0x45834829;
+
+    /**
+    :returns messages.AllStickers: Instance of either AllStickersNotModified, AllStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1c9618b1;
+        this.SUBCLASS_OF_ID = 0x45834829;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b118961c","hex"),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        return new this({hash:_hash})
+    }
+}
+
+
+class GetWebPagePreviewRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8b68b0cc;
+    static SUBCLASS_OF_ID = 0x476cbe32;
+
+    /**
+    :returns MessageMedia: Instance of either MessageMediaEmpty, MessageMediaPhoto, MessageMediaGeo, MessageMediaContact, MessageMediaUnsupported, MessageMediaDocument, MessageMediaWebPage, MessageMediaVenue, MessageMediaGame, MessageMediaInvoice, MessageMediaGeoLive, MessageMediaPoll
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8b68b0cc;
+        this.SUBCLASS_OF_ID = 0x476cbe32;
+
+        this.message = args.message;
+        this.entities = args.entities || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ccb0688b","hex"),
+            struct.pack('<I', (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8),
+            TLObject.serializeBytes(this.message),
+            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _message;
+        let _entities;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _message = reader.tgReadString();
+        if (flags & 8) {
+            reader.readInt();
+            _entities = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _entities.push(_x);
+                }
+            }
+            else {
+                _entities = null
+            }
+            return new this({message:_message,
+	entities:_entities})
+        }
+    }
+
+
+class ExportChatInviteRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x0df7534c;
+    static SUBCLASS_OF_ID = 0xb4748a58;
+
+    /**
+    :returns ExportedChatInvite: Instance of either ChatInviteEmpty, ChatInviteExported
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x0df7534c;
+        this.SUBCLASS_OF_ID = 0xb4748a58;
+
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4c53f70d","hex"),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        return new this({peer:_peer})
+    }
+}
+
+
+class CheckChatInviteRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3eadb1bb;
+    static SUBCLASS_OF_ID = 0x4561736;
+
+    /**
+    :returns ChatInvite: Instance of either ChatInviteAlready, ChatInvite
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3eadb1bb;
+        this.SUBCLASS_OF_ID = 0x4561736;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bbb1ad3e","hex"),
+            TLObject.serializeBytes(this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.tgReadString();
+        return new this({hash:_hash})
+    }
+}
+
+
+class ImportChatInviteRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x6c50051c;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x6c50051c;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1c05506c","hex"),
+            TLObject.serializeBytes(this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.tgReadString();
+        return new this({hash:_hash})
+    }
+}
+
+
+class GetStickerSetRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2619a90e;
+    static SUBCLASS_OF_ID = 0x9b704a5a;
+
+    /**
+    :returns messages.StickerSet: Instance of StickerSet
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2619a90e;
+        this.SUBCLASS_OF_ID = 0x9b704a5a;
+
+        this.stickerset = args.stickerset;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0ea91926","hex"),
+            this.stickerset.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _stickerset;
+        let _x;
+        let len;
+        _stickerset = reader.tgReadObject();
+        return new this({stickerset:_stickerset})
+    }
+}
+
+
+class InstallStickerSetRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc78fe460;
+    static SUBCLASS_OF_ID = 0x67cb3fe8;
+
+    /**
+    :returns messages.StickerSetInstallResult: Instance of either StickerSetInstallResultSuccess, StickerSetInstallResultArchive
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc78fe460;
+        this.SUBCLASS_OF_ID = 0x67cb3fe8;
+
+        this.stickerset = args.stickerset;
+        this.archived = args.archived;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("60e48fc7","hex"),
+            this.stickerset.getBytes(),
+            this.archived ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _stickerset;
+        let _archived;
+        let _x;
+        let len;
+        _stickerset = reader.tgReadObject();
+        _archived = reader.tgReadBool();
+        return new this({stickerset:_stickerset,
+	archived:_archived})
+    }
+}
+
+
+class UninstallStickerSetRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf96e55de;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf96e55de;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.stickerset = args.stickerset;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("de556ef9","hex"),
+            this.stickerset.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _stickerset;
+        let _x;
+        let len;
+        _stickerset = reader.tgReadObject();
+        return new this({stickerset:_stickerset})
+    }
+}
+
+
+class StartBotRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe6df7378;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe6df7378;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.bot = args.bot;
+        this.peer = args.peer;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
+        this.startParam = args.startParam;
+    }
+    async resolve(client, utils) {
+        this.bot = utils.getInputUser(await client.getInputEntity(this.bot))
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("7873dfe6","hex"),
+            this.bot.getBytes(),
+            this.peer.getBytes(),
+            readBufferFromBigInt(this.randomId,8,true,true),
+            TLObject.serializeBytes(this.startParam),
+            ])
+        }
+    static fromReader(reader) {
+        let _bot;
+        let _peer;
+        let _random_id;
+        let _start_param;
+        let _x;
+        let len;
+        _bot = reader.tgReadObject();
+        _peer = reader.tgReadObject();
+        _random_id = reader.readLong();
+        _start_param = reader.tgReadString();
+        return new this({bot:_bot,
+	peer:_peer,
+	randomId:_random_id,
+	startParam:_start_param})
+    }
+}
+
+
+class GetMessagesViewsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc4c8a55d;
+    static SUBCLASS_OF_ID = 0x5026710f;
+
+    /**
+    :returns Vector<int>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc4c8a55d;
+        this.SUBCLASS_OF_ID = 0x5026710f;
+
+        this.peer = args.peer;
+        this.id = args.id;
+        this.increment = args.increment;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5da5c8c4","hex"),
+            this.peer.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            this.increment ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _id;
+        let _increment;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            _increment = reader.tgReadBool();
+            return new this({peer:_peer,
+	id:_id,
+	increment:_increment})
+        }
+        readResult(reader){
+            reader.readInt();  // Vector ID
+            let temp = [];
+            let len = reader.readInt(); //fix this
+            for (let i=0;i<len;i++){
+                temp.push(reader.readInt())
+            }
+            return temp
+        }
+    }
+
+
+class EditChatAdminRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa9e69f2e;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa9e69f2e;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.chatId = args.chatId;
+        this.userId = args.userId;
+        this.isAdmin = args.isAdmin;
+    }
+    async resolve(client, utils) {
+        this.chat_id = await client.getPeerId(this.chatId, add_mark=False)
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2e9fe6a9","hex"),
+            struct.pack('<i', this.chatId),
+            this.userId.getBytes(),
+            this.isAdmin ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _chat_id;
+        let _user_id;
+        let _is_admin;
+        let _x;
+        let len;
+        _chat_id = reader.readInt();
+        _user_id = reader.tgReadObject();
+        _is_admin = reader.tgReadBool();
+        return new this({chatId:_chat_id,
+	userId:_user_id,
+	isAdmin:_is_admin})
+    }
+}
+
+
+class MigrateChatRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x15a3b8e3;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x15a3b8e3;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.chatId = args.chatId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e3b8a315","hex"),
+            struct.pack('<i', this.chatId),
+            ])
+        }
+    static fromReader(reader) {
+        let _chat_id;
+        let _x;
+        let len;
+        _chat_id = reader.readInt();
+        return new this({chatId:_chat_id})
+    }
+}
+
+
+class SearchGlobalRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbf7225a4;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbf7225a4;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.folderId = args.folderId || null;
+        this.q = args.q;
+        this.offsetRate = args.offsetRate;
+        this.offsetPeer = args.offsetPeer;
+        this.offsetId = args.offsetId;
+        this.limit = args.limit;
+    }
+    async resolve(client, utils) {
+        this.offset_peer = utils.getInputPeer(await client.getInputEntity(this.offsetPeer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a42572bf","hex"),
+            struct.pack('<I', (this.folderId === undefined || this.folderId === false || this.folderId === null) ? 0 : 1),
+            (this.folderId === undefined || this.folderId === false || this.folderId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.folderId)],
+            TLObject.serializeBytes(this.q),
+            struct.pack('<i', this.offsetRate),
+            this.offsetPeer.getBytes(),
+            struct.pack('<i', this.offsetId),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _folder_id;
+        let _q;
+        let _offset_rate;
+        let _offset_peer;
+        let _offset_id;
+        let _limit;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        if (flags & 1) {
+            _folder_id = reader.readInt();
+        }
+        else {
+            _folder_id = null
+        }
+        _q = reader.tgReadString();
+        _offset_rate = reader.readInt();
+        _offset_peer = reader.tgReadObject();
+        _offset_id = reader.readInt();
+        _limit = reader.readInt();
+        return new this({folderId:_folder_id,
+	q:_q,
+	offsetRate:_offset_rate,
+	offsetPeer:_offset_peer,
+	offsetId:_offset_id,
+	limit:_limit})
+    }
+}
+
+
+class ReorderStickerSetsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x78337739;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x78337739;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.masks = args.masks || null;
+        this.order = args.order;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("39773378","hex"),
+            struct.pack('<I', (this.masks === undefined || this.masks === false || this.masks === null) ? 0 : 1),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.order.length),Buffer.concat(this.order.map(x => readBufferFromBigInt(x,8,true,true))),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _masks;
+        let _order;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _masks = Boolean(flags & 1);
+        reader.readInt();
+        _order = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readLong();
+            _order.push(_x);
+            }
+            return new this({masks:_masks,
+	order:_order})
+        }
+    }
+
+
+class GetDocumentByHashRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x338e2464;
+    static SUBCLASS_OF_ID = 0x211fe820;
+
+    /**
+    :returns Document: Instance of either DocumentEmpty, Document
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x338e2464;
+        this.SUBCLASS_OF_ID = 0x211fe820;
+
+        this.sha256 = args.sha256;
+        this.size = args.size;
+        this.mimeType = args.mimeType;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("64248e33","hex"),
+            TLObject.serializeBytes(this.sha256),
+            struct.pack('<i', this.size),
+            TLObject.serializeBytes(this.mimeType),
+            ])
+        }
+    static fromReader(reader) {
+        let _sha256;
+        let _size;
+        let _mime_type;
+        let _x;
+        let len;
+        _sha256 = reader.tgReadBytes();
+        _size = reader.readInt();
+        _mime_type = reader.tgReadString();
+        return new this({sha256:_sha256,
+	size:_size,
+	mimeType:_mime_type})
+    }
+}
+
+
+class SearchGifsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbf9a776b;
+    static SUBCLASS_OF_ID = 0xe799ea7;
+
+    /**
+    :returns messages.FoundGifs: Instance of FoundGifs
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbf9a776b;
+        this.SUBCLASS_OF_ID = 0xe799ea7;
+
+        this.q = args.q;
+        this.offset = args.offset;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6b779abf","hex"),
+            TLObject.serializeBytes(this.q),
+            struct.pack('<i', this.offset),
+            ])
+        }
+    static fromReader(reader) {
+        let _q;
+        let _offset;
+        let _x;
+        let len;
+        _q = reader.tgReadString();
+        _offset = reader.readInt();
+        return new this({q:_q,
+	offset:_offset})
+    }
+}
+
+
+class GetSavedGifsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x83bf3d52;
+    static SUBCLASS_OF_ID = 0xa68b61f5;
+
+    /**
+    :returns messages.SavedGifs: Instance of either SavedGifsNotModified, SavedGifs
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x83bf3d52;
+        this.SUBCLASS_OF_ID = 0xa68b61f5;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("523dbf83","hex"),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        return new this({hash:_hash})
+    }
+}
+
+
+class SaveGifRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x327a30cb;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x327a30cb;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.id = args.id;
+        this.unsave = args.unsave;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputDocument(this.id)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("cb307a32","hex"),
+            this.id.getBytes(),
+            this.unsave ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _unsave;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        _unsave = reader.tgReadBool();
+        return new this({id:_id,
+	unsave:_unsave})
+    }
+}
+
+
+class GetInlineBotResultsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x514e999d;
+    static SUBCLASS_OF_ID = 0x3ed4d9c9;
+
+    /**
+    :returns messages.BotResults: Instance of BotResults
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x514e999d;
+        this.SUBCLASS_OF_ID = 0x3ed4d9c9;
+
+        this.bot = args.bot;
+        this.peer = args.peer;
+        this.geoPoint = args.geoPoint || null;
+        this.query = args.query;
+        this.offset = args.offset;
+    }
+    async resolve(client, utils) {
+        this.bot = utils.getInputUser(await client.getInputEntity(this.bot))
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9d994e51","hex"),
+            struct.pack('<I', (this.geoPoint === undefined || this.geoPoint === false || this.geoPoint === null) ? 0 : 1),
+            this.bot.getBytes(),
+            this.peer.getBytes(),
+            (this.geoPoint === undefined || this.geoPoint === false || this.geoPoint ===null) ? Buffer.alloc(0) : [this.geoPoint.getBytes()],
+            TLObject.serializeBytes(this.query),
+            TLObject.serializeBytes(this.offset),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _bot;
+        let _peer;
+        let _geo_point;
+        let _query;
+        let _offset;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _bot = reader.tgReadObject();
+        _peer = reader.tgReadObject();
+        if (flags & 1) {
+            _geo_point = reader.tgReadObject();
+        }
+        else {
+            _geo_point = null
+        }
+        _query = reader.tgReadString();
+        _offset = reader.tgReadString();
+        return new this({bot:_bot,
+	peer:_peer,
+	geoPoint:_geo_point,
+	query:_query,
+	offset:_offset})
+    }
+}
+
+
+class SetInlineBotResultsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xeb5ea206;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xeb5ea206;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.gallery = args.gallery || null;
+        this.private = args.private || null;
+        this.queryId = args.queryId;
+        this.results = args.results;
+        this.cacheTime = args.cacheTime;
+        this.nextOffset = args.nextOffset || null;
+        this.switchPm = args.switchPm || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("06a25eeb","hex"),
+            struct.pack('<I', (this.gallery === undefined || this.gallery === false || this.gallery === null) ? 0 : 1 | (this.private === undefined || this.private === false || this.private === null) ? 0 : 2 | (this.nextOffset === undefined || this.nextOffset === false || this.nextOffset === null) ? 0 : 4 | (this.switchPm === undefined || this.switchPm === false || this.switchPm === null) ? 0 : 8),
+            readBufferFromBigInt(this.queryId,8,true,true),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.results.length),Buffer.concat(this.results.map(x => x.getBytes())),
+            struct.pack('<i', this.cacheTime),
+            (this.nextOffset === undefined || this.nextOffset === false || this.nextOffset ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.nextOffset)],
+            (this.switchPm === undefined || this.switchPm === false || this.switchPm ===null) ? Buffer.alloc(0) : [this.switchPm.getBytes()],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _gallery;
+        let _private;
+        let _query_id;
+        let _results;
+        let _cache_time;
+        let _next_offset;
+        let _switch_pm;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _gallery = Boolean(flags & 1);
+        _private = Boolean(flags & 2);
+        _query_id = reader.readLong();
+        reader.readInt();
+        _results = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _results.push(_x);
+            }
+            _cache_time = reader.readInt();
+            if (flags & 4) {
+                _next_offset = reader.tgReadString();
+            }
+            else {
+                _next_offset = null
+            }
+            if (flags & 8) {
+                _switch_pm = reader.tgReadObject();
+            }
+            else {
+                _switch_pm = null
+            }
+            return new this({gallery:_gallery,
+	private:_private,
+	queryId:_query_id,
+	results:_results,
+	cacheTime:_cache_time,
+	nextOffset:_next_offset,
+	switchPm:_switch_pm})
+        }
+    }
+
+
+class SendInlineBotResultRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x220815b0;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x220815b0;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.silent = args.silent || null;
+        this.background = args.background || null;
+        this.clearDraft = args.clearDraft || null;
+        this.hideVia = args.hideVia || null;
+        this.peer = args.peer;
+        this.replyToMsgId = args.replyToMsgId || null;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
+        this.queryId = args.queryId;
+        this.id = args.id;
+        this.scheduleDate = args.scheduleDate || null;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b0150822","hex"),
+            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.clearDraft === undefined || this.clearDraft === false || this.clearDraft === null) ? 0 : 128 | (this.hideVia === undefined || this.hideVia === false || this.hideVia === null) ? 0 : 2048 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
+            this.peer.getBytes(),
+            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
+            readBufferFromBigInt(this.randomId,8,true,true),
+            readBufferFromBigInt(this.queryId,8,true,true),
+            TLObject.serializeBytes(this.id),
+            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _silent;
+        let _background;
+        let _clear_draft;
+        let _hide_via;
+        let _peer;
+        let _reply_to_msg_id;
+        let _random_id;
+        let _query_id;
+        let _id;
+        let _schedule_date;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _silent = Boolean(flags & 32);
+        _background = Boolean(flags & 64);
+        _clear_draft = Boolean(flags & 128);
+        _hide_via = Boolean(flags & 2048);
+        _peer = reader.tgReadObject();
+        if (flags & 1) {
+            _reply_to_msg_id = reader.readInt();
+        }
+        else {
+            _reply_to_msg_id = null
+        }
+        _random_id = reader.readLong();
+        _query_id = reader.readLong();
+        _id = reader.tgReadString();
+        if (flags & 1024) {
+            _schedule_date = reader.readInt();
+        }
+        else {
+            _schedule_date = null
+        }
+        return new this({silent:_silent,
+	background:_background,
+	clearDraft:_clear_draft,
+	hideVia:_hide_via,
+	peer:_peer,
+	replyToMsgId:_reply_to_msg_id,
+	randomId:_random_id,
+	queryId:_query_id,
+	id:_id,
+	scheduleDate:_schedule_date})
+    }
+}
+
+
+class GetMessageEditDataRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xfda68d36;
+    static SUBCLASS_OF_ID = 0xfb47949d;
+
+    /**
+    :returns messages.MessageEditData: Instance of MessageEditData
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xfda68d36;
+        this.SUBCLASS_OF_ID = 0xfb47949d;
+
+        this.peer = args.peer;
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("368da6fd","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.id),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _id = reader.readInt();
+        return new this({peer:_peer,
+	id:_id})
+    }
+}
+
+
+class EditMessageRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x48f71778;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x48f71778;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.noWebpage = args.noWebpage || null;
+        this.peer = args.peer;
+        this.id = args.id;
+        this.message = args.message || null;
+        this.media = args.media || null;
+        this.replyMarkup = args.replyMarkup || null;
+        this.entities = args.entities || null;
+        this.scheduleDate = args.scheduleDate || null;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+        if (this.media) {
+            this.media = utils.getInputMedia(this.media)
+        }
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("7817f748","hex"),
+            struct.pack('<I', (this.noWebpage === undefined || this.noWebpage === false || this.noWebpage === null) ? 0 : 2 | (this.message === undefined || this.message === false || this.message === null) ? 0 : 2048 | (this.media === undefined || this.media === false || this.media === null) ? 0 : 16384 | (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup === null) ? 0 : 4 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 32768),
+            this.peer.getBytes(),
+            struct.pack('<i', this.id),
+            (this.message === undefined || this.message === false || this.message ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.message)],
+            (this.media === undefined || this.media === false || this.media ===null) ? Buffer.alloc(0) : [this.media.getBytes()],
+            (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup ===null) ? Buffer.alloc(0) : [this.replyMarkup.getBytes()],
+            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
+            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _no_webpage;
+        let _peer;
+        let _id;
+        let _message;
+        let _media;
+        let _reply_markup;
+        let _entities;
+        let _schedule_date;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _no_webpage = Boolean(flags & 2);
+        _peer = reader.tgReadObject();
+        _id = reader.readInt();
+        if (flags & 2048) {
+            _message = reader.tgReadString();
+        }
+        else {
+            _message = null
+        }
+        if (flags & 16384) {
+            _media = reader.tgReadObject();
+        }
+        else {
+            _media = null
+        }
+        if (flags & 4) {
+            _reply_markup = reader.tgReadObject();
+        }
+        else {
+            _reply_markup = null
+        }
+        if (flags & 8) {
+            reader.readInt();
+            _entities = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _entities.push(_x);
+                }
+            }
+            else {
+                _entities = null
+            }
+            if (flags & 32768) {
+                _schedule_date = reader.readInt();
+            }
+            else {
+                _schedule_date = null
+            }
+            return new this({noWebpage:_no_webpage,
+	peer:_peer,
+	id:_id,
+	message:_message,
+	media:_media,
+	replyMarkup:_reply_markup,
+	entities:_entities,
+	scheduleDate:_schedule_date})
+        }
+    }
+
+
+class EditInlineBotMessageRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x83557dba;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x83557dba;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.noWebpage = args.noWebpage || null;
+        this.id = args.id;
+        this.message = args.message || null;
+        this.media = args.media || null;
+        this.replyMarkup = args.replyMarkup || null;
+        this.entities = args.entities || null;
+    }
+    async resolve(client, utils) {
+        if (this.media) {
+            this.media = utils.getInputMedia(this.media)
+        }
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ba7d5583","hex"),
+            struct.pack('<I', (this.noWebpage === undefined || this.noWebpage === false || this.noWebpage === null) ? 0 : 2 | (this.message === undefined || this.message === false || this.message === null) ? 0 : 2048 | (this.media === undefined || this.media === false || this.media === null) ? 0 : 16384 | (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup === null) ? 0 : 4 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8),
+            this.id.getBytes(),
+            (this.message === undefined || this.message === false || this.message ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.message)],
+            (this.media === undefined || this.media === false || this.media ===null) ? Buffer.alloc(0) : [this.media.getBytes()],
+            (this.replyMarkup === undefined || this.replyMarkup === false || this.replyMarkup ===null) ? Buffer.alloc(0) : [this.replyMarkup.getBytes()],
+            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _no_webpage;
+        let _id;
+        let _message;
+        let _media;
+        let _reply_markup;
+        let _entities;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _no_webpage = Boolean(flags & 2);
+        _id = reader.tgReadObject();
+        if (flags & 2048) {
+            _message = reader.tgReadString();
+        }
+        else {
+            _message = null
+        }
+        if (flags & 16384) {
+            _media = reader.tgReadObject();
+        }
+        else {
+            _media = null
+        }
+        if (flags & 4) {
+            _reply_markup = reader.tgReadObject();
+        }
+        else {
+            _reply_markup = null
+        }
+        if (flags & 8) {
+            reader.readInt();
+            _entities = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _entities.push(_x);
+                }
+            }
+            else {
+                _entities = null
+            }
+            return new this({noWebpage:_no_webpage,
+	id:_id,
+	message:_message,
+	media:_media,
+	replyMarkup:_reply_markup,
+	entities:_entities})
+        }
+    }
+
+
+class GetBotCallbackAnswerRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x810a9fec;
+    static SUBCLASS_OF_ID = 0x6c4dd18c;
+
+    /**
+    :returns messages.BotCallbackAnswer: Instance of BotCallbackAnswer
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x810a9fec;
+        this.SUBCLASS_OF_ID = 0x6c4dd18c;
+
+        this.game = args.game || null;
+        this.peer = args.peer;
+        this.msgId = args.msgId;
+        this.data = args.data || null;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ec9f0a81","hex"),
+            struct.pack('<I', (this.game === undefined || this.game === false || this.game === null) ? 0 : 2 | (this.data === undefined || this.data === false || this.data === null) ? 0 : 1),
+            this.peer.getBytes(),
+            struct.pack('<i', this.msgId),
+            (this.data === undefined || this.data === false || this.data ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.data)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _game;
+        let _peer;
+        let _msg_id;
+        let _data;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _game = Boolean(flags & 2);
+        _peer = reader.tgReadObject();
+        _msg_id = reader.readInt();
+        if (flags & 1) {
+            _data = reader.tgReadBytes();
+        }
+        else {
+            _data = null
+        }
+        return new this({game:_game,
+	peer:_peer,
+	msgId:_msg_id,
+	data:_data})
+    }
+}
+
+
+class SetBotCallbackAnswerRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd58f130a;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd58f130a;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.alert = args.alert || null;
+        this.queryId = args.queryId;
+        this.message = args.message || null;
+        this.url = args.url || null;
+        this.cacheTime = args.cacheTime;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0a138fd5","hex"),
+            struct.pack('<I', (this.alert === undefined || this.alert === false || this.alert === null) ? 0 : 2 | (this.message === undefined || this.message === false || this.message === null) ? 0 : 1 | (this.url === undefined || this.url === false || this.url === null) ? 0 : 4),
+            readBufferFromBigInt(this.queryId,8,true,true),
+            (this.message === undefined || this.message === false || this.message ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.message)],
+            (this.url === undefined || this.url === false || this.url ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.url)],
+            struct.pack('<i', this.cacheTime),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _alert;
+        let _query_id;
+        let _message;
+        let _url;
+        let _cache_time;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _alert = Boolean(flags & 2);
+        _query_id = reader.readLong();
+        if (flags & 1) {
+            _message = reader.tgReadString();
+        }
+        else {
+            _message = null
+        }
+        if (flags & 4) {
+            _url = reader.tgReadString();
+        }
+        else {
+            _url = null
+        }
+        _cache_time = reader.readInt();
+        return new this({alert:_alert,
+	queryId:_query_id,
+	message:_message,
+	url:_url,
+	cacheTime:_cache_time})
+    }
+}
+
+
+class GetPeerDialogsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe470bcfd;
+    static SUBCLASS_OF_ID = 0x3ac70132;
+
+    /**
+    :returns messages.PeerDialogs: Instance of PeerDialogs
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe470bcfd;
+        this.SUBCLASS_OF_ID = 0x3ac70132;
+
+        this.peers = args.peers;
+    }
+    async resolve(client, utils) {
+        const _tmp = [];for (const _x of this.peers) {
+            _tmp.push(await client._getInputDialog(_x));
+        }
+        this.peers = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("fdbc70e4","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.peers.length),Buffer.concat(this.peers.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _peers;
+        let _x;
+        let len;
+        reader.readInt();
+        _peers = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _peers.push(_x);
+            }
+            return new this({peers:_peers})
+        }
+    }
+
+
+class SaveDraftRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbc39e14b;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbc39e14b;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.noWebpage = args.noWebpage || null;
+        this.replyToMsgId = args.replyToMsgId || null;
+        this.peer = args.peer;
+        this.message = args.message;
+        this.entities = args.entities || null;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4be139bc","hex"),
+            struct.pack('<I', (this.noWebpage === undefined || this.noWebpage === false || this.noWebpage === null) ? 0 : 2 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 8),
+            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
+            this.peer.getBytes(),
+            TLObject.serializeBytes(this.message),
+            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _no_webpage;
+        let _reply_to_msg_id;
+        let _peer;
+        let _message;
+        let _entities;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _no_webpage = Boolean(flags & 2);
+        if (flags & 1) {
+            _reply_to_msg_id = reader.readInt();
+        }
+        else {
+            _reply_to_msg_id = null
+        }
+        _peer = reader.tgReadObject();
+        _message = reader.tgReadString();
+        if (flags & 8) {
+            reader.readInt();
+            _entities = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _entities.push(_x);
+                }
+            }
+            else {
+                _entities = null
+            }
+            return new this({noWebpage:_no_webpage,
+	replyToMsgId:_reply_to_msg_id,
+	peer:_peer,
+	message:_message,
+	entities:_entities})
+        }
+    }
+
+
+class GetAllDraftsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x6a3f8d65;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x6a3f8d65;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("658d3f6a","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetFeaturedStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2dacca4f;
+    static SUBCLASS_OF_ID = 0x2614b722;
+
+    /**
+    :returns messages.FeaturedStickers: Instance of either FeaturedStickersNotModified, FeaturedStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2dacca4f;
+        this.SUBCLASS_OF_ID = 0x2614b722;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4fcaac2d","hex"),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        return new this({hash:_hash})
+    }
+}
+
+
+class ReadFeaturedStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x5b118126;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x5b118126;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.id = args.id;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2681115b","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => readBufferFromBigInt(x,8,true,true))),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readLong();
+            _id.push(_x);
+            }
+            return new this({id:_id})
+        }
+    }
+
+
+class GetRecentStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x5ea192c9;
+    static SUBCLASS_OF_ID = 0xf76f8683;
+
+    /**
+    :returns messages.RecentStickers: Instance of either RecentStickersNotModified, RecentStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x5ea192c9;
+        this.SUBCLASS_OF_ID = 0xf76f8683;
+
+        this.attached = args.attached || null;
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c992a15e","hex"),
+            struct.pack('<I', (this.attached === undefined || this.attached === false || this.attached === null) ? 0 : 1),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _attached;
+        let _hash;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _attached = Boolean(flags & 1);
+        _hash = reader.readInt();
+        return new this({attached:_attached,
+	hash:_hash})
+    }
+}
+
+
+class SaveRecentStickerRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x392718f8;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x392718f8;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.attached = args.attached || null;
+        this.id = args.id;
+        this.unsave = args.unsave;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputDocument(this.id)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f8182739","hex"),
+            struct.pack('<I', (this.attached === undefined || this.attached === false || this.attached === null) ? 0 : 1),
+            this.id.getBytes(),
+            this.unsave ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _attached;
+        let _id;
+        let _unsave;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _attached = Boolean(flags & 1);
+        _id = reader.tgReadObject();
+        _unsave = reader.tgReadBool();
+        return new this({attached:_attached,
+	id:_id,
+	unsave:_unsave})
+    }
+}
+
+
+class ClearRecentStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8999602d;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8999602d;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.attached = args.attached || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2d609989","hex"),
+            struct.pack('<I', (this.attached === undefined || this.attached === false || this.attached === null) ? 0 : 1),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _attached;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _attached = Boolean(flags & 1);
+        return new this({attached:_attached})
+    }
+}
+
+
+class GetArchivedStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x57f17692;
+    static SUBCLASS_OF_ID = 0x7296d771;
+
+    /**
+    :returns messages.ArchivedStickers: Instance of ArchivedStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x57f17692;
+        this.SUBCLASS_OF_ID = 0x7296d771;
+
+        this.masks = args.masks || null;
+        this.offsetId = args.offsetId;
+        this.limit = args.limit;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9276f157","hex"),
+            struct.pack('<I', (this.masks === undefined || this.masks === false || this.masks === null) ? 0 : 1),
+            readBufferFromBigInt(this.offsetId,8,true,true),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _masks;
+        let _offset_id;
+        let _limit;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _masks = Boolean(flags & 1);
+        _offset_id = reader.readLong();
+        _limit = reader.readInt();
+        return new this({masks:_masks,
+	offsetId:_offset_id,
+	limit:_limit})
+    }
+}
+
+
+class GetMaskStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x65b8c79f;
+    static SUBCLASS_OF_ID = 0x45834829;
+
+    /**
+    :returns messages.AllStickers: Instance of either AllStickersNotModified, AllStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x65b8c79f;
+        this.SUBCLASS_OF_ID = 0x45834829;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9fc7b865","hex"),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        return new this({hash:_hash})
+    }
+}
+
+
+class GetAttachedStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xcc5b67cc;
+    static SUBCLASS_OF_ID = 0xcc125f6b;
+
+    /**
+    :returns Vector<StickerSetCovered>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xcc5b67cc;
+        this.SUBCLASS_OF_ID = 0xcc125f6b;
+
+        this.media = args.media;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("cc675bcc","hex"),
+            this.media.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _media;
+        let _x;
+        let len;
+        _media = reader.tgReadObject();
+        return new this({media:_media})
+    }
+}
+
+
+class SetGameScoreRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8ef8ecc0;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8ef8ecc0;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.editMessage = args.editMessage || null;
+        this.force = args.force || null;
+        this.peer = args.peer;
+        this.id = args.id;
+        this.userId = args.userId;
+        this.score = args.score;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c0ecf88e","hex"),
+            struct.pack('<I', (this.editMessage === undefined || this.editMessage === false || this.editMessage === null) ? 0 : 1 | (this.force === undefined || this.force === false || this.force === null) ? 0 : 2),
+            this.peer.getBytes(),
+            struct.pack('<i', this.id),
+            this.userId.getBytes(),
+            struct.pack('<i', this.score),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _edit_message;
+        let _force;
+        let _peer;
+        let _id;
+        let _user_id;
+        let _score;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _edit_message = Boolean(flags & 1);
+        _force = Boolean(flags & 2);
+        _peer = reader.tgReadObject();
+        _id = reader.readInt();
+        _user_id = reader.tgReadObject();
+        _score = reader.readInt();
+        return new this({editMessage:_edit_message,
+	force:_force,
+	peer:_peer,
+	id:_id,
+	userId:_user_id,
+	score:_score})
+    }
+}
+
+
+class SetInlineGameScoreRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x15ad9f64;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x15ad9f64;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.editMessage = args.editMessage || null;
+        this.force = args.force || null;
+        this.id = args.id;
+        this.userId = args.userId;
+        this.score = args.score;
+    }
+    async resolve(client, utils) {
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("649fad15","hex"),
+            struct.pack('<I', (this.editMessage === undefined || this.editMessage === false || this.editMessage === null) ? 0 : 1 | (this.force === undefined || this.force === false || this.force === null) ? 0 : 2),
+            this.id.getBytes(),
+            this.userId.getBytes(),
+            struct.pack('<i', this.score),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _edit_message;
+        let _force;
+        let _id;
+        let _user_id;
+        let _score;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _edit_message = Boolean(flags & 1);
+        _force = Boolean(flags & 2);
+        _id = reader.tgReadObject();
+        _user_id = reader.tgReadObject();
+        _score = reader.readInt();
+        return new this({editMessage:_edit_message,
+	force:_force,
+	id:_id,
+	userId:_user_id,
+	score:_score})
+    }
+}
+
+
+class GetGameHighScoresRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe822649d;
+    static SUBCLASS_OF_ID = 0x6ccd95fd;
+
+    /**
+    :returns messages.HighScores: Instance of HighScores
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe822649d;
+        this.SUBCLASS_OF_ID = 0x6ccd95fd;
+
+        this.peer = args.peer;
+        this.id = args.id;
+        this.userId = args.userId;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9d6422e8","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.id),
+            this.userId.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _id;
+        let _user_id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _id = reader.readInt();
+        _user_id = reader.tgReadObject();
+        return new this({peer:_peer,
+	id:_id,
+	userId:_user_id})
+    }
+}
+
+
+class GetInlineGameHighScoresRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x0f635e1b;
+    static SUBCLASS_OF_ID = 0x6ccd95fd;
+
+    /**
+    :returns messages.HighScores: Instance of HighScores
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x0f635e1b;
+        this.SUBCLASS_OF_ID = 0x6ccd95fd;
+
+        this.id = args.id;
+        this.userId = args.userId;
+    }
+    async resolve(client, utils) {
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1b5e630f","hex"),
+            this.id.getBytes(),
+            this.userId.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _user_id;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        _user_id = reader.tgReadObject();
+        return new this({id:_id,
+	userId:_user_id})
+    }
+}
+
+
+class GetCommonChatsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x0d0a48c4;
+    static SUBCLASS_OF_ID = 0x99d5cb14;
+
+    /**
+    :returns messages.Chats: Instance of either Chats, ChatsSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x0d0a48c4;
+        this.SUBCLASS_OF_ID = 0x99d5cb14;
+
+        this.userId = args.userId;
+        this.maxId = args.maxId;
+        this.limit = args.limit;
+    }
+    async resolve(client, utils) {
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c4480a0d","hex"),
+            this.userId.getBytes(),
+            struct.pack('<i', this.maxId),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _user_id;
+        let _max_id;
+        let _limit;
+        let _x;
+        let len;
+        _user_id = reader.tgReadObject();
+        _max_id = reader.readInt();
+        _limit = reader.readInt();
+        return new this({userId:_user_id,
+	maxId:_max_id,
+	limit:_limit})
+    }
+}
+
+
+class GetAllChatsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xeba80ff0;
+    static SUBCLASS_OF_ID = 0x99d5cb14;
+
+    /**
+    :returns messages.Chats: Instance of either Chats, ChatsSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xeba80ff0;
+        this.SUBCLASS_OF_ID = 0x99d5cb14;
+
+        this.exceptIds = args.exceptIds;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f00fa8eb","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.exceptIds.length),Buffer.concat(this.exceptIds.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _except_ids;
+        let _x;
+        let len;
+        reader.readInt();
+        _except_ids = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _except_ids.push(_x);
+            }
+            return new this({exceptIds:_except_ids})
+        }
+    }
+
+
+class GetWebPageRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x32ca8f91;
+    static SUBCLASS_OF_ID = 0x55a97481;
+
+    /**
+    :returns WebPage: Instance of either WebPageEmpty, WebPagePending, WebPage, WebPageNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x32ca8f91;
+        this.SUBCLASS_OF_ID = 0x55a97481;
+
+        this.url = args.url;
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("918fca32","hex"),
+            TLObject.serializeBytes(this.url),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _url;
+        let _hash;
+        let _x;
+        let len;
+        _url = reader.tgReadString();
+        _hash = reader.readInt();
+        return new this({url:_url,
+	hash:_hash})
+    }
+}
+
+
+class ToggleDialogPinRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa731e257;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa731e257;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.pinned = args.pinned || null;
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = await client._getInputDialog(this.peer)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("57e231a7","hex"),
+            struct.pack('<I', (this.pinned === undefined || this.pinned === false || this.pinned === null) ? 0 : 1),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _pinned;
+        let _peer;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _pinned = Boolean(flags & 1);
+        _peer = reader.tgReadObject();
+        return new this({pinned:_pinned,
+	peer:_peer})
+    }
+}
+
+
+class ReorderPinnedDialogsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3b1adf37;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3b1adf37;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.force = args.force || null;
+        this.folderId = args.folderId;
+        this.order = args.order;
+    }
+    async resolve(client, utils) {
+        const _tmp = [];for (const _x of this.order) {
+            _tmp.push(await client._getInputDialog(_x));
+        }
+        this.order = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("37df1a3b","hex"),
+            struct.pack('<I', (this.force === undefined || this.force === false || this.force === null) ? 0 : 1),
+            struct.pack('<i', this.folderId),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.order.length),Buffer.concat(this.order.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _force;
+        let _folder_id;
+        let _order;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _force = Boolean(flags & 1);
+        _folder_id = reader.readInt();
+        reader.readInt();
+        _order = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _order.push(_x);
+            }
+            return new this({force:_force,
+	folderId:_folder_id,
+	order:_order})
+        }
+    }
+
+
+class GetPinnedDialogsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd6b94df2;
+    static SUBCLASS_OF_ID = 0x3ac70132;
+
+    /**
+    :returns messages.PeerDialogs: Instance of PeerDialogs
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd6b94df2;
+        this.SUBCLASS_OF_ID = 0x3ac70132;
+
+        this.folderId = args.folderId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f24db9d6","hex"),
+            struct.pack('<i', this.folderId),
+            ])
+        }
+    static fromReader(reader) {
+        let _folder_id;
+        let _x;
+        let len;
+        _folder_id = reader.readInt();
+        return new this({folderId:_folder_id})
+    }
+}
+
+
+class SetBotShippingResultsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe5f672fa;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe5f672fa;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.queryId = args.queryId;
+        this.error = args.error || null;
+        this.shippingOptions = args.shippingOptions || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("fa72f6e5","hex"),
+            struct.pack('<I', (this.error === undefined || this.error === false || this.error === null) ? 0 : 1 | (this.shippingOptions === undefined || this.shippingOptions === false || this.shippingOptions === null) ? 0 : 2),
+            readBufferFromBigInt(this.queryId,8,true,true),
+            (this.error === undefined || this.error === false || this.error ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.error)],
+            (this.shippingOptions === undefined || this.shippingOptions === false || this.shippingOptions ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.shippingOptions.length),Buffer.concat(this.shippingOptions.map(x => x.getBytes()))]),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _query_id;
+        let _error;
+        let _shipping_options;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _query_id = reader.readLong();
+        if (flags & 1) {
+            _error = reader.tgReadString();
+        }
+        else {
+            _error = null
+        }
+        if (flags & 2) {
+            reader.readInt();
+            _shipping_options = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _shipping_options.push(_x);
+                }
+            }
+            else {
+                _shipping_options = null
+            }
+            return new this({queryId:_query_id,
+	error:_error,
+	shippingOptions:_shipping_options})
+        }
+    }
+
+
+class SetBotPrecheckoutResultsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x09c2dd95;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x09c2dd95;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.success = args.success || null;
+        this.queryId = args.queryId;
+        this.error = args.error || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("95ddc209","hex"),
+            struct.pack('<I', (this.success === undefined || this.success === false || this.success === null) ? 0 : 2 | (this.error === undefined || this.error === false || this.error === null) ? 0 : 1),
+            readBufferFromBigInt(this.queryId,8,true,true),
+            (this.error === undefined || this.error === false || this.error ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.error)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _success;
+        let _query_id;
+        let _error;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _success = Boolean(flags & 2);
+        _query_id = reader.readLong();
+        if (flags & 1) {
+            _error = reader.tgReadString();
+        }
+        else {
+            _error = null
+        }
+        return new this({success:_success,
+	queryId:_query_id,
+	error:_error})
+    }
+}
+
+
+class UploadMediaRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x519bc2b1;
+    static SUBCLASS_OF_ID = 0x476cbe32;
+
+    /**
+    :returns MessageMedia: Instance of either MessageMediaEmpty, MessageMediaPhoto, MessageMediaGeo, MessageMediaContact, MessageMediaUnsupported, MessageMediaDocument, MessageMediaWebPage, MessageMediaVenue, MessageMediaGame, MessageMediaInvoice, MessageMediaGeoLive, MessageMediaPoll
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x519bc2b1;
+        this.SUBCLASS_OF_ID = 0x476cbe32;
+
+        this.peer = args.peer;
+        this.media = args.media;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+        this.media = utils.getInputMedia(this.media)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b1c29b51","hex"),
+            this.peer.getBytes(),
+            this.media.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _media;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _media = reader.tgReadObject();
+        return new this({peer:_peer,
+	media:_media})
+    }
+}
+
+
+class SendScreenshotNotificationRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc97df020;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc97df020;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.peer = args.peer;
+        this.replyToMsgId = args.replyToMsgId;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(8),false,true);
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("20f07dc9","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.replyToMsgId),
+            readBufferFromBigInt(this.randomId,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _reply_to_msg_id;
+        let _random_id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _reply_to_msg_id = reader.readInt();
+        _random_id = reader.readLong();
+        return new this({peer:_peer,
+	replyToMsgId:_reply_to_msg_id,
+	randomId:_random_id})
+    }
+}
+
+
+class GetFavedStickersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x21ce0b0e;
+    static SUBCLASS_OF_ID = 0x8e736fb9;
+
+    /**
+    :returns messages.FavedStickers: Instance of either FavedStickersNotModified, FavedStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x21ce0b0e;
+        this.SUBCLASS_OF_ID = 0x8e736fb9;
+
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0e0bce21","hex"),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        return new this({hash:_hash})
+    }
+}
+
+
+class FaveStickerRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xb9ffc55b;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb9ffc55b;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.id = args.id;
+        this.unfave = args.unfave;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputDocument(this.id)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5bc5ffb9","hex"),
+            this.id.getBytes(),
+            this.unfave ? 0xb5757299 : 0x379779bc,
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _unfave;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        _unfave = reader.tgReadBool();
+        return new this({id:_id,
+	unfave:_unfave})
+    }
+}
+
+
+class GetUnreadMentionsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x46578472;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x46578472;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.peer = args.peer;
+        this.offsetId = args.offsetId;
+        this.addOffset = args.addOffset;
+        this.limit = args.limit;
+        this.maxId = args.maxId;
+        this.minId = args.minId;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("72845746","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.offsetId),
+            struct.pack('<i', this.addOffset),
+            struct.pack('<i', this.limit),
+            struct.pack('<i', this.maxId),
+            struct.pack('<i', this.minId),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _offset_id;
+        let _add_offset;
+        let _limit;
+        let _max_id;
+        let _min_id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _offset_id = reader.readInt();
+        _add_offset = reader.readInt();
+        _limit = reader.readInt();
+        _max_id = reader.readInt();
+        _min_id = reader.readInt();
+        return new this({peer:_peer,
+	offsetId:_offset_id,
+	addOffset:_add_offset,
+	limit:_limit,
+	maxId:_max_id,
+	minId:_min_id})
+    }
+}
+
+
+class ReadMentionsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x0f0189d3;
+    static SUBCLASS_OF_ID = 0x2c49c116;
+
+    /**
+    :returns messages.AffectedHistory: Instance of AffectedHistory
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x0f0189d3;
+        this.SUBCLASS_OF_ID = 0x2c49c116;
+
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d389010f","hex"),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        return new this({peer:_peer})
+    }
+}
+
+
+class GetRecentLocationsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbbc45b09;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbbc45b09;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.peer = args.peer;
+        this.limit = args.limit;
+        this.hash = args.hash;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("095bc4bb","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.limit),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _limit;
+        let _hash;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _limit = reader.readInt();
+        _hash = reader.readInt();
+        return new this({peer:_peer,
+	limit:_limit,
+	hash:_hash})
+    }
+}
+
+
+class SendMultiMediaRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xcc0110cb;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xcc0110cb;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.silent = args.silent || null;
+        this.background = args.background || null;
+        this.clearDraft = args.clearDraft || null;
+        this.peer = args.peer;
+        this.replyToMsgId = args.replyToMsgId || null;
+        this.multiMedia = args.multiMedia;
+        this.scheduleDate = args.scheduleDate || null;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("cb1001cc","hex"),
+            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 32 | (this.background === undefined || this.background === false || this.background === null) ? 0 : 64 | (this.clearDraft === undefined || this.clearDraft === false || this.clearDraft === null) ? 0 : 128 | (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId === null) ? 0 : 1 | (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate === null) ? 0 : 1024),
+            this.peer.getBytes(),
+            (this.replyToMsgId === undefined || this.replyToMsgId === false || this.replyToMsgId ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.replyToMsgId)],
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.multiMedia.length),Buffer.concat(this.multiMedia.map(x => x.getBytes())),
+            (this.scheduleDate === undefined || this.scheduleDate === false || this.scheduleDate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.scheduleDate)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _silent;
+        let _background;
+        let _clear_draft;
+        let _peer;
+        let _reply_to_msg_id;
+        let _multi_media;
+        let _schedule_date;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _silent = Boolean(flags & 32);
+        _background = Boolean(flags & 64);
+        _clear_draft = Boolean(flags & 128);
+        _peer = reader.tgReadObject();
+        if (flags & 1) {
+            _reply_to_msg_id = reader.readInt();
+        }
+        else {
+            _reply_to_msg_id = null
+        }
+        reader.readInt();
+        _multi_media = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _multi_media.push(_x);
+            }
+            if (flags & 1024) {
+                _schedule_date = reader.readInt();
+            }
+            else {
+                _schedule_date = null
+            }
+            return new this({silent:_silent,
+	background:_background,
+	clearDraft:_clear_draft,
+	peer:_peer,
+	replyToMsgId:_reply_to_msg_id,
+	multiMedia:_multi_media,
+	scheduleDate:_schedule_date})
+        }
+    }
+
+
+class UploadEncryptedFileRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x5057c497;
+    static SUBCLASS_OF_ID = 0x842a67c0;
+
+    /**
+    :returns EncryptedFile: Instance of either EncryptedFileEmpty, EncryptedFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x5057c497;
+        this.SUBCLASS_OF_ID = 0x842a67c0;
+
+        this.peer = args.peer;
+        this.file = args.file;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("97c45750","hex"),
+            this.peer.getBytes(),
+            this.file.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _file;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _file = reader.tgReadObject();
+        return new this({peer:_peer,
+	file:_file})
+    }
+}
+
+
+class SearchStickerSetsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc2b7d08b;
+    static SUBCLASS_OF_ID = 0x40df361;
+
+    /**
+    :returns messages.FoundStickerSets: Instance of either FoundStickerSetsNotModified, FoundStickerSets
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc2b7d08b;
+        this.SUBCLASS_OF_ID = 0x40df361;
+
+        this.excludeFeatured = args.excludeFeatured || null;
+        this.q = args.q;
+        this.hash = args.hash;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8bd0b7c2","hex"),
+            struct.pack('<I', (this.excludeFeatured === undefined || this.excludeFeatured === false || this.excludeFeatured === null) ? 0 : 1),
+            TLObject.serializeBytes(this.q),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _exclude_featured;
+        let _q;
+        let _hash;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _exclude_featured = Boolean(flags & 1);
+        _q = reader.tgReadString();
+        _hash = reader.readInt();
+        return new this({excludeFeatured:_exclude_featured,
+	q:_q,
+	hash:_hash})
+    }
+}
+
+
+class GetSplitRangesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1cff7e08;
+    static SUBCLASS_OF_ID = 0x5ba52504;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x1cff7e08;
+        this.SUBCLASS_OF_ID = 0x5ba52504;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("087eff1c","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class MarkDialogUnreadRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc286d98f;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc286d98f;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.unread = args.unread || null;
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = await client._getInputDialog(this.peer)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8fd986c2","hex"),
+            struct.pack('<I', (this.unread === undefined || this.unread === false || this.unread === null) ? 0 : 1),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _unread;
+        let _peer;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _unread = Boolean(flags & 1);
+        _peer = reader.tgReadObject();
+        return new this({unread:_unread,
+	peer:_peer})
+    }
+}
+
+
+class GetDialogUnreadMarksRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x22e24e22;
+    static SUBCLASS_OF_ID = 0xbec64ad9;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x22e24e22;
+        this.SUBCLASS_OF_ID = 0xbec64ad9;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("224ee222","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class ClearAllDraftsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x7e58ee9c;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x7e58ee9c;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9cee587e","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class UpdatePinnedMessageRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd2aaf7ec;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd2aaf7ec;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.silent = args.silent || null;
+        this.peer = args.peer;
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ecf7aad2","hex"),
+            struct.pack('<I', (this.silent === undefined || this.silent === false || this.silent === null) ? 0 : 1),
+            this.peer.getBytes(),
+            struct.pack('<i', this.id),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _silent;
+        let _peer;
+        let _id;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _silent = Boolean(flags & 1);
+        _peer = reader.tgReadObject();
+        _id = reader.readInt();
+        return new this({silent:_silent,
+	peer:_peer,
+	id:_id})
+    }
+}
+
+
+class SendVoteRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x10ea6184;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x10ea6184;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.peer = args.peer;
+        this.msgId = args.msgId;
+        this.options = args.options;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8461ea10","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.msgId),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.options.length),Buffer.concat(this.options.map(x => TLObject.serializeBytes(x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _msg_id;
+        let _options;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _msg_id = reader.readInt();
+        reader.readInt();
+        _options = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadBytes();
+            _options.push(_x);
+            }
+            return new this({peer:_peer,
+	msgId:_msg_id,
+	options:_options})
+        }
+    }
+
+
+class GetPollResultsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x73bb643b;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x73bb643b;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.peer = args.peer;
+        this.msgId = args.msgId;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3b64bb73","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.msgId),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _msg_id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _msg_id = reader.readInt();
+        return new this({peer:_peer,
+	msgId:_msg_id})
+    }
+}
+
+
+class GetOnlinesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x6e2be050;
+    static SUBCLASS_OF_ID = 0x8c81903a;
+
+    /**
+    :returns ChatOnlines: Instance of ChatOnlines
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x6e2be050;
+        this.SUBCLASS_OF_ID = 0x8c81903a;
+
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("50e02b6e","hex"),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        return new this({peer:_peer})
+    }
+}
+
+
+class GetStatsURLRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x812c2ae6;
+    static SUBCLASS_OF_ID = 0x8d4c94c0;
+
+    /**
+    :returns StatsURL: Instance of StatsURL
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x812c2ae6;
+        this.SUBCLASS_OF_ID = 0x8d4c94c0;
+
+        this.dark = args.dark || null;
+        this.peer = args.peer;
+        this.params = args.params;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e62a2c81","hex"),
+            struct.pack('<I', (this.dark === undefined || this.dark === false || this.dark === null) ? 0 : 1),
+            this.peer.getBytes(),
+            TLObject.serializeBytes(this.params),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _dark;
+        let _peer;
+        let _params;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _dark = Boolean(flags & 1);
+        _peer = reader.tgReadObject();
+        _params = reader.tgReadString();
+        return new this({dark:_dark,
+	peer:_peer,
+	params:_params})
+    }
+}
+
+
+class EditChatAboutRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xdef60797;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xdef60797;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+        this.about = args.about;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9707f6de","hex"),
+            this.peer.getBytes(),
+            TLObject.serializeBytes(this.about),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _about;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _about = reader.tgReadString();
+        return new this({peer:_peer,
+	about:_about})
+    }
+}
+
+
+class EditChatDefaultBannedRightsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa5866b41;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa5866b41;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.peer = args.peer;
+        this.bannedRights = args.bannedRights;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("416b86a5","hex"),
+            this.peer.getBytes(),
+            this.bannedRights.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _banned_rights;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _banned_rights = reader.tgReadObject();
+        return new this({peer:_peer,
+	bannedRights:_banned_rights})
+    }
+}
+
+
+class GetEmojiKeywordsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x35a0e062;
+    static SUBCLASS_OF_ID = 0xd279c672;
+
+    /**
+    :returns EmojiKeywordsDifference: Instance of EmojiKeywordsDifference
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x35a0e062;
+        this.SUBCLASS_OF_ID = 0xd279c672;
+
+        this.langCode = args.langCode;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("62e0a035","hex"),
+            TLObject.serializeBytes(this.langCode),
+            ])
+        }
+    static fromReader(reader) {
+        let _lang_code;
+        let _x;
+        let len;
+        _lang_code = reader.tgReadString();
+        return new this({langCode:_lang_code})
+    }
+}
+
+
+class GetEmojiKeywordsDifferenceRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x1508b6af;
+    static SUBCLASS_OF_ID = 0xd279c672;
+
+    /**
+    :returns EmojiKeywordsDifference: Instance of EmojiKeywordsDifference
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1508b6af;
+        this.SUBCLASS_OF_ID = 0xd279c672;
+
+        this.langCode = args.langCode;
+        this.fromVersion = args.fromVersion;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("afb60815","hex"),
+            TLObject.serializeBytes(this.langCode),
+            struct.pack('<i', this.fromVersion),
+            ])
+        }
+    static fromReader(reader) {
+        let _lang_code;
+        let _from_version;
+        let _x;
+        let len;
+        _lang_code = reader.tgReadString();
+        _from_version = reader.readInt();
+        return new this({langCode:_lang_code,
+	fromVersion:_from_version})
+    }
+}
+
+
+class GetEmojiKeywordsLanguagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x4e9963b2;
+    static SUBCLASS_OF_ID = 0xe795d387;
+
+    /**
+    :returns Vector<EmojiLanguage>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4e9963b2;
+        this.SUBCLASS_OF_ID = 0xe795d387;
+
+        this.langCodes = args.langCodes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b263994e","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.langCodes.length),Buffer.concat(this.langCodes.map(x => TLObject.serializeBytes(x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _lang_codes;
+        let _x;
+        let len;
+        reader.readInt();
+        _lang_codes = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadString();
+            _lang_codes.push(_x);
+            }
+            return new this({langCodes:_lang_codes})
+        }
+    }
+
+
+class GetEmojiURLRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd5b10c26;
+    static SUBCLASS_OF_ID = 0x1fa08a19;
+
+    /**
+    :returns EmojiURL: Instance of EmojiURL
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd5b10c26;
+        this.SUBCLASS_OF_ID = 0x1fa08a19;
+
+        this.langCode = args.langCode;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("260cb1d5","hex"),
+            TLObject.serializeBytes(this.langCode),
+            ])
+        }
+    static fromReader(reader) {
+        let _lang_code;
+        let _x;
+        let len;
+        _lang_code = reader.tgReadString();
+        return new this({langCode:_lang_code})
+    }
+}
+
+
+class GetSearchCountersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x732eef00;
+    static SUBCLASS_OF_ID = 0x6bde3c6e;
+
+    /**
+    :returns Vector<messages.SearchCounter>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x732eef00;
+        this.SUBCLASS_OF_ID = 0x6bde3c6e;
+
+        this.peer = args.peer;
+        this.filters = args.filters;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("00ef2e73","hex"),
+            this.peer.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.filters.length),Buffer.concat(this.filters.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _filters;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        reader.readInt();
+        _filters = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _filters.push(_x);
+            }
+            return new this({peer:_peer,
+	filters:_filters})
+        }
+    }
+
+
+class RequestUrlAuthRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe33f5613;
+    static SUBCLASS_OF_ID = 0x7765cb1e;
+
+    /**
+    :returns UrlAuthResult: Instance of either UrlAuthResultRequest, UrlAuthResultAccepted, UrlAuthResultDefault
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe33f5613;
+        this.SUBCLASS_OF_ID = 0x7765cb1e;
+
+        this.peer = args.peer;
+        this.msgId = args.msgId;
+        this.buttonId = args.buttonId;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("13563fe3","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.msgId),
+            struct.pack('<i', this.buttonId),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _msg_id;
+        let _button_id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _msg_id = reader.readInt();
+        _button_id = reader.readInt();
+        return new this({peer:_peer,
+	msgId:_msg_id,
+	buttonId:_button_id})
+    }
+}
+
+
+class AcceptUrlAuthRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf729ea98;
+    static SUBCLASS_OF_ID = 0x7765cb1e;
+
+    /**
+    :returns UrlAuthResult: Instance of either UrlAuthResultRequest, UrlAuthResultAccepted, UrlAuthResultDefault
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf729ea98;
+        this.SUBCLASS_OF_ID = 0x7765cb1e;
+
+        this.writeAllowed = args.writeAllowed || null;
+        this.peer = args.peer;
+        this.msgId = args.msgId;
+        this.buttonId = args.buttonId;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("98ea29f7","hex"),
+            struct.pack('<I', (this.writeAllowed === undefined || this.writeAllowed === false || this.writeAllowed === null) ? 0 : 1),
+            this.peer.getBytes(),
+            struct.pack('<i', this.msgId),
+            struct.pack('<i', this.buttonId),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _write_allowed;
+        let _peer;
+        let _msg_id;
+        let _button_id;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _write_allowed = Boolean(flags & 1);
+        _peer = reader.tgReadObject();
+        _msg_id = reader.readInt();
+        _button_id = reader.readInt();
+        return new this({writeAllowed:_write_allowed,
+	peer:_peer,
+	msgId:_msg_id,
+	buttonId:_button_id})
+    }
+}
+
+
+class HidePeerSettingsBarRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x4facb138;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4facb138;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("38b1ac4f","hex"),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        return new this({peer:_peer})
+    }
+}
+
+
+class GetScheduledHistoryRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xe2c2685b;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe2c2685b;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.peer = args.peer;
+        this.hash = args.hash;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5b68c2e2","hex"),
+            this.peer.getBytes(),
+            struct.pack('<i', this.hash),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _hash;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _hash = reader.readInt();
+        return new this({peer:_peer,
+	hash:_hash})
+    }
+}
+
+
+class GetScheduledMessagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbdbb0464;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    :returns messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbdbb0464;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.peer = args.peer;
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6404bbbd","hex"),
+            this.peer.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            return new this({peer:_peer,
+	id:_id})
+        }
+    }
+
+
+class SendScheduledMessagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xbd38850a;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xbd38850a;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.peer = args.peer;
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0a8538bd","hex"),
+            this.peer.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            return new this({peer:_peer,
+	id:_id})
+        }
+    }
+
+
+class DeleteScheduledMessagesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x59ae2b16;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x59ae2b16;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.peer = args.peer;
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.peer = utils.getInputPeer(await client.getInputEntity(this.peer))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("162bae59","hex"),
+            this.peer.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _id;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.readInt();
+            _id.push(_x);
+            }
+            return new this({peer:_peer,
+	id:_id})
+        }
+    }
+
+module.exports = {
+    GetMessagesRequest,
+    GetDialogsRequest,
+    GetHistoryRequest,
+    SearchRequest,
+    ReadHistoryRequest,
+    DeleteHistoryRequest,
+    DeleteMessagesRequest,
+    ReceivedMessagesRequest,
+    SetTypingRequest,
+    SendMessageRequest,
+    SendMediaRequest,
+    ForwardMessagesRequest,
+    ReportSpamRequest,
+    GetPeerSettingsRequest,
+    ReportRequest,
+    GetChatsRequest,
+    GetFullChatRequest,
+    EditChatTitleRequest,
+    EditChatPhotoRequest,
+    AddChatUserRequest,
+    DeleteChatUserRequest,
+    CreateChatRequest,
+    GetDhConfigRequest,
+    RequestEncryptionRequest,
+    AcceptEncryptionRequest,
+    DiscardEncryptionRequest,
+    SetEncryptedTypingRequest,
+    ReadEncryptedHistoryRequest,
+    SendEncryptedRequest,
+    SendEncryptedFileRequest,
+    SendEncryptedServiceRequest,
+    ReceivedQueueRequest,
+    ReportEncryptedSpamRequest,
+    ReadMessageContentsRequest,
+    GetStickersRequest,
+    GetAllStickersRequest,
+    GetWebPagePreviewRequest,
+    ExportChatInviteRequest,
+    CheckChatInviteRequest,
+    ImportChatInviteRequest,
+    GetStickerSetRequest,
+    InstallStickerSetRequest,
+    UninstallStickerSetRequest,
+    StartBotRequest,
+    GetMessagesViewsRequest,
+    EditChatAdminRequest,
+    MigrateChatRequest,
+    SearchGlobalRequest,
+    ReorderStickerSetsRequest,
+    GetDocumentByHashRequest,
+    SearchGifsRequest,
+    GetSavedGifsRequest,
+    SaveGifRequest,
+    GetInlineBotResultsRequest,
+    SetInlineBotResultsRequest,
+    SendInlineBotResultRequest,
+    GetMessageEditDataRequest,
+    EditMessageRequest,
+    EditInlineBotMessageRequest,
+    GetBotCallbackAnswerRequest,
+    SetBotCallbackAnswerRequest,
+    GetPeerDialogsRequest,
+    SaveDraftRequest,
+    GetAllDraftsRequest,
+    GetFeaturedStickersRequest,
+    ReadFeaturedStickersRequest,
+    GetRecentStickersRequest,
+    SaveRecentStickerRequest,
+    ClearRecentStickersRequest,
+    GetArchivedStickersRequest,
+    GetMaskStickersRequest,
+    GetAttachedStickersRequest,
+    SetGameScoreRequest,
+    SetInlineGameScoreRequest,
+    GetGameHighScoresRequest,
+    GetInlineGameHighScoresRequest,
+    GetCommonChatsRequest,
+    GetAllChatsRequest,
+    GetWebPageRequest,
+    ToggleDialogPinRequest,
+    ReorderPinnedDialogsRequest,
+    GetPinnedDialogsRequest,
+    SetBotShippingResultsRequest,
+    SetBotPrecheckoutResultsRequest,
+    UploadMediaRequest,
+    SendScreenshotNotificationRequest,
+    GetFavedStickersRequest,
+    FaveStickerRequest,
+    GetUnreadMentionsRequest,
+    ReadMentionsRequest,
+    GetRecentLocationsRequest,
+    SendMultiMediaRequest,
+    UploadEncryptedFileRequest,
+    SearchStickerSetsRequest,
+    GetSplitRangesRequest,
+    MarkDialogUnreadRequest,
+    GetDialogUnreadMarksRequest,
+    ClearAllDraftsRequest,
+    UpdatePinnedMessageRequest,
+    SendVoteRequest,
+    GetPollResultsRequest,
+    GetOnlinesRequest,
+    GetStatsURLRequest,
+    EditChatAboutRequest,
+    EditChatDefaultBannedRightsRequest,
+    GetEmojiKeywordsRequest,
+    GetEmojiKeywordsDifferenceRequest,
+    GetEmojiKeywordsLanguagesRequest,
+    GetEmojiURLRequest,
+    GetSearchCountersRequest,
+    RequestUrlAuthRequest,
+    AcceptUrlAuthRequest,
+    HidePeerSettingsBarRequest,
+    GetScheduledHistoryRequest,
+    GetScheduledMessagesRequest,
+    SendScheduledMessagesRequest,
+    DeleteScheduledMessagesRequest,
+};

+ 242 - 0
src/lib/gramjs/tl/functions/payments.js

@@ -0,0 +1,242 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class GetPaymentFormRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x99f09745;
+    static SUBCLASS_OF_ID = 0xa0483f19;
+
+    /**
+    :returns payments.PaymentForm: Instance of PaymentForm
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x99f09745;
+        this.SUBCLASS_OF_ID = 0xa0483f19;
+
+        this.msgId = args.msgId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4597f099","hex"),
+            struct.pack('<i', this.msgId),
+            ])
+        }
+    static fromReader(reader) {
+        let _msg_id;
+        let _x;
+        let len;
+        _msg_id = reader.readInt();
+        return new this({msgId:_msg_id})
+    }
+}
+
+
+class GetPaymentReceiptRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xa092a980;
+    static SUBCLASS_OF_ID = 0x590093c9;
+
+    /**
+    :returns payments.PaymentReceipt: Instance of PaymentReceipt
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa092a980;
+        this.SUBCLASS_OF_ID = 0x590093c9;
+
+        this.msgId = args.msgId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("80a992a0","hex"),
+            struct.pack('<i', this.msgId),
+            ])
+        }
+    static fromReader(reader) {
+        let _msg_id;
+        let _x;
+        let len;
+        _msg_id = reader.readInt();
+        return new this({msgId:_msg_id})
+    }
+}
+
+
+class ValidateRequestedInfoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x770a8e74;
+    static SUBCLASS_OF_ID = 0x8f8044b7;
+
+    /**
+    :returns payments.ValidatedRequestedInfo: Instance of ValidatedRequestedInfo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x770a8e74;
+        this.SUBCLASS_OF_ID = 0x8f8044b7;
+
+        this.save = args.save || null;
+        this.msgId = args.msgId;
+        this.info = args.info;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("748e0a77","hex"),
+            struct.pack('<I', (this.save === undefined || this.save === false || this.save === null) ? 0 : 1),
+            struct.pack('<i', this.msgId),
+            this.info.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _save;
+        let _msg_id;
+        let _info;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _save = Boolean(flags & 1);
+        _msg_id = reader.readInt();
+        _info = reader.tgReadObject();
+        return new this({save:_save,
+	msgId:_msg_id,
+	info:_info})
+    }
+}
+
+
+class SendPaymentFormRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2b8879b3;
+    static SUBCLASS_OF_ID = 0x8ae16a9d;
+
+    /**
+    :returns payments.PaymentResult: Instance of either PaymentResult, PaymentVerificationNeeded
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2b8879b3;
+        this.SUBCLASS_OF_ID = 0x8ae16a9d;
+
+        this.msgId = args.msgId;
+        this.requestedInfoId = args.requestedInfoId || null;
+        this.shippingOptionId = args.shippingOptionId || null;
+        this.credentials = args.credentials;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b379882b","hex"),
+            struct.pack('<I', (this.requestedInfoId === undefined || this.requestedInfoId === false || this.requestedInfoId === null) ? 0 : 1 | (this.shippingOptionId === undefined || this.shippingOptionId === false || this.shippingOptionId === null) ? 0 : 2),
+            struct.pack('<i', this.msgId),
+            (this.requestedInfoId === undefined || this.requestedInfoId === false || this.requestedInfoId ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.requestedInfoId)],
+            (this.shippingOptionId === undefined || this.shippingOptionId === false || this.shippingOptionId ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.shippingOptionId)],
+            this.credentials.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _msg_id;
+        let _requested_info_id;
+        let _shipping_option_id;
+        let _credentials;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _msg_id = reader.readInt();
+        if (flags & 1) {
+            _requested_info_id = reader.tgReadString();
+        }
+        else {
+            _requested_info_id = null
+        }
+        if (flags & 2) {
+            _shipping_option_id = reader.tgReadString();
+        }
+        else {
+            _shipping_option_id = null
+        }
+        _credentials = reader.tgReadObject();
+        return new this({msgId:_msg_id,
+	requestedInfoId:_requested_info_id,
+	shippingOptionId:_shipping_option_id,
+	credentials:_credentials})
+    }
+}
+
+
+class GetSavedInfoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x227d824b;
+    static SUBCLASS_OF_ID = 0xad3cf146;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x227d824b;
+        this.SUBCLASS_OF_ID = 0xad3cf146;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4b827d22","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class ClearSavedInfoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xd83d70c1;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd83d70c1;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.credentials = args.credentials || null;
+        this.info = args.info || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c1703dd8","hex"),
+            struct.pack('<I', (this.credentials === undefined || this.credentials === false || this.credentials === null) ? 0 : 1 | (this.info === undefined || this.info === false || this.info === null) ? 0 : 2),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _credentials;
+        let _info;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _credentials = Boolean(flags & 1);
+        _info = Boolean(flags & 2);
+        return new this({credentials:_credentials,
+	info:_info})
+    }
+}
+
+module.exports = {
+    GetPaymentFormRequest,
+    GetPaymentReceiptRequest,
+    ValidateRequestedInfoRequest,
+    SendPaymentFormRequest,
+    GetSavedInfoRequest,
+    ClearSavedInfoRequest,
+};

+ 354 - 0
src/lib/gramjs/tl/functions/phone.js

@@ -0,0 +1,354 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class GetCallConfigRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x55451fa9;
+    static SUBCLASS_OF_ID = 0xad0352e8;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x55451fa9;
+        this.SUBCLASS_OF_ID = 0xad0352e8;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a91f4555","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class RequestCallRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x42ff96ed;
+    static SUBCLASS_OF_ID = 0xd48afe4f;
+
+    /**
+    :returns phone.PhoneCall: Instance of PhoneCall
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x42ff96ed;
+        this.SUBCLASS_OF_ID = 0xd48afe4f;
+
+        this.video = args.video || null;
+        this.userId = args.userId;
+        this.randomId = args.randomId !== undefined ? args.randomId : readBigIntFromBuffer(generateRandomBytes(4),false,true);
+        this.gAHash = args.gAHash;
+        this.protocol = args.protocol;
+    }
+    async resolve(client, utils) {
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ed96ff42","hex"),
+            struct.pack('<I', (this.video === undefined || this.video === false || this.video === null) ? 0 : 1),
+            this.userId.getBytes(),
+            struct.pack('<i', this.randomId),
+            TLObject.serializeBytes(this.gAHash),
+            this.protocol.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _video;
+        let _user_id;
+        let _random_id;
+        let _g_a_hash;
+        let _protocol;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _video = Boolean(flags & 1);
+        _user_id = reader.tgReadObject();
+        _random_id = reader.readInt();
+        _g_a_hash = reader.tgReadBytes();
+        _protocol = reader.tgReadObject();
+        return new this({video:_video,
+	userId:_user_id,
+	randomId:_random_id,
+	gAHash:_g_a_hash,
+	protocol:_protocol})
+    }
+}
+
+
+class AcceptCallRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x3bd2b4a0;
+    static SUBCLASS_OF_ID = 0xd48afe4f;
+
+    /**
+    :returns phone.PhoneCall: Instance of PhoneCall
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3bd2b4a0;
+        this.SUBCLASS_OF_ID = 0xd48afe4f;
+
+        this.peer = args.peer;
+        this.gB = args.gB;
+        this.protocol = args.protocol;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a0b4d23b","hex"),
+            this.peer.getBytes(),
+            TLObject.serializeBytes(this.gB),
+            this.protocol.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _g_b;
+        let _protocol;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _g_b = reader.tgReadBytes();
+        _protocol = reader.tgReadObject();
+        return new this({peer:_peer,
+	gB:_g_b,
+	protocol:_protocol})
+    }
+}
+
+
+class ConfirmCallRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2efe1722;
+    static SUBCLASS_OF_ID = 0xd48afe4f;
+
+    /**
+    :returns phone.PhoneCall: Instance of PhoneCall
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2efe1722;
+        this.SUBCLASS_OF_ID = 0xd48afe4f;
+
+        this.peer = args.peer;
+        this.gA = args.gA;
+        this.keyFingerprint = args.keyFingerprint;
+        this.protocol = args.protocol;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2217fe2e","hex"),
+            this.peer.getBytes(),
+            TLObject.serializeBytes(this.gA),
+            readBufferFromBigInt(this.keyFingerprint,8,true,true),
+            this.protocol.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _g_a;
+        let _key_fingerprint;
+        let _protocol;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _g_a = reader.tgReadBytes();
+        _key_fingerprint = reader.readLong();
+        _protocol = reader.tgReadObject();
+        return new this({peer:_peer,
+	gA:_g_a,
+	keyFingerprint:_key_fingerprint,
+	protocol:_protocol})
+    }
+}
+
+
+class ReceivedCallRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x17d54f61;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x17d54f61;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("614fd517","hex"),
+            this.peer.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        return new this({peer:_peer})
+    }
+}
+
+
+class DiscardCallRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xb2cbc1c0;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb2cbc1c0;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.video = args.video || null;
+        this.peer = args.peer;
+        this.duration = args.duration;
+        this.reason = args.reason;
+        this.connectionId = args.connectionId;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c0c1cbb2","hex"),
+            struct.pack('<I', (this.video === undefined || this.video === false || this.video === null) ? 0 : 1),
+            this.peer.getBytes(),
+            struct.pack('<i', this.duration),
+            this.reason.getBytes(),
+            readBufferFromBigInt(this.connectionId,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _video;
+        let _peer;
+        let _duration;
+        let _reason;
+        let _connection_id;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _video = Boolean(flags & 1);
+        _peer = reader.tgReadObject();
+        _duration = reader.readInt();
+        _reason = reader.tgReadObject();
+        _connection_id = reader.readLong();
+        return new this({video:_video,
+	peer:_peer,
+	duration:_duration,
+	reason:_reason,
+	connectionId:_connection_id})
+    }
+}
+
+
+class SetCallRatingRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x59ead627;
+    static SUBCLASS_OF_ID = 0x8af52aac;
+
+    /**
+    :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x59ead627;
+        this.SUBCLASS_OF_ID = 0x8af52aac;
+
+        this.userInitiative = args.userInitiative || null;
+        this.peer = args.peer;
+        this.rating = args.rating;
+        this.comment = args.comment;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("27d6ea59","hex"),
+            struct.pack('<I', (this.userInitiative === undefined || this.userInitiative === false || this.userInitiative === null) ? 0 : 1),
+            this.peer.getBytes(),
+            struct.pack('<i', this.rating),
+            TLObject.serializeBytes(this.comment),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _user_initiative;
+        let _peer;
+        let _rating;
+        let _comment;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _user_initiative = Boolean(flags & 1);
+        _peer = reader.tgReadObject();
+        _rating = reader.readInt();
+        _comment = reader.tgReadString();
+        return new this({userInitiative:_user_initiative,
+	peer:_peer,
+	rating:_rating,
+	comment:_comment})
+    }
+}
+
+
+class SaveCallDebugRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x277add7e;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x277add7e;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.peer = args.peer;
+        this.debug = args.debug;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("7edd7a27","hex"),
+            this.peer.getBytes(),
+            this.debug.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _debug;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        _debug = reader.tgReadObject();
+        return new this({peer:_peer,
+	debug:_debug})
+    }
+}
+
+module.exports = {
+    GetCallConfigRequest,
+    RequestCallRequest,
+    AcceptCallRequest,
+    ConfirmCallRequest,
+    ReceivedCallRequest,
+    DiscardCallRequest,
+    SetCallRatingRequest,
+    SaveCallDebugRequest,
+};

+ 179 - 0
src/lib/gramjs/tl/functions/photos.js

@@ -0,0 +1,179 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class UpdateProfilePhotoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf0bb5152;
+    static SUBCLASS_OF_ID = 0xc6338f7d;
+
+    /**
+    :returns UserProfilePhoto: Instance of either UserProfilePhotoEmpty, UserProfilePhoto
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf0bb5152;
+        this.SUBCLASS_OF_ID = 0xc6338f7d;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputPhoto(this.id)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5251bbf0","hex"),
+            this.id.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        return new this({id:_id})
+    }
+}
+
+
+class UploadProfilePhotoRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x4f32c098;
+    static SUBCLASS_OF_ID = 0xc292bd24;
+
+    /**
+    :returns photos.Photo: Instance of Photo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4f32c098;
+        this.SUBCLASS_OF_ID = 0xc292bd24;
+
+        this.file = args.file;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("98c0324f","hex"),
+            this.file.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _file;
+        let _x;
+        let len;
+        _file = reader.tgReadObject();
+        return new this({file:_file})
+    }
+}
+
+
+class DeletePhotosRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x87cf7f2f;
+    static SUBCLASS_OF_ID = 0x8918e168;
+
+    /**
+    :returns Vector<long>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x87cf7f2f;
+        this.SUBCLASS_OF_ID = 0x8918e168;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        const _tmp = [];for (const _x of this.id) {
+            _tmp.push(utils.getInputPhoto(_x));
+        }
+        this.id = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2f7fcf87","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _id.push(_x);
+            }
+            return new this({id:_id})
+        }
+        readResult(reader){
+            reader.readInt();  // Vector ID
+            let temp = [];
+            let len = reader.readInt(); //fix this
+            for (let i=0;i<len;i++){
+                temp.push(reader.readLong())
+            }
+            return temp
+        }
+    }
+
+
+class GetUserPhotosRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x91cd32a8;
+    static SUBCLASS_OF_ID = 0x27cfb967;
+
+    /**
+    :returns photos.Photos: Instance of either Photos, PhotosSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x91cd32a8;
+        this.SUBCLASS_OF_ID = 0x27cfb967;
+
+        this.userId = args.userId;
+        this.offset = args.offset;
+        this.maxId = args.maxId;
+        this.limit = args.limit;
+    }
+    async resolve(client, utils) {
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a832cd91","hex"),
+            this.userId.getBytes(),
+            struct.pack('<i', this.offset),
+            readBufferFromBigInt(this.maxId,8,true,true),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _user_id;
+        let _offset;
+        let _max_id;
+        let _limit;
+        let _x;
+        let len;
+        _user_id = reader.tgReadObject();
+        _offset = reader.readInt();
+        _max_id = reader.readLong();
+        _limit = reader.readInt();
+        return new this({userId:_user_id,
+	offset:_offset,
+	maxId:_max_id,
+	limit:_limit})
+    }
+}
+
+module.exports = {
+    UpdateProfilePhotoRequest,
+    UploadProfilePhotoRequest,
+    DeletePhotosRequest,
+    GetUserPhotosRequest,
+};

+ 185 - 0
src/lib/gramjs/tl/functions/stickers.js

@@ -0,0 +1,185 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class CreateStickerSetRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x9bd86e6a;
+    static SUBCLASS_OF_ID = 0x9b704a5a;
+
+    /**
+    :returns messages.StickerSet: Instance of StickerSet
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x9bd86e6a;
+        this.SUBCLASS_OF_ID = 0x9b704a5a;
+
+        this.masks = args.masks || null;
+        this.userId = args.userId;
+        this.title = args.title;
+        this.shortName = args.shortName;
+        this.stickers = args.stickers;
+    }
+    async resolve(client, utils) {
+        this.user_id = utils.getInputUser(await client.getInputEntity(this.userId))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6a6ed89b","hex"),
+            struct.pack('<I', (this.masks === undefined || this.masks === false || this.masks === null) ? 0 : 1),
+            this.userId.getBytes(),
+            TLObject.serializeBytes(this.title),
+            TLObject.serializeBytes(this.shortName),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.stickers.length),Buffer.concat(this.stickers.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _masks;
+        let _user_id;
+        let _title;
+        let _short_name;
+        let _stickers;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _masks = Boolean(flags & 1);
+        _user_id = reader.tgReadObject();
+        _title = reader.tgReadString();
+        _short_name = reader.tgReadString();
+        reader.readInt();
+        _stickers = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _stickers.push(_x);
+            }
+            return new this({masks:_masks,
+	userId:_user_id,
+	title:_title,
+	shortName:_short_name,
+	stickers:_stickers})
+        }
+    }
+
+
+class RemoveStickerFromSetRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xf7760f51;
+    static SUBCLASS_OF_ID = 0x9b704a5a;
+
+    /**
+    :returns messages.StickerSet: Instance of StickerSet
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf7760f51;
+        this.SUBCLASS_OF_ID = 0x9b704a5a;
+
+        this.sticker = args.sticker;
+    }
+    async resolve(client, utils) {
+        this.sticker = utils.getInputDocument(this.sticker)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("510f76f7","hex"),
+            this.sticker.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _sticker;
+        let _x;
+        let len;
+        _sticker = reader.tgReadObject();
+        return new this({sticker:_sticker})
+    }
+}
+
+
+class ChangeStickerPositionRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xffb6d4ca;
+    static SUBCLASS_OF_ID = 0x9b704a5a;
+
+    /**
+    :returns messages.StickerSet: Instance of StickerSet
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xffb6d4ca;
+        this.SUBCLASS_OF_ID = 0x9b704a5a;
+
+        this.sticker = args.sticker;
+        this.position = args.position;
+    }
+    async resolve(client, utils) {
+        this.sticker = utils.getInputDocument(this.sticker)
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("cad4b6ff","hex"),
+            this.sticker.getBytes(),
+            struct.pack('<i', this.position),
+            ])
+        }
+    static fromReader(reader) {
+        let _sticker;
+        let _position;
+        let _x;
+        let len;
+        _sticker = reader.tgReadObject();
+        _position = reader.readInt();
+        return new this({sticker:_sticker,
+	position:_position})
+    }
+}
+
+
+class AddStickerToSetRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x8653febe;
+    static SUBCLASS_OF_ID = 0x9b704a5a;
+
+    /**
+    :returns messages.StickerSet: Instance of StickerSet
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8653febe;
+        this.SUBCLASS_OF_ID = 0x9b704a5a;
+
+        this.stickerset = args.stickerset;
+        this.sticker = args.sticker;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("befe5386","hex"),
+            this.stickerset.getBytes(),
+            this.sticker.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _stickerset;
+        let _sticker;
+        let _x;
+        let len;
+        _stickerset = reader.tgReadObject();
+        _sticker = reader.tgReadObject();
+        return new this({stickerset:_stickerset,
+	sticker:_sticker})
+    }
+}
+
+module.exports = {
+    CreateStickerSetRequest,
+    RemoveStickerFromSetRequest,
+    ChangeStickerPositionRequest,
+    AddStickerToSetRequest,
+};

+ 147 - 0
src/lib/gramjs/tl/functions/updates.js

@@ -0,0 +1,147 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class GetStateRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xedd4882a;
+    static SUBCLASS_OF_ID = 0x23df1a01;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xedd4882a;
+        this.SUBCLASS_OF_ID = 0x23df1a01;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2a88d4ed","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class GetDifferenceRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x25939651;
+    static SUBCLASS_OF_ID = 0x20482874;
+
+    /**
+    :returns updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x25939651;
+        this.SUBCLASS_OF_ID = 0x20482874;
+
+        this.pts = args.pts;
+        this.ptsTotalLimit = args.ptsTotalLimit || null;
+        this.date = args.date;
+        this.qts = args.qts;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("51969325","hex"),
+            struct.pack('<I', (this.ptsTotalLimit === undefined || this.ptsTotalLimit === false || this.ptsTotalLimit === null) ? 0 : 1),
+            struct.pack('<i', this.pts),
+            (this.ptsTotalLimit === undefined || this.ptsTotalLimit === false || this.ptsTotalLimit ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.ptsTotalLimit)],
+            struct.pack('<i', this.date),
+            struct.pack('<i', this.qts),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _pts;
+        let _pts_total_limit;
+        let _date;
+        let _qts;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _pts = reader.readInt();
+        if (flags & 1) {
+            _pts_total_limit = reader.readInt();
+        }
+        else {
+            _pts_total_limit = null
+        }
+        _date = reader.readInt();
+        _qts = reader.readInt();
+        return new this({pts:_pts,
+	ptsTotalLimit:_pts_total_limit,
+	date:_date,
+	qts:_qts})
+    }
+}
+
+
+class GetChannelDifferenceRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x03173d78;
+    static SUBCLASS_OF_ID = 0x29896f5d;
+
+    /**
+    :returns updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x03173d78;
+        this.SUBCLASS_OF_ID = 0x29896f5d;
+
+        this.force = args.force || null;
+        this.channel = args.channel;
+        this.filter = args.filter;
+        this.pts = args.pts;
+        this.limit = args.limit;
+    }
+    async resolve(client, utils) {
+        this.channel = utils.getInputChannel(await client.getInputEntity(this.channel))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("783d1703","hex"),
+            struct.pack('<I', (this.force === undefined || this.force === false || this.force === null) ? 0 : 1),
+            this.channel.getBytes(),
+            this.filter.getBytes(),
+            struct.pack('<i', this.pts),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _force;
+        let _channel;
+        let _filter;
+        let _pts;
+        let _limit;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _force = Boolean(flags & 1);
+        _channel = reader.tgReadObject();
+        _filter = reader.tgReadObject();
+        _pts = reader.readInt();
+        _limit = reader.readInt();
+        return new this({force:_force,
+	channel:_channel,
+	filter:_filter,
+	pts:_pts,
+	limit:_limit})
+    }
+}
+
+module.exports = {
+    GetStateRequest,
+    GetDifferenceRequest,
+    GetChannelDifferenceRequest,
+};

+ 343 - 0
src/lib/gramjs/tl/functions/upload.js

@@ -0,0 +1,343 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class SaveFilePartRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xb304a621;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb304a621;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.fileId = args.fileId;
+        this.filePart = args.filePart;
+        this.bytes = args.bytes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("21a604b3","hex"),
+            readBufferFromBigInt(this.fileId,8,true,true),
+            struct.pack('<i', this.filePart),
+            TLObject.serializeBytes(this.bytes),
+            ])
+        }
+    static fromReader(reader) {
+        let _file_id;
+        let _file_part;
+        let _bytes;
+        let _x;
+        let len;
+        _file_id = reader.readLong();
+        _file_part = reader.readInt();
+        _bytes = reader.tgReadBytes();
+        return new this({fileId:_file_id,
+	filePart:_file_part,
+	bytes:_bytes})
+    }
+}
+
+
+class GetFileRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xb15a9afc;
+    static SUBCLASS_OF_ID = 0x6c9bd728;
+
+    /**
+    :returns upload.File: Instance of either File, FileCdnRedirect
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb15a9afc;
+        this.SUBCLASS_OF_ID = 0x6c9bd728;
+
+        this.precise = args.precise || null;
+        this.location = args.location;
+        this.offset = args.offset;
+        this.limit = args.limit;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("fc9a5ab1","hex"),
+            struct.pack('<I', (this.precise === undefined || this.precise === false || this.precise === null) ? 0 : 1),
+            this.location.getBytes(),
+            struct.pack('<i', this.offset),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _precise;
+        let _location;
+        let _offset;
+        let _limit;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _precise = Boolean(flags & 1);
+        _location = reader.tgReadObject();
+        _offset = reader.readInt();
+        _limit = reader.readInt();
+        return new this({precise:_precise,
+	location:_location,
+	offset:_offset,
+	limit:_limit})
+    }
+}
+
+
+class SaveBigFilePartRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xde7b673d;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xde7b673d;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.fileId = args.fileId;
+        this.filePart = args.filePart;
+        this.fileTotalParts = args.fileTotalParts;
+        this.bytes = args.bytes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3d677bde","hex"),
+            readBufferFromBigInt(this.fileId,8,true,true),
+            struct.pack('<i', this.filePart),
+            struct.pack('<i', this.fileTotalParts),
+            TLObject.serializeBytes(this.bytes),
+            ])
+        }
+    static fromReader(reader) {
+        let _file_id;
+        let _file_part;
+        let _file_total_parts;
+        let _bytes;
+        let _x;
+        let len;
+        _file_id = reader.readLong();
+        _file_part = reader.readInt();
+        _file_total_parts = reader.readInt();
+        _bytes = reader.tgReadBytes();
+        return new this({fileId:_file_id,
+	filePart:_file_part,
+	fileTotalParts:_file_total_parts,
+	bytes:_bytes})
+    }
+}
+
+
+class GetWebFileRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x24e6818d;
+    static SUBCLASS_OF_ID = 0x68f17f51;
+
+    /**
+    :returns upload.WebFile: Instance of WebFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x24e6818d;
+        this.SUBCLASS_OF_ID = 0x68f17f51;
+
+        this.location = args.location;
+        this.offset = args.offset;
+        this.limit = args.limit;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8d81e624","hex"),
+            this.location.getBytes(),
+            struct.pack('<i', this.offset),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _location;
+        let _offset;
+        let _limit;
+        let _x;
+        let len;
+        _location = reader.tgReadObject();
+        _offset = reader.readInt();
+        _limit = reader.readInt();
+        return new this({location:_location,
+	offset:_offset,
+	limit:_limit})
+    }
+}
+
+
+class GetCdnFileRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x2000bcc3;
+    static SUBCLASS_OF_ID = 0xf5ccf928;
+
+    /**
+    :returns upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2000bcc3;
+        this.SUBCLASS_OF_ID = 0xf5ccf928;
+
+        this.fileToken = args.fileToken;
+        this.offset = args.offset;
+        this.limit = args.limit;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c3bc0020","hex"),
+            TLObject.serializeBytes(this.fileToken),
+            struct.pack('<i', this.offset),
+            struct.pack('<i', this.limit),
+            ])
+        }
+    static fromReader(reader) {
+        let _file_token;
+        let _offset;
+        let _limit;
+        let _x;
+        let len;
+        _file_token = reader.tgReadBytes();
+        _offset = reader.readInt();
+        _limit = reader.readInt();
+        return new this({fileToken:_file_token,
+	offset:_offset,
+	limit:_limit})
+    }
+}
+
+
+class ReuploadCdnFileRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x9b2754a8;
+    static SUBCLASS_OF_ID = 0xa5940726;
+
+    /**
+    :returns Vector<FileHash>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x9b2754a8;
+        this.SUBCLASS_OF_ID = 0xa5940726;
+
+        this.fileToken = args.fileToken;
+        this.requestToken = args.requestToken;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a854279b","hex"),
+            TLObject.serializeBytes(this.fileToken),
+            TLObject.serializeBytes(this.requestToken),
+            ])
+        }
+    static fromReader(reader) {
+        let _file_token;
+        let _request_token;
+        let _x;
+        let len;
+        _file_token = reader.tgReadBytes();
+        _request_token = reader.tgReadBytes();
+        return new this({fileToken:_file_token,
+	requestToken:_request_token})
+    }
+}
+
+
+class GetCdnFileHashesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x4da54231;
+    static SUBCLASS_OF_ID = 0xa5940726;
+
+    /**
+    :returns Vector<FileHash>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4da54231;
+        this.SUBCLASS_OF_ID = 0xa5940726;
+
+        this.fileToken = args.fileToken;
+        this.offset = args.offset;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3142a54d","hex"),
+            TLObject.serializeBytes(this.fileToken),
+            struct.pack('<i', this.offset),
+            ])
+        }
+    static fromReader(reader) {
+        let _file_token;
+        let _offset;
+        let _x;
+        let len;
+        _file_token = reader.tgReadBytes();
+        _offset = reader.readInt();
+        return new this({fileToken:_file_token,
+	offset:_offset})
+    }
+}
+
+
+class GetFileHashesRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xc7025931;
+    static SUBCLASS_OF_ID = 0xa5940726;
+
+    /**
+    :returns Vector<FileHash>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc7025931;
+        this.SUBCLASS_OF_ID = 0xa5940726;
+
+        this.location = args.location;
+        this.offset = args.offset;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("315902c7","hex"),
+            this.location.getBytes(),
+            struct.pack('<i', this.offset),
+            ])
+        }
+    static fromReader(reader) {
+        let _location;
+        let _offset;
+        let _x;
+        let len;
+        _location = reader.tgReadObject();
+        _offset = reader.readInt();
+        return new this({location:_location,
+	offset:_offset})
+    }
+}
+
+module.exports = {
+    SaveFilePartRequest,
+    GetFileRequest,
+    SaveBigFilePartRequest,
+    GetWebFileRequest,
+    GetCdnFileRequest,
+    ReuploadCdnFileRequest,
+    GetCdnFileHashesRequest,
+    GetFileHashesRequest,
+};

+ 134 - 0
src/lib/gramjs/tl/functions/users.js

@@ -0,0 +1,134 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const { TLRequest } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class GetUsersRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x0d91a548;
+    static SUBCLASS_OF_ID = 0x406da4d;
+
+    /**
+    :returns Vector<User>: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x0d91a548;
+        this.SUBCLASS_OF_ID = 0x406da4d;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        const _tmp = [];for (const _x of this.id) {
+            _tmp.push(utils.getInputUser(await client.getInputEntity(_x)));
+        }
+        this.id = _tmp;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("48a5910d","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.id.length),Buffer.concat(this.id.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        reader.readInt();
+        _id = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _id.push(_x);
+            }
+            return new this({id:_id})
+        }
+    }
+
+
+class GetFullUserRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0xca30a5b1;
+    static SUBCLASS_OF_ID = 0x1f4661b9;
+
+    /**
+    :returns UserFull: Instance of UserFull
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xca30a5b1;
+        this.SUBCLASS_OF_ID = 0x1f4661b9;
+
+        this.id = args.id;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputUser(await client.getInputEntity(this.id))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b1a530ca","hex"),
+            this.id.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        return new this({id:_id})
+    }
+}
+
+
+class SetSecureValueErrorsRequest extends TLRequest {
+    static CONSTRUCTOR_ID = 0x90c894b5;
+    static SUBCLASS_OF_ID = 0xf5b399ac;
+
+    /**
+    :returns Bool: This type has no constructors.
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x90c894b5;
+        this.SUBCLASS_OF_ID = 0xf5b399ac;
+
+        this.id = args.id;
+        this.errors = args.errors;
+    }
+    async resolve(client, utils) {
+        this.id = utils.getInputUser(await client.getInputEntity(this.id))
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b594c890","hex"),
+            this.id.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.errors.length),Buffer.concat(this.errors.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _errors;
+        let _x;
+        let len;
+        _id = reader.tgReadObject();
+        reader.readInt();
+        _errors = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _errors.push(_x);
+            }
+            return new this({id:_id,
+	errors:_errors})
+        }
+    }
+
+module.exports = {
+    GetUsersRequest,
+    GetFullUserRequest,
+    SetSecureValueErrorsRequest,
+};

+ 766 - 0
src/lib/gramjs/tl/types/account.js

@@ -0,0 +1,766 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class PrivacyRules extends TLObject {
+    static CONSTRUCTOR_ID = 0x50a04e45;
+    static SUBCLASS_OF_ID = 0xb55aba82;
+
+    /**
+    Constructor for account.PrivacyRules: Instance of PrivacyRules
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x50a04e45;
+        this.SUBCLASS_OF_ID = 0xb55aba82;
+
+        this.rules = args.rules;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("454ea050","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.rules.length),Buffer.concat(this.rules.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _rules;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _rules = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _rules.push(_x);
+            }
+            reader.readInt();
+            _chats = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _chats.push(_x);
+                }
+                reader.readInt();
+                _users = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _users.push(_x);
+                    }
+                    return new this({rules:_rules,
+	chats:_chats,
+	users:_users})
+                }
+            }
+
+
+class Authorizations extends TLObject {
+    static CONSTRUCTOR_ID = 0x1250abde;
+    static SUBCLASS_OF_ID = 0xbf5e0ff;
+
+    /**
+    Constructor for account.Authorizations: Instance of Authorizations
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1250abde;
+        this.SUBCLASS_OF_ID = 0xbf5e0ff;
+
+        this.authorizations = args.authorizations;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("deab5012","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.authorizations.length),Buffer.concat(this.authorizations.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _authorizations;
+        let _x;
+        let len;
+        reader.readInt();
+        _authorizations = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _authorizations.push(_x);
+            }
+            return new this({authorizations:_authorizations})
+        }
+    }
+
+
+class Password extends TLObject {
+    static CONSTRUCTOR_ID = 0xad2641f8;
+    static SUBCLASS_OF_ID = 0x53a211a3;
+
+    /**
+    Constructor for account.Password: Instance of Password
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xad2641f8;
+        this.SUBCLASS_OF_ID = 0x53a211a3;
+
+        this.hasRecovery = args.hasRecovery || null;
+        this.hasSecureValues = args.hasSecureValues || null;
+        this.hasPassword = args.hasPassword || null;
+        this.currentAlgo = args.currentAlgo || null;
+        this.srp_B = args.srp_B || null;
+        this.srpId = args.srpId || null;
+        this.hint = args.hint || null;
+        this.emailUnconfirmedPattern = args.emailUnconfirmedPattern || null;
+        this.newAlgo = args.newAlgo;
+        this.newSecureAlgo = args.newSecureAlgo;
+        this.secureRandom = args.secureRandom;
+    }
+    getBytes() {
+        if (!((this.has_password || this.has_password!==null && this.current_algo || this.current_algo!==null && this.srp_B || this.srp_B!==null && this.srp_id || this.srp_id!==null) && (this.has_password===null || this.has_password===false && this.current_algo===null || this.current_algo===false && this.srp_B===null || this.srp_B===false && this.srp_id===null || this.srp_id===false)))
+	 throw new Error('has_password, current_algo, srp_B, srp_id paramaters must all be false-y or all true')
+        return Buffer.concat([
+            Buffer.from("f84126ad","hex"),
+            struct.pack('<I', (this.hasRecovery === undefined || this.hasRecovery === false || this.hasRecovery === null) ? 0 : 1 | (this.hasSecureValues === undefined || this.hasSecureValues === false || this.hasSecureValues === null) ? 0 : 2 | (this.hasPassword === undefined || this.hasPassword === false || this.hasPassword === null) ? 0 : 4 | (this.currentAlgo === undefined || this.currentAlgo === false || this.currentAlgo === null) ? 0 : 4 | (this.srp_B === undefined || this.srp_B === false || this.srp_B === null) ? 0 : 4 | (this.srpId === undefined || this.srpId === false || this.srpId === null) ? 0 : 4 | (this.hint === undefined || this.hint === false || this.hint === null) ? 0 : 8 | (this.emailUnconfirmedPattern === undefined || this.emailUnconfirmedPattern === false || this.emailUnconfirmedPattern === null) ? 0 : 16),
+            (this.currentAlgo === undefined || this.currentAlgo === false || this.currentAlgo ===null) ? Buffer.alloc(0) : [this.currentAlgo.getBytes()],
+            (this.srp_B === undefined || this.srp_B === false || this.srp_B ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.srp_B)],
+            (this.srpId === undefined || this.srpId === false || this.srpId ===null) ? Buffer.alloc(0) : [readBufferFromBigInt(this.srpId,8,true,true)],
+            (this.hint === undefined || this.hint === false || this.hint ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.hint)],
+            (this.emailUnconfirmedPattern === undefined || this.emailUnconfirmedPattern === false || this.emailUnconfirmedPattern ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.emailUnconfirmedPattern)],
+            this.newAlgo.getBytes(),
+            this.newSecureAlgo.getBytes(),
+            TLObject.serializeBytes(this.secureRandom),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _has_recovery;
+        let _has_secure_values;
+        let _has_password;
+        let _current_algo;
+        let _srp_B;
+        let _srp_id;
+        let _hint;
+        let _email_unconfirmed_pattern;
+        let _new_algo;
+        let _new_secure_algo;
+        let _secure_random;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _has_recovery = Boolean(flags & 1);
+        _has_secure_values = Boolean(flags & 2);
+        _has_password = Boolean(flags & 4);
+        if (flags & 4) {
+            _current_algo = reader.tgReadObject();
+        }
+        else {
+            _current_algo = null
+        }
+        if (flags & 4) {
+            _srp_B = reader.tgReadBytes();
+        }
+        else {
+            _srp_B = null
+        }
+        if (flags & 4) {
+            _srp_id = reader.readLong();
+        }
+        else {
+            _srp_id = null
+        }
+        if (flags & 8) {
+            _hint = reader.tgReadString();
+        }
+        else {
+            _hint = null
+        }
+        if (flags & 16) {
+            _email_unconfirmed_pattern = reader.tgReadString();
+        }
+        else {
+            _email_unconfirmed_pattern = null
+        }
+        _new_algo = reader.tgReadObject();
+        _new_secure_algo = reader.tgReadObject();
+        _secure_random = reader.tgReadBytes();
+        return new this({hasRecovery:_has_recovery,
+	hasSecureValues:_has_secure_values,
+	hasPassword:_has_password,
+	currentAlgo:_current_algo,
+	srp_B:_srp_B,
+	srpId:_srp_id,
+	hint:_hint,
+	emailUnconfirmedPattern:_email_unconfirmed_pattern,
+	newAlgo:_new_algo,
+	newSecureAlgo:_new_secure_algo,
+	secureRandom:_secure_random})
+    }
+}
+
+
+class PasswordSettings extends TLObject {
+    static CONSTRUCTOR_ID = 0x9a5c33e5;
+    static SUBCLASS_OF_ID = 0xd23fb078;
+
+    /**
+    Constructor for account.PasswordSettings: Instance of PasswordSettings
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x9a5c33e5;
+        this.SUBCLASS_OF_ID = 0xd23fb078;
+
+        this.email = args.email || null;
+        this.secureSettings = args.secureSettings || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e5335c9a","hex"),
+            struct.pack('<I', (this.email === undefined || this.email === false || this.email === null) ? 0 : 1 | (this.secureSettings === undefined || this.secureSettings === false || this.secureSettings === null) ? 0 : 2),
+            (this.email === undefined || this.email === false || this.email ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.email)],
+            (this.secureSettings === undefined || this.secureSettings === false || this.secureSettings ===null) ? Buffer.alloc(0) : [this.secureSettings.getBytes()],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _email;
+        let _secure_settings;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        if (flags & 1) {
+            _email = reader.tgReadString();
+        }
+        else {
+            _email = null
+        }
+        if (flags & 2) {
+            _secure_settings = reader.tgReadObject();
+        }
+        else {
+            _secure_settings = null
+        }
+        return new this({email:_email,
+	secureSettings:_secure_settings})
+    }
+}
+
+
+class PasswordInputSettings extends TLObject {
+    static CONSTRUCTOR_ID = 0xc23727c9;
+    static SUBCLASS_OF_ID = 0xc426ca6;
+
+    /**
+    Constructor for account.PasswordInputSettings: Instance of PasswordInputSettings
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc23727c9;
+        this.SUBCLASS_OF_ID = 0xc426ca6;
+
+        this.newAlgo = args.newAlgo || null;
+        this.newPasswordHash = args.newPasswordHash || null;
+        this.hint = args.hint || null;
+        this.email = args.email || null;
+        this.newSecureSettings = args.newSecureSettings || null;
+    }
+    getBytes() {
+        if (!((this.new_algo || this.new_algo!==null && this.new_password_hash || this.new_password_hash!==null && this.hint || this.hint!==null) && (this.new_algo===null || this.new_algo===false && this.new_password_hash===null || this.new_password_hash===false && this.hint===null || this.hint===false)))
+	 throw new Error('new_algo, new_password_hash, hint paramaters must all be false-y or all true')
+        return Buffer.concat([
+            Buffer.from("c92737c2","hex"),
+            struct.pack('<I', (this.newAlgo === undefined || this.newAlgo === false || this.newAlgo === null) ? 0 : 1 | (this.newPasswordHash === undefined || this.newPasswordHash === false || this.newPasswordHash === null) ? 0 : 1 | (this.hint === undefined || this.hint === false || this.hint === null) ? 0 : 1 | (this.email === undefined || this.email === false || this.email === null) ? 0 : 2 | (this.newSecureSettings === undefined || this.newSecureSettings === false || this.newSecureSettings === null) ? 0 : 4),
+            (this.newAlgo === undefined || this.newAlgo === false || this.newAlgo ===null) ? Buffer.alloc(0) : [this.newAlgo.getBytes()],
+            (this.newPasswordHash === undefined || this.newPasswordHash === false || this.newPasswordHash ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.newPasswordHash)],
+            (this.hint === undefined || this.hint === false || this.hint ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.hint)],
+            (this.email === undefined || this.email === false || this.email ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.email)],
+            (this.newSecureSettings === undefined || this.newSecureSettings === false || this.newSecureSettings ===null) ? Buffer.alloc(0) : [this.newSecureSettings.getBytes()],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _new_algo;
+        let _new_password_hash;
+        let _hint;
+        let _email;
+        let _new_secure_settings;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        if (flags & 1) {
+            _new_algo = reader.tgReadObject();
+        }
+        else {
+            _new_algo = null
+        }
+        if (flags & 1) {
+            _new_password_hash = reader.tgReadBytes();
+        }
+        else {
+            _new_password_hash = null
+        }
+        if (flags & 1) {
+            _hint = reader.tgReadString();
+        }
+        else {
+            _hint = null
+        }
+        if (flags & 2) {
+            _email = reader.tgReadString();
+        }
+        else {
+            _email = null
+        }
+        if (flags & 4) {
+            _new_secure_settings = reader.tgReadObject();
+        }
+        else {
+            _new_secure_settings = null
+        }
+        return new this({newAlgo:_new_algo,
+	newPasswordHash:_new_password_hash,
+	hint:_hint,
+	email:_email,
+	newSecureSettings:_new_secure_settings})
+    }
+}
+
+
+class TmpPassword extends TLObject {
+    static CONSTRUCTOR_ID = 0xdb64fd34;
+    static SUBCLASS_OF_ID = 0xb064992d;
+
+    /**
+    Constructor for account.TmpPassword: Instance of TmpPassword
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xdb64fd34;
+        this.SUBCLASS_OF_ID = 0xb064992d;
+
+        this.tmpPassword = args.tmpPassword;
+        this.validUntil = args.validUntil;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("34fd64db","hex"),
+            TLObject.serializeBytes(this.tmpPassword),
+            struct.pack('<i', this.validUntil),
+            ])
+        }
+    static fromReader(reader) {
+        let _tmp_password;
+        let _valid_until;
+        let _x;
+        let len;
+        _tmp_password = reader.tgReadBytes();
+        _valid_until = reader.readInt();
+        return new this({tmpPassword:_tmp_password,
+	validUntil:_valid_until})
+    }
+}
+
+
+class WebAuthorizations extends TLObject {
+    static CONSTRUCTOR_ID = 0xed56c9fc;
+    static SUBCLASS_OF_ID = 0x9a365b32;
+
+    /**
+    Constructor for account.WebAuthorizations: Instance of WebAuthorizations
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xed56c9fc;
+        this.SUBCLASS_OF_ID = 0x9a365b32;
+
+        this.authorizations = args.authorizations;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("fcc956ed","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.authorizations.length),Buffer.concat(this.authorizations.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _authorizations;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _authorizations = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _authorizations.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({authorizations:_authorizations,
+	users:_users})
+            }
+        }
+
+
+class AuthorizationForm extends TLObject {
+    static CONSTRUCTOR_ID = 0xad2e1cd8;
+    static SUBCLASS_OF_ID = 0x78049a94;
+
+    /**
+    Constructor for account.AuthorizationForm: Instance of AuthorizationForm
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xad2e1cd8;
+        this.SUBCLASS_OF_ID = 0x78049a94;
+
+        this.requiredTypes = args.requiredTypes;
+        this.values = args.values;
+        this.errors = args.errors;
+        this.users = args.users;
+        this.privacyPolicyUrl = args.privacyPolicyUrl || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d81c2ead","hex"),
+            struct.pack('<I', (this.privacyPolicyUrl === undefined || this.privacyPolicyUrl === false || this.privacyPolicyUrl === null) ? 0 : 1),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.requiredTypes.length),Buffer.concat(this.requiredTypes.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.values.length),Buffer.concat(this.values.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.errors.length),Buffer.concat(this.errors.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            (this.privacyPolicyUrl === undefined || this.privacyPolicyUrl === false || this.privacyPolicyUrl ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.privacyPolicyUrl)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _required_types;
+        let _values;
+        let _errors;
+        let _users;
+        let _privacy_policy_url;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        reader.readInt();
+        _required_types = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _required_types.push(_x);
+            }
+            reader.readInt();
+            _values = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _values.push(_x);
+                }
+                reader.readInt();
+                _errors = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _errors.push(_x);
+                    }
+                    reader.readInt();
+                    _users = [];
+                    len = reader.readInt();
+                    for (let i=0;i<len;i++){
+                        _x = reader.tgReadObject();
+                        _users.push(_x);
+                        }
+                        if (flags & 1) {
+                            _privacy_policy_url = reader.tgReadString();
+                        }
+                        else {
+                            _privacy_policy_url = null
+                        }
+                        return new this({requiredTypes:_required_types,
+	values:_values,
+	errors:_errors,
+	users:_users,
+	privacyPolicyUrl:_privacy_policy_url})
+                    }
+                }
+
+
+class SentEmailCode extends TLObject {
+    static CONSTRUCTOR_ID = 0x811f854f;
+    static SUBCLASS_OF_ID = 0x69f3c06e;
+
+    /**
+    Constructor for account.SentEmailCode: Instance of SentEmailCode
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x811f854f;
+        this.SUBCLASS_OF_ID = 0x69f3c06e;
+
+        this.emailPattern = args.emailPattern;
+        this.length = args.length;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4f851f81","hex"),
+            TLObject.serializeBytes(this.emailPattern),
+            struct.pack('<i', this.length),
+            ])
+        }
+    static fromReader(reader) {
+        let _email_pattern;
+        let _length;
+        let _x;
+        let len;
+        _email_pattern = reader.tgReadString();
+        _length = reader.readInt();
+        return new this({emailPattern:_email_pattern,
+	length:_length})
+    }
+}
+
+
+class Takeout extends TLObject {
+    static CONSTRUCTOR_ID = 0x4dba4501;
+    static SUBCLASS_OF_ID = 0x843ebe85;
+
+    /**
+    Constructor for account.Takeout: Instance of Takeout
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4dba4501;
+        this.SUBCLASS_OF_ID = 0x843ebe85;
+
+        this.id = args.id;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0145ba4d","hex"),
+            readBufferFromBigInt(this.id,8,true,true),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _x;
+        let len;
+        _id = reader.readLong();
+        return new this({id:_id})
+    }
+}
+
+
+class WallPapersNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0x1c199183;
+    static SUBCLASS_OF_ID = 0xa2c548fd;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x1c199183;
+        this.SUBCLASS_OF_ID = 0xa2c548fd;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8391191c","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class WallPapers extends TLObject {
+    static CONSTRUCTOR_ID = 0x702b65a9;
+    static SUBCLASS_OF_ID = 0xa2c548fd;
+
+    /**
+    Constructor for account.WallPapers: Instance of either WallPapersNotModified, WallPapers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x702b65a9;
+        this.SUBCLASS_OF_ID = 0xa2c548fd;
+
+        this.hash = args.hash;
+        this.wallpapers = args.wallpapers;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a9652b70","hex"),
+            struct.pack('<i', this.hash),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.wallpapers.length),Buffer.concat(this.wallpapers.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _wallpapers;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        reader.readInt();
+        _wallpapers = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _wallpapers.push(_x);
+            }
+            return new this({hash:_hash,
+	wallpapers:_wallpapers})
+        }
+    }
+
+
+class AutoDownloadSettings extends TLObject {
+    static CONSTRUCTOR_ID = 0x63cacf26;
+    static SUBCLASS_OF_ID = 0x2fb85921;
+
+    /**
+    Constructor for account.AutoDownloadSettings: Instance of AutoDownloadSettings
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x63cacf26;
+        this.SUBCLASS_OF_ID = 0x2fb85921;
+
+        this.low = args.low;
+        this.medium = args.medium;
+        this.high = args.high;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("26cfca63","hex"),
+            this.low.getBytes(),
+            this.medium.getBytes(),
+            this.high.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _low;
+        let _medium;
+        let _high;
+        let _x;
+        let len;
+        _low = reader.tgReadObject();
+        _medium = reader.tgReadObject();
+        _high = reader.tgReadObject();
+        return new this({low:_low,
+	medium:_medium,
+	high:_high})
+    }
+}
+
+
+class ThemesNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xf41eb622;
+    static SUBCLASS_OF_ID = 0x7fc52204;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xf41eb622;
+        this.SUBCLASS_OF_ID = 0x7fc52204;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("22b61ef4","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class Themes extends TLObject {
+    static CONSTRUCTOR_ID = 0x7f676421;
+    static SUBCLASS_OF_ID = 0x7fc52204;
+
+    /**
+    Constructor for account.Themes: Instance of either ThemesNotModified, Themes
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x7f676421;
+        this.SUBCLASS_OF_ID = 0x7fc52204;
+
+        this.hash = args.hash;
+        this.themes = args.themes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2164677f","hex"),
+            struct.pack('<i', this.hash),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.themes.length),Buffer.concat(this.themes.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _themes;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        reader.readInt();
+        _themes = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _themes.push(_x);
+            }
+            return new this({hash:_hash,
+	themes:_themes})
+        }
+    }
+
+module.exports = {
+    PrivacyRules,
+    Authorizations,
+    Password,
+    PasswordSettings,
+    PasswordInputSettings,
+    TmpPassword,
+    WebAuthorizations,
+    AuthorizationForm,
+    SentEmailCode,
+    Takeout,
+    WallPapersNotModified,
+    WallPapers,
+    AutoDownloadSettings,
+    ThemesNotModified,
+    Themes,
+};

+ 425 - 0
src/lib/gramjs/tl/types/auth.js

@@ -0,0 +1,425 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class SentCode extends TLObject {
+    static CONSTRUCTOR_ID = 0x5e002502;
+    static SUBCLASS_OF_ID = 0x6ce87081;
+
+    /**
+    Constructor for auth.SentCode: Instance of SentCode
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x5e002502;
+        this.SUBCLASS_OF_ID = 0x6ce87081;
+
+        this.type = args.type;
+        this.phoneCodeHash = args.phoneCodeHash;
+        this.nextType = args.nextType || null;
+        this.timeout = args.timeout || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0225005e","hex"),
+            struct.pack('<I', (this.nextType === undefined || this.nextType === false || this.nextType === null) ? 0 : 2 | (this.timeout === undefined || this.timeout === false || this.timeout === null) ? 0 : 4),
+            this.type.getBytes(),
+            TLObject.serializeBytes(this.phoneCodeHash),
+            (this.nextType === undefined || this.nextType === false || this.nextType ===null) ? Buffer.alloc(0) : [this.nextType.getBytes()],
+            (this.timeout === undefined || this.timeout === false || this.timeout ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.timeout)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _type;
+        let _phone_code_hash;
+        let _next_type;
+        let _timeout;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _type = reader.tgReadObject();
+        _phone_code_hash = reader.tgReadString();
+        if (flags & 2) {
+            _next_type = reader.tgReadObject();
+        }
+        else {
+            _next_type = null
+        }
+        if (flags & 4) {
+            _timeout = reader.readInt();
+        }
+        else {
+            _timeout = null
+        }
+        return new this({type:_type,
+	phoneCodeHash:_phone_code_hash,
+	nextType:_next_type,
+	timeout:_timeout})
+    }
+}
+
+
+class Authorization extends TLObject {
+    static CONSTRUCTOR_ID = 0xcd050916;
+    static SUBCLASS_OF_ID = 0xb9e04e39;
+
+    /**
+    Constructor for auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xcd050916;
+        this.SUBCLASS_OF_ID = 0xb9e04e39;
+
+        this.tmpSessions = args.tmpSessions || null;
+        this.user = args.user;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("160905cd","hex"),
+            struct.pack('<I', (this.tmpSessions === undefined || this.tmpSessions === false || this.tmpSessions === null) ? 0 : 1),
+            (this.tmpSessions === undefined || this.tmpSessions === false || this.tmpSessions ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.tmpSessions)],
+            this.user.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _tmp_sessions;
+        let _user;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        if (flags & 1) {
+            _tmp_sessions = reader.readInt();
+        }
+        else {
+            _tmp_sessions = null
+        }
+        _user = reader.tgReadObject();
+        return new this({tmpSessions:_tmp_sessions,
+	user:_user})
+    }
+}
+
+
+class AuthorizationSignUpRequired extends TLObject {
+    static CONSTRUCTOR_ID = 0x44747e9a;
+    static SUBCLASS_OF_ID = 0xb9e04e39;
+
+    /**
+    Constructor for auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x44747e9a;
+        this.SUBCLASS_OF_ID = 0xb9e04e39;
+
+        this.termsOfService = args.termsOfService || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9a7e7444","hex"),
+            struct.pack('<I', (this.termsOfService === undefined || this.termsOfService === false || this.termsOfService === null) ? 0 : 1),
+            (this.termsOfService === undefined || this.termsOfService === false || this.termsOfService ===null) ? Buffer.alloc(0) : [this.termsOfService.getBytes()],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _terms_of_service;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        if (flags & 1) {
+            _terms_of_service = reader.tgReadObject();
+        }
+        else {
+            _terms_of_service = null
+        }
+        return new this({termsOfService:_terms_of_service})
+    }
+}
+
+
+class ExportedAuthorization extends TLObject {
+    static CONSTRUCTOR_ID = 0xdf969c2d;
+    static SUBCLASS_OF_ID = 0x5fd1ec51;
+
+    /**
+    Constructor for auth.ExportedAuthorization: Instance of ExportedAuthorization
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xdf969c2d;
+        this.SUBCLASS_OF_ID = 0x5fd1ec51;
+
+        this.id = args.id;
+        this.bytes = args.bytes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("2d9c96df","hex"),
+            struct.pack('<i', this.id),
+            TLObject.serializeBytes(this.bytes),
+            ])
+        }
+    static fromReader(reader) {
+        let _id;
+        let _bytes;
+        let _x;
+        let len;
+        _id = reader.readInt();
+        _bytes = reader.tgReadBytes();
+        return new this({id:_id,
+	bytes:_bytes})
+    }
+}
+
+
+class PasswordRecovery extends TLObject {
+    static CONSTRUCTOR_ID = 0x137948a5;
+    static SUBCLASS_OF_ID = 0xfa72d43a;
+
+    /**
+    Constructor for auth.PasswordRecovery: Instance of PasswordRecovery
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x137948a5;
+        this.SUBCLASS_OF_ID = 0xfa72d43a;
+
+        this.emailPattern = args.emailPattern;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a5487913","hex"),
+            TLObject.serializeBytes(this.emailPattern),
+            ])
+        }
+    static fromReader(reader) {
+        let _email_pattern;
+        let _x;
+        let len;
+        _email_pattern = reader.tgReadString();
+        return new this({emailPattern:_email_pattern})
+    }
+}
+
+
+class CodeTypeSms extends TLObject {
+    static CONSTRUCTOR_ID = 0x72a3158c;
+    static SUBCLASS_OF_ID = 0xb3f3e401;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x72a3158c;
+        this.SUBCLASS_OF_ID = 0xb3f3e401;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8c15a372","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class CodeTypeCall extends TLObject {
+    static CONSTRUCTOR_ID = 0x741cd3e3;
+    static SUBCLASS_OF_ID = 0xb3f3e401;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x741cd3e3;
+        this.SUBCLASS_OF_ID = 0xb3f3e401;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e3d31c74","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class CodeTypeFlashCall extends TLObject {
+    static CONSTRUCTOR_ID = 0x226ccefb;
+    static SUBCLASS_OF_ID = 0xb3f3e401;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x226ccefb;
+        this.SUBCLASS_OF_ID = 0xb3f3e401;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("fbce6c22","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class SentCodeTypeApp extends TLObject {
+    static CONSTRUCTOR_ID = 0x3dbb5986;
+    static SUBCLASS_OF_ID = 0xff5b158e;
+
+    /**
+    Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3dbb5986;
+        this.SUBCLASS_OF_ID = 0xff5b158e;
+
+        this.length = args.length;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8659bb3d","hex"),
+            struct.pack('<i', this.length),
+            ])
+        }
+    static fromReader(reader) {
+        let _length;
+        let _x;
+        let len;
+        _length = reader.readInt();
+        return new this({length:_length})
+    }
+}
+
+
+class SentCodeTypeSms extends TLObject {
+    static CONSTRUCTOR_ID = 0xc000bba2;
+    static SUBCLASS_OF_ID = 0xff5b158e;
+
+    /**
+    Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc000bba2;
+        this.SUBCLASS_OF_ID = 0xff5b158e;
+
+        this.length = args.length;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a2bb00c0","hex"),
+            struct.pack('<i', this.length),
+            ])
+        }
+    static fromReader(reader) {
+        let _length;
+        let _x;
+        let len;
+        _length = reader.readInt();
+        return new this({length:_length})
+    }
+}
+
+
+class SentCodeTypeCall extends TLObject {
+    static CONSTRUCTOR_ID = 0x5353e5a7;
+    static SUBCLASS_OF_ID = 0xff5b158e;
+
+    /**
+    Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x5353e5a7;
+        this.SUBCLASS_OF_ID = 0xff5b158e;
+
+        this.length = args.length;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a7e55353","hex"),
+            struct.pack('<i', this.length),
+            ])
+        }
+    static fromReader(reader) {
+        let _length;
+        let _x;
+        let len;
+        _length = reader.readInt();
+        return new this({length:_length})
+    }
+}
+
+
+class SentCodeTypeFlashCall extends TLObject {
+    static CONSTRUCTOR_ID = 0xab03c6d9;
+    static SUBCLASS_OF_ID = 0xff5b158e;
+
+    /**
+    Constructor for auth.SentCodeType: Instance of either SentCodeTypeApp, SentCodeTypeSms, SentCodeTypeCall, SentCodeTypeFlashCall
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xab03c6d9;
+        this.SUBCLASS_OF_ID = 0xff5b158e;
+
+        this.pattern = args.pattern;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d9c603ab","hex"),
+            TLObject.serializeBytes(this.pattern),
+            ])
+        }
+    static fromReader(reader) {
+        let _pattern;
+        let _x;
+        let len;
+        _pattern = reader.tgReadString();
+        return new this({pattern:_pattern})
+    }
+}
+
+module.exports = {
+    SentCode,
+    Authorization,
+    AuthorizationSignUpRequired,
+    ExportedAuthorization,
+    PasswordRecovery,
+    CodeTypeSms,
+    CodeTypeCall,
+    CodeTypeFlashCall,
+    SentCodeTypeApp,
+    SentCodeTypeSms,
+    SentCodeTypeCall,
+    SentCodeTypeFlashCall,
+};

+ 189 - 0
src/lib/gramjs/tl/types/channels.js

@@ -0,0 +1,189 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class ChannelParticipants extends TLObject {
+    static CONSTRUCTOR_ID = 0xf56ee2a8;
+    static SUBCLASS_OF_ID = 0xe60a6e64;
+
+    /**
+    Constructor for channels.ChannelParticipants: Instance of either ChannelParticipants, ChannelParticipantsNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf56ee2a8;
+        this.SUBCLASS_OF_ID = 0xe60a6e64;
+
+        this.count = args.count;
+        this.participants = args.participants;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a8e26ef5","hex"),
+            struct.pack('<i', this.count),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.participants.length),Buffer.concat(this.participants.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _count;
+        let _participants;
+        let _users;
+        let _x;
+        let len;
+        _count = reader.readInt();
+        reader.readInt();
+        _participants = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _participants.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({count:_count,
+	participants:_participants,
+	users:_users})
+            }
+        }
+
+
+class ChannelParticipantsNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xf0173fe9;
+    static SUBCLASS_OF_ID = 0xe60a6e64;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xf0173fe9;
+        this.SUBCLASS_OF_ID = 0xe60a6e64;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e93f17f0","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class ChannelParticipant extends TLObject {
+    static CONSTRUCTOR_ID = 0xd0d9b163;
+    static SUBCLASS_OF_ID = 0x6658151a;
+
+    /**
+    Constructor for channels.ChannelParticipant: Instance of ChannelParticipant
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd0d9b163;
+        this.SUBCLASS_OF_ID = 0x6658151a;
+
+        this.participant = args.participant;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("63b1d9d0","hex"),
+            this.participant.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _participant;
+        let _users;
+        let _x;
+        let len;
+        _participant = reader.tgReadObject();
+        reader.readInt();
+        _users = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _users.push(_x);
+            }
+            return new this({participant:_participant,
+	users:_users})
+        }
+    }
+
+
+class AdminLogResults extends TLObject {
+    static CONSTRUCTOR_ID = 0xed8af74d;
+    static SUBCLASS_OF_ID = 0x51f076bc;
+
+    /**
+    Constructor for channels.AdminLogResults: Instance of AdminLogResults
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xed8af74d;
+        this.SUBCLASS_OF_ID = 0x51f076bc;
+
+        this.events = args.events;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4df78aed","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.events.length),Buffer.concat(this.events.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _events;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _events = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _events.push(_x);
+            }
+            reader.readInt();
+            _chats = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _chats.push(_x);
+                }
+                reader.readInt();
+                _users = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _users.push(_x);
+                    }
+                    return new this({events:_events,
+	chats:_chats,
+	users:_users})
+                }
+            }
+
+module.exports = {
+    ChannelParticipants,
+    ChannelParticipantsNotModified,
+    ChannelParticipant,
+    AdminLogResults,
+};

+ 493 - 0
src/lib/gramjs/tl/types/contacts.js

@@ -0,0 +1,493 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class ContactsNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xb74ba9d2;
+    static SUBCLASS_OF_ID = 0x38be25f6;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xb74ba9d2;
+        this.SUBCLASS_OF_ID = 0x38be25f6;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d2a94bb7","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class Contacts extends TLObject {
+    static CONSTRUCTOR_ID = 0xeae87e42;
+    static SUBCLASS_OF_ID = 0x38be25f6;
+
+    /**
+    Constructor for contacts.Contacts: Instance of either ContactsNotModified, Contacts
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xeae87e42;
+        this.SUBCLASS_OF_ID = 0x38be25f6;
+
+        this.contacts = args.contacts;
+        this.savedCount = args.savedCount;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("427ee8ea","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.contacts.length),Buffer.concat(this.contacts.map(x => x.getBytes())),
+            struct.pack('<i', this.savedCount),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _contacts;
+        let _saved_count;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _contacts = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _contacts.push(_x);
+            }
+            _saved_count = reader.readInt();
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({contacts:_contacts,
+	savedCount:_saved_count,
+	users:_users})
+            }
+        }
+
+
+class ImportedContacts extends TLObject {
+    static CONSTRUCTOR_ID = 0x77d01c3b;
+    static SUBCLASS_OF_ID = 0x8172ad93;
+
+    /**
+    Constructor for contacts.ImportedContacts: Instance of ImportedContacts
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x77d01c3b;
+        this.SUBCLASS_OF_ID = 0x8172ad93;
+
+        this.imported = args.imported;
+        this.popularInvites = args.popularInvites;
+        this.retryContacts = args.retryContacts;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3b1cd077","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.imported.length),Buffer.concat(this.imported.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.popularInvites.length),Buffer.concat(this.popularInvites.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.retryContacts.length),Buffer.concat(this.retryContacts.map(x => readBufferFromBigInt(x,8,true,true))),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _imported;
+        let _popular_invites;
+        let _retry_contacts;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _imported = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _imported.push(_x);
+            }
+            reader.readInt();
+            _popular_invites = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _popular_invites.push(_x);
+                }
+                reader.readInt();
+                _retry_contacts = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.readLong();
+                    _retry_contacts.push(_x);
+                    }
+                    reader.readInt();
+                    _users = [];
+                    len = reader.readInt();
+                    for (let i=0;i<len;i++){
+                        _x = reader.tgReadObject();
+                        _users.push(_x);
+                        }
+                        return new this({imported:_imported,
+	popularInvites:_popular_invites,
+	retryContacts:_retry_contacts,
+	users:_users})
+                    }
+                }
+
+
+class Blocked extends TLObject {
+    static CONSTRUCTOR_ID = 0x1c138d15;
+    static SUBCLASS_OF_ID = 0xffba4f4f;
+
+    /**
+    Constructor for contacts.Blocked: Instance of either Blocked, BlockedSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1c138d15;
+        this.SUBCLASS_OF_ID = 0xffba4f4f;
+
+        this.blocked = args.blocked;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("158d131c","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.blocked.length),Buffer.concat(this.blocked.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _blocked;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _blocked = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _blocked.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({blocked:_blocked,
+	users:_users})
+            }
+        }
+
+
+class BlockedSlice extends TLObject {
+    static CONSTRUCTOR_ID = 0x900802a1;
+    static SUBCLASS_OF_ID = 0xffba4f4f;
+
+    /**
+    Constructor for contacts.Blocked: Instance of either Blocked, BlockedSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x900802a1;
+        this.SUBCLASS_OF_ID = 0xffba4f4f;
+
+        this.count = args.count;
+        this.blocked = args.blocked;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a1020890","hex"),
+            struct.pack('<i', this.count),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.blocked.length),Buffer.concat(this.blocked.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _count;
+        let _blocked;
+        let _users;
+        let _x;
+        let len;
+        _count = reader.readInt();
+        reader.readInt();
+        _blocked = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _blocked.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({count:_count,
+	blocked:_blocked,
+	users:_users})
+            }
+        }
+
+
+class Found extends TLObject {
+    static CONSTRUCTOR_ID = 0xb3134d9d;
+    static SUBCLASS_OF_ID = 0x4386a2e3;
+
+    /**
+    Constructor for contacts.Found: Instance of Found
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb3134d9d;
+        this.SUBCLASS_OF_ID = 0x4386a2e3;
+
+        this.myResults = args.myResults;
+        this.results = args.results;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9d4d13b3","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.myResults.length),Buffer.concat(this.myResults.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.results.length),Buffer.concat(this.results.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _my_results;
+        let _results;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _my_results = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _my_results.push(_x);
+            }
+            reader.readInt();
+            _results = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _results.push(_x);
+                }
+                reader.readInt();
+                _chats = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _chats.push(_x);
+                    }
+                    reader.readInt();
+                    _users = [];
+                    len = reader.readInt();
+                    for (let i=0;i<len;i++){
+                        _x = reader.tgReadObject();
+                        _users.push(_x);
+                        }
+                        return new this({myResults:_my_results,
+	results:_results,
+	chats:_chats,
+	users:_users})
+                    }
+                }
+
+
+class ResolvedPeer extends TLObject {
+    static CONSTRUCTOR_ID = 0x7f077ad9;
+    static SUBCLASS_OF_ID = 0xf065b3a8;
+
+    /**
+    Constructor for contacts.ResolvedPeer: Instance of ResolvedPeer
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x7f077ad9;
+        this.SUBCLASS_OF_ID = 0xf065b3a8;
+
+        this.peer = args.peer;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d97a077f","hex"),
+            this.peer.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _peer;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        _peer = reader.tgReadObject();
+        reader.readInt();
+        _chats = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _chats.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({peer:_peer,
+	chats:_chats,
+	users:_users})
+            }
+        }
+
+
+class TopPeersNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xde266ef5;
+    static SUBCLASS_OF_ID = 0x9ee8bb88;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xde266ef5;
+        this.SUBCLASS_OF_ID = 0x9ee8bb88;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f56e26de","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class TopPeers extends TLObject {
+    static CONSTRUCTOR_ID = 0x70b772a8;
+    static SUBCLASS_OF_ID = 0x9ee8bb88;
+
+    /**
+    Constructor for contacts.TopPeers: Instance of either TopPeersNotModified, TopPeers, TopPeersDisabled
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x70b772a8;
+        this.SUBCLASS_OF_ID = 0x9ee8bb88;
+
+        this.categories = args.categories;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a872b770","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.categories.length),Buffer.concat(this.categories.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _categories;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _categories = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _categories.push(_x);
+            }
+            reader.readInt();
+            _chats = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _chats.push(_x);
+                }
+                reader.readInt();
+                _users = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _users.push(_x);
+                    }
+                    return new this({categories:_categories,
+	chats:_chats,
+	users:_users})
+                }
+            }
+
+
+class TopPeersDisabled extends TLObject {
+    static CONSTRUCTOR_ID = 0xb52c939d;
+    static SUBCLASS_OF_ID = 0x9ee8bb88;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xb52c939d;
+        this.SUBCLASS_OF_ID = 0x9ee8bb88;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9d932cb5","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+module.exports = {
+    ContactsNotModified,
+    Contacts,
+    ImportedContacts,
+    Blocked,
+    BlockedSlice,
+    Found,
+    ResolvedPeer,
+    TopPeersNotModified,
+    TopPeers,
+    TopPeersDisabled,
+};

+ 765 - 0
src/lib/gramjs/tl/types/help.js

@@ -0,0 +1,765 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class AppUpdate extends TLObject {
+    static CONSTRUCTOR_ID = 0x1da7158f;
+    static SUBCLASS_OF_ID = 0x5897069e;
+
+    /**
+    Constructor for help.AppUpdate: Instance of either AppUpdate, NoAppUpdate
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x1da7158f;
+        this.SUBCLASS_OF_ID = 0x5897069e;
+
+        this.canNotSkip = args.canNotSkip || null;
+        this.id = args.id;
+        this.version = args.version;
+        this.text = args.text;
+        this.entities = args.entities;
+        this.document = args.document || null;
+        this.url = args.url || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8f15a71d","hex"),
+            struct.pack('<I', (this.canNotSkip === undefined || this.canNotSkip === false || this.canNotSkip === null) ? 0 : 1 | (this.document === undefined || this.document === false || this.document === null) ? 0 : 2 | (this.url === undefined || this.url === false || this.url === null) ? 0 : 4),
+            struct.pack('<i', this.id),
+            TLObject.serializeBytes(this.version),
+            TLObject.serializeBytes(this.text),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes())),
+            (this.document === undefined || this.document === false || this.document ===null) ? Buffer.alloc(0) : [this.document.getBytes()],
+            (this.url === undefined || this.url === false || this.url ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.url)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _can_not_skip;
+        let _id;
+        let _version;
+        let _text;
+        let _entities;
+        let _document;
+        let _url;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _can_not_skip = Boolean(flags & 1);
+        _id = reader.readInt();
+        _version = reader.tgReadString();
+        _text = reader.tgReadString();
+        reader.readInt();
+        _entities = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _entities.push(_x);
+            }
+            if (flags & 2) {
+                _document = reader.tgReadObject();
+            }
+            else {
+                _document = null
+            }
+            if (flags & 4) {
+                _url = reader.tgReadString();
+            }
+            else {
+                _url = null
+            }
+            return new this({canNotSkip:_can_not_skip,
+	id:_id,
+	version:_version,
+	text:_text,
+	entities:_entities,
+	document:_document,
+	url:_url})
+        }
+    }
+
+
+class NoAppUpdate extends TLObject {
+    static CONSTRUCTOR_ID = 0xc45a6536;
+    static SUBCLASS_OF_ID = 0x5897069e;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xc45a6536;
+        this.SUBCLASS_OF_ID = 0x5897069e;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("36655ac4","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class InviteText extends TLObject {
+    static CONSTRUCTOR_ID = 0x18cb9f78;
+    static SUBCLASS_OF_ID = 0xcf70aa35;
+
+    /**
+    Constructor for help.InviteText: Instance of InviteText
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x18cb9f78;
+        this.SUBCLASS_OF_ID = 0xcf70aa35;
+
+        this.message = args.message;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("789fcb18","hex"),
+            TLObject.serializeBytes(this.message),
+            ])
+        }
+    static fromReader(reader) {
+        let _message;
+        let _x;
+        let len;
+        _message = reader.tgReadString();
+        return new this({message:_message})
+    }
+}
+
+
+class Support extends TLObject {
+    static CONSTRUCTOR_ID = 0x17c6b5f6;
+    static SUBCLASS_OF_ID = 0x7159bceb;
+
+    /**
+    Constructor for help.Support: Instance of Support
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x17c6b5f6;
+        this.SUBCLASS_OF_ID = 0x7159bceb;
+
+        this.phoneNumber = args.phoneNumber;
+        this.user = args.user;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f6b5c617","hex"),
+            TLObject.serializeBytes(this.phoneNumber),
+            this.user.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_number;
+        let _user;
+        let _x;
+        let len;
+        _phone_number = reader.tgReadString();
+        _user = reader.tgReadObject();
+        return new this({phoneNumber:_phone_number,
+	user:_user})
+    }
+}
+
+
+class TermsOfService extends TLObject {
+    static CONSTRUCTOR_ID = 0x780a0310;
+    static SUBCLASS_OF_ID = 0x20ee8312;
+
+    /**
+    Constructor for help.TermsOfService: Instance of TermsOfService
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x780a0310;
+        this.SUBCLASS_OF_ID = 0x20ee8312;
+
+        this.popup = args.popup || null;
+        this.id = args.id;
+        this.text = args.text;
+        this.entities = args.entities;
+        this.minAgeConfirm = args.minAgeConfirm || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("10030a78","hex"),
+            struct.pack('<I', (this.popup === undefined || this.popup === false || this.popup === null) ? 0 : 1 | (this.minAgeConfirm === undefined || this.minAgeConfirm === false || this.minAgeConfirm === null) ? 0 : 2),
+            this.id.getBytes(),
+            TLObject.serializeBytes(this.text),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes())),
+            (this.minAgeConfirm === undefined || this.minAgeConfirm === false || this.minAgeConfirm ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.minAgeConfirm)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _popup;
+        let _id;
+        let _text;
+        let _entities;
+        let _min_age_confirm;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _popup = Boolean(flags & 1);
+        _id = reader.tgReadObject();
+        _text = reader.tgReadString();
+        reader.readInt();
+        _entities = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _entities.push(_x);
+            }
+            if (flags & 2) {
+                _min_age_confirm = reader.readInt();
+            }
+            else {
+                _min_age_confirm = null
+            }
+            return new this({popup:_popup,
+	id:_id,
+	text:_text,
+	entities:_entities,
+	minAgeConfirm:_min_age_confirm})
+        }
+    }
+
+
+class RecentMeUrls extends TLObject {
+    static CONSTRUCTOR_ID = 0x0e0310d7;
+    static SUBCLASS_OF_ID = 0xf269c477;
+
+    /**
+    Constructor for help.RecentMeUrls: Instance of RecentMeUrls
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x0e0310d7;
+        this.SUBCLASS_OF_ID = 0xf269c477;
+
+        this.urls = args.urls;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d710030e","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.urls.length),Buffer.concat(this.urls.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _urls;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _urls = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _urls.push(_x);
+            }
+            reader.readInt();
+            _chats = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _chats.push(_x);
+                }
+                reader.readInt();
+                _users = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _users.push(_x);
+                    }
+                    return new this({urls:_urls,
+	chats:_chats,
+	users:_users})
+                }
+            }
+
+
+class ProxyDataEmpty extends TLObject {
+    static CONSTRUCTOR_ID = 0xe09e1fb8;
+    static SUBCLASS_OF_ID = 0x21e2a448;
+
+    /**
+    Constructor for help.ProxyData: Instance of either ProxyDataEmpty, ProxyDataPromo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe09e1fb8;
+        this.SUBCLASS_OF_ID = 0x21e2a448;
+
+        this.expires = args.expires;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b81f9ee0","hex"),
+            struct.pack('<i', this.expires),
+            ])
+        }
+    static fromReader(reader) {
+        let _expires;
+        let _x;
+        let len;
+        _expires = reader.readInt();
+        return new this({expires:_expires})
+    }
+}
+
+
+class ProxyDataPromo extends TLObject {
+    static CONSTRUCTOR_ID = 0x2bf7ee23;
+    static SUBCLASS_OF_ID = 0x21e2a448;
+
+    /**
+    Constructor for help.ProxyData: Instance of either ProxyDataEmpty, ProxyDataPromo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2bf7ee23;
+        this.SUBCLASS_OF_ID = 0x21e2a448;
+
+        this.expires = args.expires;
+        this.peer = args.peer;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("23eef72b","hex"),
+            struct.pack('<i', this.expires),
+            this.peer.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _expires;
+        let _peer;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        _expires = reader.readInt();
+        _peer = reader.tgReadObject();
+        reader.readInt();
+        _chats = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _chats.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({expires:_expires,
+	peer:_peer,
+	chats:_chats,
+	users:_users})
+            }
+        }
+
+
+class TermsOfServiceUpdateEmpty extends TLObject {
+    static CONSTRUCTOR_ID = 0xe3309f7f;
+    static SUBCLASS_OF_ID = 0x293c2977;
+
+    /**
+    Constructor for help.TermsOfServiceUpdate: Instance of either TermsOfServiceUpdateEmpty, TermsOfServiceUpdate
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe3309f7f;
+        this.SUBCLASS_OF_ID = 0x293c2977;
+
+        this.expires = args.expires;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("7f9f30e3","hex"),
+            struct.pack('<i', this.expires),
+            ])
+        }
+    static fromReader(reader) {
+        let _expires;
+        let _x;
+        let len;
+        _expires = reader.readInt();
+        return new this({expires:_expires})
+    }
+}
+
+
+class TermsOfServiceUpdate extends TLObject {
+    static CONSTRUCTOR_ID = 0x28ecf961;
+    static SUBCLASS_OF_ID = 0x293c2977;
+
+    /**
+    Constructor for help.TermsOfServiceUpdate: Instance of either TermsOfServiceUpdateEmpty, TermsOfServiceUpdate
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x28ecf961;
+        this.SUBCLASS_OF_ID = 0x293c2977;
+
+        this.expires = args.expires;
+        this.termsOfService = args.termsOfService;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("61f9ec28","hex"),
+            struct.pack('<i', this.expires),
+            this.termsOfService.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _expires;
+        let _terms_of_service;
+        let _x;
+        let len;
+        _expires = reader.readInt();
+        _terms_of_service = reader.tgReadObject();
+        return new this({expires:_expires,
+	termsOfService:_terms_of_service})
+    }
+}
+
+
+class DeepLinkInfoEmpty extends TLObject {
+    static CONSTRUCTOR_ID = 0x66afa166;
+    static SUBCLASS_OF_ID = 0x984aac38;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x66afa166;
+        this.SUBCLASS_OF_ID = 0x984aac38;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("66a1af66","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class DeepLinkInfo extends TLObject {
+    static CONSTRUCTOR_ID = 0x6a4ee832;
+    static SUBCLASS_OF_ID = 0x984aac38;
+
+    /**
+    Constructor for help.DeepLinkInfo: Instance of either DeepLinkInfoEmpty, DeepLinkInfo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x6a4ee832;
+        this.SUBCLASS_OF_ID = 0x984aac38;
+
+        this.updateApp = args.updateApp || null;
+        this.message = args.message;
+        this.entities = args.entities || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("32e84e6a","hex"),
+            struct.pack('<I', (this.updateApp === undefined || this.updateApp === false || this.updateApp === null) ? 0 : 1 | (this.entities === undefined || this.entities === false || this.entities === null) ? 0 : 2),
+            TLObject.serializeBytes(this.message),
+            (this.entities === undefined || this.entities === false || this.entities ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes()))]),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _update_app;
+        let _message;
+        let _entities;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _update_app = Boolean(flags & 1);
+        _message = reader.tgReadString();
+        if (flags & 2) {
+            reader.readInt();
+            _entities = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _entities.push(_x);
+                }
+            }
+            else {
+                _entities = null
+            }
+            return new this({updateApp:_update_app,
+	message:_message,
+	entities:_entities})
+        }
+    }
+
+
+class PassportConfigNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xbfb9f457;
+    static SUBCLASS_OF_ID = 0xc666c0ad;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xbfb9f457;
+        this.SUBCLASS_OF_ID = 0xc666c0ad;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("57f4b9bf","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class PassportConfig extends TLObject {
+    static CONSTRUCTOR_ID = 0xa098d6af;
+    static SUBCLASS_OF_ID = 0xc666c0ad;
+
+    /**
+    Constructor for help.PassportConfig: Instance of either PassportConfigNotModified, PassportConfig
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa098d6af;
+        this.SUBCLASS_OF_ID = 0xc666c0ad;
+
+        this.hash = args.hash;
+        this.countriesLangs = args.countriesLangs;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("afd698a0","hex"),
+            struct.pack('<i', this.hash),
+            this.countriesLangs.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _countries_langs;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        _countries_langs = reader.tgReadObject();
+        return new this({hash:_hash,
+	countriesLangs:_countries_langs})
+    }
+}
+
+
+class SupportName extends TLObject {
+    static CONSTRUCTOR_ID = 0x8c05f1c9;
+    static SUBCLASS_OF_ID = 0x7f50b7c2;
+
+    /**
+    Constructor for help.SupportName: Instance of SupportName
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8c05f1c9;
+        this.SUBCLASS_OF_ID = 0x7f50b7c2;
+
+        this.name = args.name;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c9f1058c","hex"),
+            TLObject.serializeBytes(this.name),
+            ])
+        }
+    static fromReader(reader) {
+        let _name;
+        let _x;
+        let len;
+        _name = reader.tgReadString();
+        return new this({name:_name})
+    }
+}
+
+
+class UserInfoEmpty extends TLObject {
+    static CONSTRUCTOR_ID = 0xf3ae2eed;
+    static SUBCLASS_OF_ID = 0x5c53d7d8;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xf3ae2eed;
+        this.SUBCLASS_OF_ID = 0x5c53d7d8;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ed2eaef3","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class UserInfo extends TLObject {
+    static CONSTRUCTOR_ID = 0x01eb3758;
+    static SUBCLASS_OF_ID = 0x5c53d7d8;
+
+    /**
+    Constructor for help.UserInfo: Instance of either UserInfoEmpty, UserInfo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x01eb3758;
+        this.SUBCLASS_OF_ID = 0x5c53d7d8;
+
+        this.message = args.message;
+        this.entities = args.entities;
+        this.author = args.author;
+        this.date = args.date;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5837eb01","hex"),
+            TLObject.serializeBytes(this.message),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.entities.length),Buffer.concat(this.entities.map(x => x.getBytes())),
+            TLObject.serializeBytes(this.author),
+            struct.pack('<i', this.date),
+            ])
+        }
+    static fromReader(reader) {
+        let _message;
+        let _entities;
+        let _author;
+        let _date;
+        let _x;
+        let len;
+        _message = reader.tgReadString();
+        reader.readInt();
+        _entities = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _entities.push(_x);
+            }
+            _author = reader.tgReadString();
+            _date = reader.readInt();
+            return new this({message:_message,
+	entities:_entities,
+	author:_author,
+	date:_date})
+        }
+    }
+
+
+class ConfigSimple extends TLObject {
+    static CONSTRUCTOR_ID = 0x5a592a6c;
+    static SUBCLASS_OF_ID = 0x29183ac4;
+
+    /**
+    Constructor for help.ConfigSimple: Instance of ConfigSimple
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x5a592a6c;
+        this.SUBCLASS_OF_ID = 0x29183ac4;
+
+        this.date = args.date;
+        this.expires = args.expires;
+        this.rules = args.rules;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6c2a595a","hex"),
+            struct.pack('<i', this.date),
+            struct.pack('<i', this.expires),
+            struct.pack('<i', this.rules.length),Buffer.concat(this.rules.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _date;
+        let _expires;
+        let _rules;
+        let _x;
+        let len;
+        _date = reader.readInt();
+        _expires = reader.readInt();
+        _rules = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _rules.push(_x);
+            }
+            return new this({date:_date,
+	expires:_expires,
+	rules:_rules})
+        }
+    }
+
+module.exports = {
+    AppUpdate,
+    NoAppUpdate,
+    InviteText,
+    Support,
+    TermsOfService,
+    RecentMeUrls,
+    ProxyDataEmpty,
+    ProxyDataPromo,
+    TermsOfServiceUpdateEmpty,
+    TermsOfServiceUpdate,
+    DeepLinkInfoEmpty,
+    DeepLinkInfo,
+    PassportConfigNotModified,
+    PassportConfig,
+    SupportName,
+    UserInfoEmpty,
+    UserInfo,
+    ConfigSimple,
+};

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1905 - 0
src/lib/gramjs/tl/types/index.js


+ 1877 - 0
src/lib/gramjs/tl/types/messages.js

@@ -0,0 +1,1877 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class Dialogs extends TLObject {
+    static CONSTRUCTOR_ID = 0x15ba6c40;
+    static SUBCLASS_OF_ID = 0xe1b52ee;
+
+    /**
+    Constructor for messages.Dialogs: Instance of either Dialogs, DialogsSlice, DialogsNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x15ba6c40;
+        this.SUBCLASS_OF_ID = 0xe1b52ee;
+
+        this.dialogs = args.dialogs;
+        this.messages = args.messages;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("406cba15","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.dialogs.length),Buffer.concat(this.dialogs.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _dialogs;
+        let _messages;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _dialogs = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _dialogs.push(_x);
+            }
+            reader.readInt();
+            _messages = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _messages.push(_x);
+                }
+                reader.readInt();
+                _chats = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _chats.push(_x);
+                    }
+                    reader.readInt();
+                    _users = [];
+                    len = reader.readInt();
+                    for (let i=0;i<len;i++){
+                        _x = reader.tgReadObject();
+                        _users.push(_x);
+                        }
+                        return new this({dialogs:_dialogs,
+	messages:_messages,
+	chats:_chats,
+	users:_users})
+                    }
+                }
+
+
+class DialogsSlice extends TLObject {
+    static CONSTRUCTOR_ID = 0x71e094f3;
+    static SUBCLASS_OF_ID = 0xe1b52ee;
+
+    /**
+    Constructor for messages.Dialogs: Instance of either Dialogs, DialogsSlice, DialogsNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x71e094f3;
+        this.SUBCLASS_OF_ID = 0xe1b52ee;
+
+        this.count = args.count;
+        this.dialogs = args.dialogs;
+        this.messages = args.messages;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("f394e071","hex"),
+            struct.pack('<i', this.count),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.dialogs.length),Buffer.concat(this.dialogs.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _count;
+        let _dialogs;
+        let _messages;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        _count = reader.readInt();
+        reader.readInt();
+        _dialogs = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _dialogs.push(_x);
+            }
+            reader.readInt();
+            _messages = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _messages.push(_x);
+                }
+                reader.readInt();
+                _chats = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _chats.push(_x);
+                    }
+                    reader.readInt();
+                    _users = [];
+                    len = reader.readInt();
+                    for (let i=0;i<len;i++){
+                        _x = reader.tgReadObject();
+                        _users.push(_x);
+                        }
+                        return new this({count:_count,
+	dialogs:_dialogs,
+	messages:_messages,
+	chats:_chats,
+	users:_users})
+                    }
+                }
+
+
+class DialogsNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xf0e3e596;
+    static SUBCLASS_OF_ID = 0xe1b52ee;
+
+    /**
+    Constructor for messages.Dialogs: Instance of either Dialogs, DialogsSlice, DialogsNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf0e3e596;
+        this.SUBCLASS_OF_ID = 0xe1b52ee;
+
+        this.count = args.count;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("96e5e3f0","hex"),
+            struct.pack('<i', this.count),
+            ])
+        }
+    static fromReader(reader) {
+        let _count;
+        let _x;
+        let len;
+        _count = reader.readInt();
+        return new this({count:_count})
+    }
+}
+
+
+class Messages extends TLObject {
+    static CONSTRUCTOR_ID = 0x8c718e87;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    Constructor for messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8c718e87;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.messages = args.messages;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("878e718c","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _messages;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _messages = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _messages.push(_x);
+            }
+            reader.readInt();
+            _chats = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _chats.push(_x);
+                }
+                reader.readInt();
+                _users = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _users.push(_x);
+                    }
+                    return new this({messages:_messages,
+	chats:_chats,
+	users:_users})
+                }
+            }
+
+
+class MessagesSlice extends TLObject {
+    static CONSTRUCTOR_ID = 0xc8edce1e;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    Constructor for messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc8edce1e;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.inexact = args.inexact || null;
+        this.count = args.count;
+        this.nextRate = args.nextRate || null;
+        this.messages = args.messages;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("1eceedc8","hex"),
+            struct.pack('<I', (this.inexact === undefined || this.inexact === false || this.inexact === null) ? 0 : 2 | (this.nextRate === undefined || this.nextRate === false || this.nextRate === null) ? 0 : 1),
+            struct.pack('<i', this.count),
+            (this.nextRate === undefined || this.nextRate === false || this.nextRate ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.nextRate)],
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _inexact;
+        let _count;
+        let _next_rate;
+        let _messages;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _inexact = Boolean(flags & 2);
+        _count = reader.readInt();
+        if (flags & 1) {
+            _next_rate = reader.readInt();
+        }
+        else {
+            _next_rate = null
+        }
+        reader.readInt();
+        _messages = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _messages.push(_x);
+            }
+            reader.readInt();
+            _chats = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _chats.push(_x);
+                }
+                reader.readInt();
+                _users = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _users.push(_x);
+                    }
+                    return new this({inexact:_inexact,
+	count:_count,
+	nextRate:_next_rate,
+	messages:_messages,
+	chats:_chats,
+	users:_users})
+                }
+            }
+
+
+class ChannelMessages extends TLObject {
+    static CONSTRUCTOR_ID = 0x99262e37;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    Constructor for messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x99262e37;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.inexact = args.inexact || null;
+        this.pts = args.pts;
+        this.count = args.count;
+        this.messages = args.messages;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("372e2699","hex"),
+            struct.pack('<I', (this.inexact === undefined || this.inexact === false || this.inexact === null) ? 0 : 2),
+            struct.pack('<i', this.pts),
+            struct.pack('<i', this.count),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _inexact;
+        let _pts;
+        let _count;
+        let _messages;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _inexact = Boolean(flags & 2);
+        _pts = reader.readInt();
+        _count = reader.readInt();
+        reader.readInt();
+        _messages = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _messages.push(_x);
+            }
+            reader.readInt();
+            _chats = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _chats.push(_x);
+                }
+                reader.readInt();
+                _users = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _users.push(_x);
+                    }
+                    return new this({inexact:_inexact,
+	pts:_pts,
+	count:_count,
+	messages:_messages,
+	chats:_chats,
+	users:_users})
+                }
+            }
+
+
+class MessagesNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0x74535f21;
+    static SUBCLASS_OF_ID = 0xd4b40b5e;
+
+    /**
+    Constructor for messages.Messages: Instance of either Messages, MessagesSlice, ChannelMessages, MessagesNotModified
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x74535f21;
+        this.SUBCLASS_OF_ID = 0xd4b40b5e;
+
+        this.count = args.count;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("215f5374","hex"),
+            struct.pack('<i', this.count),
+            ])
+        }
+    static fromReader(reader) {
+        let _count;
+        let _x;
+        let len;
+        _count = reader.readInt();
+        return new this({count:_count})
+    }
+}
+
+
+class Chats extends TLObject {
+    static CONSTRUCTOR_ID = 0x64ff9fd5;
+    static SUBCLASS_OF_ID = 0x99d5cb14;
+
+    /**
+    Constructor for messages.Chats: Instance of either Chats, ChatsSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x64ff9fd5;
+        this.SUBCLASS_OF_ID = 0x99d5cb14;
+
+        this.chats = args.chats;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d59fff64","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _chats;
+        let _x;
+        let len;
+        reader.readInt();
+        _chats = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _chats.push(_x);
+            }
+            return new this({chats:_chats})
+        }
+    }
+
+
+class ChatsSlice extends TLObject {
+    static CONSTRUCTOR_ID = 0x9cd81144;
+    static SUBCLASS_OF_ID = 0x99d5cb14;
+
+    /**
+    Constructor for messages.Chats: Instance of either Chats, ChatsSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x9cd81144;
+        this.SUBCLASS_OF_ID = 0x99d5cb14;
+
+        this.count = args.count;
+        this.chats = args.chats;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4411d89c","hex"),
+            struct.pack('<i', this.count),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _count;
+        let _chats;
+        let _x;
+        let len;
+        _count = reader.readInt();
+        reader.readInt();
+        _chats = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _chats.push(_x);
+            }
+            return new this({count:_count,
+	chats:_chats})
+        }
+    }
+
+
+class ChatFull extends TLObject {
+    static CONSTRUCTOR_ID = 0xe5d7d19c;
+    static SUBCLASS_OF_ID = 0x225a5109;
+
+    /**
+    Constructor for messages.ChatFull: Instance of ChatFull
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe5d7d19c;
+        this.SUBCLASS_OF_ID = 0x225a5109;
+
+        this.fullChat = args.fullChat;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("9cd1d7e5","hex"),
+            this.fullChat.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _full_chat;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        _full_chat = reader.tgReadObject();
+        reader.readInt();
+        _chats = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _chats.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({fullChat:_full_chat,
+	chats:_chats,
+	users:_users})
+            }
+        }
+
+
+class AffectedHistory extends TLObject {
+    static CONSTRUCTOR_ID = 0xb45c69d1;
+    static SUBCLASS_OF_ID = 0x2c49c116;
+
+    /**
+    Constructor for messages.AffectedHistory: Instance of AffectedHistory
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb45c69d1;
+        this.SUBCLASS_OF_ID = 0x2c49c116;
+
+        this.pts = args.pts;
+        this.ptsCount = args.ptsCount;
+        this.offset = args.offset;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d1695cb4","hex"),
+            struct.pack('<i', this.pts),
+            struct.pack('<i', this.ptsCount),
+            struct.pack('<i', this.offset),
+            ])
+        }
+    static fromReader(reader) {
+        let _pts;
+        let _pts_count;
+        let _offset;
+        let _x;
+        let len;
+        _pts = reader.readInt();
+        _pts_count = reader.readInt();
+        _offset = reader.readInt();
+        return new this({pts:_pts,
+	ptsCount:_pts_count,
+	offset:_offset})
+    }
+}
+
+
+class DhConfigNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xc0e24635;
+    static SUBCLASS_OF_ID = 0xe488ed8b;
+
+    /**
+    Constructor for messages.DhConfig: Instance of either DhConfigNotModified, DhConfig
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xc0e24635;
+        this.SUBCLASS_OF_ID = 0xe488ed8b;
+
+        this.random = args.random;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3546e2c0","hex"),
+            TLObject.serializeBytes(this.random),
+            ])
+        }
+    static fromReader(reader) {
+        let _random;
+        let _x;
+        let len;
+        _random = reader.tgReadBytes();
+        return new this({random:_random})
+    }
+}
+
+
+class DhConfig extends TLObject {
+    static CONSTRUCTOR_ID = 0x2c221edd;
+    static SUBCLASS_OF_ID = 0xe488ed8b;
+
+    /**
+    Constructor for messages.DhConfig: Instance of either DhConfigNotModified, DhConfig
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2c221edd;
+        this.SUBCLASS_OF_ID = 0xe488ed8b;
+
+        this.g = args.g;
+        this.p = args.p;
+        this.version = args.version;
+        this.random = args.random;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("dd1e222c","hex"),
+            struct.pack('<i', this.g),
+            TLObject.serializeBytes(this.p),
+            struct.pack('<i', this.version),
+            TLObject.serializeBytes(this.random),
+            ])
+        }
+    static fromReader(reader) {
+        let _g;
+        let _p;
+        let _version;
+        let _random;
+        let _x;
+        let len;
+        _g = reader.readInt();
+        _p = reader.tgReadBytes();
+        _version = reader.readInt();
+        _random = reader.tgReadBytes();
+        return new this({g:_g,
+	p:_p,
+	version:_version,
+	random:_random})
+    }
+}
+
+
+class SentEncryptedMessage extends TLObject {
+    static CONSTRUCTOR_ID = 0x560f8935;
+    static SUBCLASS_OF_ID = 0xc99e3e50;
+
+    /**
+    Constructor for messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x560f8935;
+        this.SUBCLASS_OF_ID = 0xc99e3e50;
+
+        this.date = args.date;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("35890f56","hex"),
+            struct.pack('<i', this.date),
+            ])
+        }
+    static fromReader(reader) {
+        let _date;
+        let _x;
+        let len;
+        _date = reader.readInt();
+        return new this({date:_date})
+    }
+}
+
+
+class SentEncryptedFile extends TLObject {
+    static CONSTRUCTOR_ID = 0x9493ff32;
+    static SUBCLASS_OF_ID = 0xc99e3e50;
+
+    /**
+    Constructor for messages.SentEncryptedMessage: Instance of either SentEncryptedMessage, SentEncryptedFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x9493ff32;
+        this.SUBCLASS_OF_ID = 0xc99e3e50;
+
+        this.date = args.date;
+        this.file = args.file;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("32ff9394","hex"),
+            struct.pack('<i', this.date),
+            this.file.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _date;
+        let _file;
+        let _x;
+        let len;
+        _date = reader.readInt();
+        _file = reader.tgReadObject();
+        return new this({date:_date,
+	file:_file})
+    }
+}
+
+
+class StickersNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xf1749a22;
+    static SUBCLASS_OF_ID = 0xd73bb9de;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xf1749a22;
+        this.SUBCLASS_OF_ID = 0xd73bb9de;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("229a74f1","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class Stickers extends TLObject {
+    static CONSTRUCTOR_ID = 0xe4599bbd;
+    static SUBCLASS_OF_ID = 0xd73bb9de;
+
+    /**
+    Constructor for messages.Stickers: Instance of either StickersNotModified, Stickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe4599bbd;
+        this.SUBCLASS_OF_ID = 0xd73bb9de;
+
+        this.hash = args.hash;
+        this.stickers = args.stickers;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bd9b59e4","hex"),
+            struct.pack('<i', this.hash),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.stickers.length),Buffer.concat(this.stickers.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _stickers;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        reader.readInt();
+        _stickers = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _stickers.push(_x);
+            }
+            return new this({hash:_hash,
+	stickers:_stickers})
+        }
+    }
+
+
+class AllStickersNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xe86602c3;
+    static SUBCLASS_OF_ID = 0x45834829;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xe86602c3;
+        this.SUBCLASS_OF_ID = 0x45834829;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c30266e8","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class AllStickers extends TLObject {
+    static CONSTRUCTOR_ID = 0xedfd405f;
+    static SUBCLASS_OF_ID = 0x45834829;
+
+    /**
+    Constructor for messages.AllStickers: Instance of either AllStickersNotModified, AllStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xedfd405f;
+        this.SUBCLASS_OF_ID = 0x45834829;
+
+        this.hash = args.hash;
+        this.sets = args.sets;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5f40fded","hex"),
+            struct.pack('<i', this.hash),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _sets;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        reader.readInt();
+        _sets = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _sets.push(_x);
+            }
+            return new this({hash:_hash,
+	sets:_sets})
+        }
+    }
+
+
+class AffectedMessages extends TLObject {
+    static CONSTRUCTOR_ID = 0x84d19185;
+    static SUBCLASS_OF_ID = 0xced3c06e;
+
+    /**
+    Constructor for messages.AffectedMessages: Instance of AffectedMessages
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x84d19185;
+        this.SUBCLASS_OF_ID = 0xced3c06e;
+
+        this.pts = args.pts;
+        this.ptsCount = args.ptsCount;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8591d184","hex"),
+            struct.pack('<i', this.pts),
+            struct.pack('<i', this.ptsCount),
+            ])
+        }
+    static fromReader(reader) {
+        let _pts;
+        let _pts_count;
+        let _x;
+        let len;
+        _pts = reader.readInt();
+        _pts_count = reader.readInt();
+        return new this({pts:_pts,
+	ptsCount:_pts_count})
+    }
+}
+
+
+class StickerSet extends TLObject {
+    static CONSTRUCTOR_ID = 0xb60a24a6;
+    static SUBCLASS_OF_ID = 0x9b704a5a;
+
+    /**
+    Constructor for messages.StickerSet: Instance of StickerSet
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xb60a24a6;
+        this.SUBCLASS_OF_ID = 0x9b704a5a;
+
+        this.set = args.set;
+        this.packs = args.packs;
+        this.documents = args.documents;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a6240ab6","hex"),
+            this.set.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.packs.length),Buffer.concat(this.packs.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.documents.length),Buffer.concat(this.documents.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _set;
+        let _packs;
+        let _documents;
+        let _x;
+        let len;
+        _set = reader.tgReadObject();
+        reader.readInt();
+        _packs = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _packs.push(_x);
+            }
+            reader.readInt();
+            _documents = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _documents.push(_x);
+                }
+                return new this({set:_set,
+	packs:_packs,
+	documents:_documents})
+            }
+        }
+
+
+class FoundGifs extends TLObject {
+    static CONSTRUCTOR_ID = 0x450a1c0a;
+    static SUBCLASS_OF_ID = 0xe799ea7;
+
+    /**
+    Constructor for messages.FoundGifs: Instance of FoundGifs
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x450a1c0a;
+        this.SUBCLASS_OF_ID = 0xe799ea7;
+
+        this.nextOffset = args.nextOffset;
+        this.results = args.results;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0a1c0a45","hex"),
+            struct.pack('<i', this.nextOffset),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.results.length),Buffer.concat(this.results.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _next_offset;
+        let _results;
+        let _x;
+        let len;
+        _next_offset = reader.readInt();
+        reader.readInt();
+        _results = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _results.push(_x);
+            }
+            return new this({nextOffset:_next_offset,
+	results:_results})
+        }
+    }
+
+
+class SavedGifsNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0xe8025ca2;
+    static SUBCLASS_OF_ID = 0xa68b61f5;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xe8025ca2;
+        this.SUBCLASS_OF_ID = 0xa68b61f5;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a25c02e8","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class SavedGifs extends TLObject {
+    static CONSTRUCTOR_ID = 0x2e0709a5;
+    static SUBCLASS_OF_ID = 0xa68b61f5;
+
+    /**
+    Constructor for messages.SavedGifs: Instance of either SavedGifsNotModified, SavedGifs
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2e0709a5;
+        this.SUBCLASS_OF_ID = 0xa68b61f5;
+
+        this.hash = args.hash;
+        this.gifs = args.gifs;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a509072e","hex"),
+            struct.pack('<i', this.hash),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.gifs.length),Buffer.concat(this.gifs.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _gifs;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        reader.readInt();
+        _gifs = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _gifs.push(_x);
+            }
+            return new this({hash:_hash,
+	gifs:_gifs})
+        }
+    }
+
+
+class BotResults extends TLObject {
+    static CONSTRUCTOR_ID = 0x947ca848;
+    static SUBCLASS_OF_ID = 0x3ed4d9c9;
+
+    /**
+    Constructor for messages.BotResults: Instance of BotResults
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x947ca848;
+        this.SUBCLASS_OF_ID = 0x3ed4d9c9;
+
+        this.gallery = args.gallery || null;
+        this.queryId = args.queryId;
+        this.nextOffset = args.nextOffset || null;
+        this.switchPm = args.switchPm || null;
+        this.results = args.results;
+        this.cacheTime = args.cacheTime;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("48a87c94","hex"),
+            struct.pack('<I', (this.gallery === undefined || this.gallery === false || this.gallery === null) ? 0 : 1 | (this.nextOffset === undefined || this.nextOffset === false || this.nextOffset === null) ? 0 : 2 | (this.switchPm === undefined || this.switchPm === false || this.switchPm === null) ? 0 : 4),
+            readBufferFromBigInt(this.queryId,8,true,true),
+            (this.nextOffset === undefined || this.nextOffset === false || this.nextOffset ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.nextOffset)],
+            (this.switchPm === undefined || this.switchPm === false || this.switchPm ===null) ? Buffer.alloc(0) : [this.switchPm.getBytes()],
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.results.length),Buffer.concat(this.results.map(x => x.getBytes())),
+            struct.pack('<i', this.cacheTime),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _gallery;
+        let _query_id;
+        let _next_offset;
+        let _switch_pm;
+        let _results;
+        let _cache_time;
+        let _users;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _gallery = Boolean(flags & 1);
+        _query_id = reader.readLong();
+        if (flags & 2) {
+            _next_offset = reader.tgReadString();
+        }
+        else {
+            _next_offset = null
+        }
+        if (flags & 4) {
+            _switch_pm = reader.tgReadObject();
+        }
+        else {
+            _switch_pm = null
+        }
+        reader.readInt();
+        _results = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _results.push(_x);
+            }
+            _cache_time = reader.readInt();
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({gallery:_gallery,
+	queryId:_query_id,
+	nextOffset:_next_offset,
+	switchPm:_switch_pm,
+	results:_results,
+	cacheTime:_cache_time,
+	users:_users})
+            }
+        }
+
+
+class BotCallbackAnswer extends TLObject {
+    static CONSTRUCTOR_ID = 0x36585ea4;
+    static SUBCLASS_OF_ID = 0x6c4dd18c;
+
+    /**
+    Constructor for messages.BotCallbackAnswer: Instance of BotCallbackAnswer
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x36585ea4;
+        this.SUBCLASS_OF_ID = 0x6c4dd18c;
+
+        this.alert = args.alert || null;
+        this.hasUrl = args.hasUrl || null;
+        this.nativeUi = args.nativeUi || null;
+        this.message = args.message || null;
+        this.url = args.url || null;
+        this.cacheTime = args.cacheTime;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a45e5836","hex"),
+            struct.pack('<I', (this.alert === undefined || this.alert === false || this.alert === null) ? 0 : 2 | (this.hasUrl === undefined || this.hasUrl === false || this.hasUrl === null) ? 0 : 8 | (this.nativeUi === undefined || this.nativeUi === false || this.nativeUi === null) ? 0 : 16 | (this.message === undefined || this.message === false || this.message === null) ? 0 : 1 | (this.url === undefined || this.url === false || this.url === null) ? 0 : 4),
+            (this.message === undefined || this.message === false || this.message ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.message)],
+            (this.url === undefined || this.url === false || this.url ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.url)],
+            struct.pack('<i', this.cacheTime),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _alert;
+        let _has_url;
+        let _native_ui;
+        let _message;
+        let _url;
+        let _cache_time;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _alert = Boolean(flags & 2);
+        _has_url = Boolean(flags & 8);
+        _native_ui = Boolean(flags & 16);
+        if (flags & 1) {
+            _message = reader.tgReadString();
+        }
+        else {
+            _message = null
+        }
+        if (flags & 4) {
+            _url = reader.tgReadString();
+        }
+        else {
+            _url = null
+        }
+        _cache_time = reader.readInt();
+        return new this({alert:_alert,
+	hasUrl:_has_url,
+	nativeUi:_native_ui,
+	message:_message,
+	url:_url,
+	cacheTime:_cache_time})
+    }
+}
+
+
+class MessageEditData extends TLObject {
+    static CONSTRUCTOR_ID = 0x26b5dde6;
+    static SUBCLASS_OF_ID = 0xfb47949d;
+
+    /**
+    Constructor for messages.MessageEditData: Instance of MessageEditData
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x26b5dde6;
+        this.SUBCLASS_OF_ID = 0xfb47949d;
+
+        this.caption = args.caption || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e6ddb526","hex"),
+            struct.pack('<I', (this.caption === undefined || this.caption === false || this.caption === null) ? 0 : 1),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _caption;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _caption = Boolean(flags & 1);
+        return new this({caption:_caption})
+    }
+}
+
+
+class PeerDialogs extends TLObject {
+    static CONSTRUCTOR_ID = 0x3371c354;
+    static SUBCLASS_OF_ID = 0x3ac70132;
+
+    /**
+    Constructor for messages.PeerDialogs: Instance of PeerDialogs
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3371c354;
+        this.SUBCLASS_OF_ID = 0x3ac70132;
+
+        this.dialogs = args.dialogs;
+        this.messages = args.messages;
+        this.chats = args.chats;
+        this.users = args.users;
+        this.state = args.state;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("54c37133","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.dialogs.length),Buffer.concat(this.dialogs.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            this.state.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _dialogs;
+        let _messages;
+        let _chats;
+        let _users;
+        let _state;
+        let _x;
+        let len;
+        reader.readInt();
+        _dialogs = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _dialogs.push(_x);
+            }
+            reader.readInt();
+            _messages = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _messages.push(_x);
+                }
+                reader.readInt();
+                _chats = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _chats.push(_x);
+                    }
+                    reader.readInt();
+                    _users = [];
+                    len = reader.readInt();
+                    for (let i=0;i<len;i++){
+                        _x = reader.tgReadObject();
+                        _users.push(_x);
+                        }
+                        _state = reader.tgReadObject();
+                        return new this({dialogs:_dialogs,
+	messages:_messages,
+	chats:_chats,
+	users:_users,
+	state:_state})
+                    }
+                }
+
+
+class FeaturedStickersNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0x04ede3cf;
+    static SUBCLASS_OF_ID = 0x2614b722;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x04ede3cf;
+        this.SUBCLASS_OF_ID = 0x2614b722;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("cfe3ed04","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FeaturedStickers extends TLObject {
+    static CONSTRUCTOR_ID = 0xf89d88e5;
+    static SUBCLASS_OF_ID = 0x2614b722;
+
+    /**
+    Constructor for messages.FeaturedStickers: Instance of either FeaturedStickersNotModified, FeaturedStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf89d88e5;
+        this.SUBCLASS_OF_ID = 0x2614b722;
+
+        this.hash = args.hash;
+        this.sets = args.sets;
+        this.unread = args.unread;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e5889df8","hex"),
+            struct.pack('<i', this.hash),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.unread.length),Buffer.concat(this.unread.map(x => readBufferFromBigInt(x,8,true,true))),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _sets;
+        let _unread;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        reader.readInt();
+        _sets = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _sets.push(_x);
+            }
+            reader.readInt();
+            _unread = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.readLong();
+                _unread.push(_x);
+                }
+                return new this({hash:_hash,
+	sets:_sets,
+	unread:_unread})
+            }
+        }
+
+
+class RecentStickersNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0x0b17f890;
+    static SUBCLASS_OF_ID = 0xf76f8683;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x0b17f890;
+        this.SUBCLASS_OF_ID = 0xf76f8683;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("90f8170b","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class RecentStickers extends TLObject {
+    static CONSTRUCTOR_ID = 0x22f3afb3;
+    static SUBCLASS_OF_ID = 0xf76f8683;
+
+    /**
+    Constructor for messages.RecentStickers: Instance of either RecentStickersNotModified, RecentStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x22f3afb3;
+        this.SUBCLASS_OF_ID = 0xf76f8683;
+
+        this.hash = args.hash;
+        this.packs = args.packs;
+        this.stickers = args.stickers;
+        this.dates = args.dates;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("b3aff322","hex"),
+            struct.pack('<i', this.hash),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.packs.length),Buffer.concat(this.packs.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.stickers.length),Buffer.concat(this.stickers.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.dates.length),Buffer.concat(this.dates.map(x => struct.pack('<i', x))),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _packs;
+        let _stickers;
+        let _dates;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        reader.readInt();
+        _packs = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _packs.push(_x);
+            }
+            reader.readInt();
+            _stickers = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _stickers.push(_x);
+                }
+                reader.readInt();
+                _dates = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.readInt();
+                    _dates.push(_x);
+                    }
+                    return new this({hash:_hash,
+	packs:_packs,
+	stickers:_stickers,
+	dates:_dates})
+                }
+            }
+
+
+class ArchivedStickers extends TLObject {
+    static CONSTRUCTOR_ID = 0x4fcba9c8;
+    static SUBCLASS_OF_ID = 0x7296d771;
+
+    /**
+    Constructor for messages.ArchivedStickers: Instance of ArchivedStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4fcba9c8;
+        this.SUBCLASS_OF_ID = 0x7296d771;
+
+        this.count = args.count;
+        this.sets = args.sets;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c8a9cb4f","hex"),
+            struct.pack('<i', this.count),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _count;
+        let _sets;
+        let _x;
+        let len;
+        _count = reader.readInt();
+        reader.readInt();
+        _sets = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _sets.push(_x);
+            }
+            return new this({count:_count,
+	sets:_sets})
+        }
+    }
+
+
+class StickerSetInstallResultSuccess extends TLObject {
+    static CONSTRUCTOR_ID = 0x38641628;
+    static SUBCLASS_OF_ID = 0x67cb3fe8;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x38641628;
+        this.SUBCLASS_OF_ID = 0x67cb3fe8;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("28166438","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class StickerSetInstallResultArchive extends TLObject {
+    static CONSTRUCTOR_ID = 0x35e410a8;
+    static SUBCLASS_OF_ID = 0x67cb3fe8;
+
+    /**
+    Constructor for messages.StickerSetInstallResult: Instance of either StickerSetInstallResultSuccess, StickerSetInstallResultArchive
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x35e410a8;
+        this.SUBCLASS_OF_ID = 0x67cb3fe8;
+
+        this.sets = args.sets;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a810e435","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _sets;
+        let _x;
+        let len;
+        reader.readInt();
+        _sets = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _sets.push(_x);
+            }
+            return new this({sets:_sets})
+        }
+    }
+
+
+class HighScores extends TLObject {
+    static CONSTRUCTOR_ID = 0x9a3bfd99;
+    static SUBCLASS_OF_ID = 0x6ccd95fd;
+
+    /**
+    Constructor for messages.HighScores: Instance of HighScores
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x9a3bfd99;
+        this.SUBCLASS_OF_ID = 0x6ccd95fd;
+
+        this.scores = args.scores;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("99fd3b9a","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.scores.length),Buffer.concat(this.scores.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _scores;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _scores = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _scores.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({scores:_scores,
+	users:_users})
+            }
+        }
+
+
+class FavedStickersNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0x9e8fa6d3;
+    static SUBCLASS_OF_ID = 0x8e736fb9;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x9e8fa6d3;
+        this.SUBCLASS_OF_ID = 0x8e736fb9;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d3a68f9e","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FavedStickers extends TLObject {
+    static CONSTRUCTOR_ID = 0xf37f2f16;
+    static SUBCLASS_OF_ID = 0x8e736fb9;
+
+    /**
+    Constructor for messages.FavedStickers: Instance of either FavedStickersNotModified, FavedStickers
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf37f2f16;
+        this.SUBCLASS_OF_ID = 0x8e736fb9;
+
+        this.hash = args.hash;
+        this.packs = args.packs;
+        this.stickers = args.stickers;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("162f7ff3","hex"),
+            struct.pack('<i', this.hash),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.packs.length),Buffer.concat(this.packs.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.stickers.length),Buffer.concat(this.stickers.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _packs;
+        let _stickers;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        reader.readInt();
+        _packs = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _packs.push(_x);
+            }
+            reader.readInt();
+            _stickers = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _stickers.push(_x);
+                }
+                return new this({hash:_hash,
+	packs:_packs,
+	stickers:_stickers})
+            }
+        }
+
+
+class FoundStickerSetsNotModified extends TLObject {
+    static CONSTRUCTOR_ID = 0x0d54b65d;
+    static SUBCLASS_OF_ID = 0x40df361;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x0d54b65d;
+        this.SUBCLASS_OF_ID = 0x40df361;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("5db6540d","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FoundStickerSets extends TLObject {
+    static CONSTRUCTOR_ID = 0x5108d648;
+    static SUBCLASS_OF_ID = 0x40df361;
+
+    /**
+    Constructor for messages.FoundStickerSets: Instance of either FoundStickerSetsNotModified, FoundStickerSets
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x5108d648;
+        this.SUBCLASS_OF_ID = 0x40df361;
+
+        this.hash = args.hash;
+        this.sets = args.sets;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("48d60851","hex"),
+            struct.pack('<i', this.hash),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.sets.length),Buffer.concat(this.sets.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _hash;
+        let _sets;
+        let _x;
+        let len;
+        _hash = reader.readInt();
+        reader.readInt();
+        _sets = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _sets.push(_x);
+            }
+            return new this({hash:_hash,
+	sets:_sets})
+        }
+    }
+
+
+class SearchCounter extends TLObject {
+    static CONSTRUCTOR_ID = 0xe844ebff;
+    static SUBCLASS_OF_ID = 0xd6a7bfa2;
+
+    /**
+    Constructor for messages.SearchCounter: Instance of SearchCounter
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xe844ebff;
+        this.SUBCLASS_OF_ID = 0xd6a7bfa2;
+
+        this.inexact = args.inexact || null;
+        this.filter = args.filter;
+        this.count = args.count;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("ffeb44e8","hex"),
+            struct.pack('<I', (this.inexact === undefined || this.inexact === false || this.inexact === null) ? 0 : 2),
+            this.filter.getBytes(),
+            struct.pack('<i', this.count),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _inexact;
+        let _filter;
+        let _count;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _inexact = Boolean(flags & 2);
+        _filter = reader.tgReadObject();
+        _count = reader.readInt();
+        return new this({inexact:_inexact,
+	filter:_filter,
+	count:_count})
+    }
+}
+
+module.exports = {
+    Dialogs,
+    DialogsSlice,
+    DialogsNotModified,
+    Messages,
+    MessagesSlice,
+    ChannelMessages,
+    MessagesNotModified,
+    Chats,
+    ChatsSlice,
+    ChatFull,
+    AffectedHistory,
+    DhConfigNotModified,
+    DhConfig,
+    SentEncryptedMessage,
+    SentEncryptedFile,
+    StickersNotModified,
+    Stickers,
+    AllStickersNotModified,
+    AllStickers,
+    AffectedMessages,
+    StickerSet,
+    FoundGifs,
+    SavedGifsNotModified,
+    SavedGifs,
+    BotResults,
+    BotCallbackAnswer,
+    MessageEditData,
+    PeerDialogs,
+    FeaturedStickersNotModified,
+    FeaturedStickers,
+    RecentStickersNotModified,
+    RecentStickers,
+    ArchivedStickers,
+    StickerSetInstallResultSuccess,
+    StickerSetInstallResultArchive,
+    HighScores,
+    FavedStickersNotModified,
+    FavedStickers,
+    FoundStickerSetsNotModified,
+    FoundStickerSets,
+    SearchCounter,
+};

+ 383 - 0
src/lib/gramjs/tl/types/payments.js

@@ -0,0 +1,383 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class PaymentForm extends TLObject {
+    static CONSTRUCTOR_ID = 0x3f56aea3;
+    static SUBCLASS_OF_ID = 0xa0483f19;
+
+    /**
+    Constructor for payments.PaymentForm: Instance of PaymentForm
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3f56aea3;
+        this.SUBCLASS_OF_ID = 0xa0483f19;
+
+        this.canSaveCredentials = args.canSaveCredentials || null;
+        this.passwordMissing = args.passwordMissing || null;
+        this.botId = args.botId;
+        this.invoice = args.invoice;
+        this.providerId = args.providerId;
+        this.url = args.url;
+        this.nativeProvider = args.nativeProvider || null;
+        this.nativeParams = args.nativeParams || null;
+        this.savedInfo = args.savedInfo || null;
+        this.savedCredentials = args.savedCredentials || null;
+        this.users = args.users;
+    }
+    getBytes() {
+        if (!((this.native_provider || this.native_provider!==null && this.native_params || this.native_params!==null) && (this.native_provider===null || this.native_provider===false && this.native_params===null || this.native_params===false)))
+	 throw new Error('native_provider, native_params paramaters must all be false-y or all true')
+        return Buffer.concat([
+            Buffer.from("a3ae563f","hex"),
+            struct.pack('<I', (this.canSaveCredentials === undefined || this.canSaveCredentials === false || this.canSaveCredentials === null) ? 0 : 4 | (this.passwordMissing === undefined || this.passwordMissing === false || this.passwordMissing === null) ? 0 : 8 | (this.nativeProvider === undefined || this.nativeProvider === false || this.nativeProvider === null) ? 0 : 16 | (this.nativeParams === undefined || this.nativeParams === false || this.nativeParams === null) ? 0 : 16 | (this.savedInfo === undefined || this.savedInfo === false || this.savedInfo === null) ? 0 : 1 | (this.savedCredentials === undefined || this.savedCredentials === false || this.savedCredentials === null) ? 0 : 2),
+            struct.pack('<i', this.botId),
+            this.invoice.getBytes(),
+            struct.pack('<i', this.providerId),
+            TLObject.serializeBytes(this.url),
+            (this.nativeProvider === undefined || this.nativeProvider === false || this.nativeProvider ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.nativeProvider)],
+            (this.nativeParams === undefined || this.nativeParams === false || this.nativeParams ===null) ? Buffer.alloc(0) : [this.nativeParams.getBytes()],
+            (this.savedInfo === undefined || this.savedInfo === false || this.savedInfo ===null) ? Buffer.alloc(0) : [this.savedInfo.getBytes()],
+            (this.savedCredentials === undefined || this.savedCredentials === false || this.savedCredentials ===null) ? Buffer.alloc(0) : [this.savedCredentials.getBytes()],
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _can_save_credentials;
+        let _password_missing;
+        let _bot_id;
+        let _invoice;
+        let _provider_id;
+        let _url;
+        let _native_provider;
+        let _native_params;
+        let _saved_info;
+        let _saved_credentials;
+        let _users;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _can_save_credentials = Boolean(flags & 4);
+        _password_missing = Boolean(flags & 8);
+        _bot_id = reader.readInt();
+        _invoice = reader.tgReadObject();
+        _provider_id = reader.readInt();
+        _url = reader.tgReadString();
+        if (flags & 16) {
+            _native_provider = reader.tgReadString();
+        }
+        else {
+            _native_provider = null
+        }
+        if (flags & 16) {
+            _native_params = reader.tgReadObject();
+        }
+        else {
+            _native_params = null
+        }
+        if (flags & 1) {
+            _saved_info = reader.tgReadObject();
+        }
+        else {
+            _saved_info = null
+        }
+        if (flags & 2) {
+            _saved_credentials = reader.tgReadObject();
+        }
+        else {
+            _saved_credentials = null
+        }
+        reader.readInt();
+        _users = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _users.push(_x);
+            }
+            return new this({canSaveCredentials:_can_save_credentials,
+	passwordMissing:_password_missing,
+	botId:_bot_id,
+	invoice:_invoice,
+	providerId:_provider_id,
+	url:_url,
+	nativeProvider:_native_provider,
+	nativeParams:_native_params,
+	savedInfo:_saved_info,
+	savedCredentials:_saved_credentials,
+	users:_users})
+        }
+    }
+
+
+class ValidatedRequestedInfo extends TLObject {
+    static CONSTRUCTOR_ID = 0xd1451883;
+    static SUBCLASS_OF_ID = 0x8f8044b7;
+
+    /**
+    Constructor for payments.ValidatedRequestedInfo: Instance of ValidatedRequestedInfo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd1451883;
+        this.SUBCLASS_OF_ID = 0x8f8044b7;
+
+        this.id = args.id || null;
+        this.shippingOptions = args.shippingOptions || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("831845d1","hex"),
+            struct.pack('<I', (this.id === undefined || this.id === false || this.id === null) ? 0 : 1 | (this.shippingOptions === undefined || this.shippingOptions === false || this.shippingOptions === null) ? 0 : 2),
+            (this.id === undefined || this.id === false || this.id ===null) ? Buffer.alloc(0) : [TLObject.serializeBytes(this.id)],
+            (this.shippingOptions === undefined || this.shippingOptions === false || this.shippingOptions ===null) ? Buffer.alloc(0) :Buffer.concat([Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.shippingOptions.length),Buffer.concat(this.shippingOptions.map(x => x.getBytes()))]),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _id;
+        let _shipping_options;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        if (flags & 1) {
+            _id = reader.tgReadString();
+        }
+        else {
+            _id = null
+        }
+        if (flags & 2) {
+            reader.readInt();
+            _shipping_options = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _shipping_options.push(_x);
+                }
+            }
+            else {
+                _shipping_options = null
+            }
+            return new this({id:_id,
+	shippingOptions:_shipping_options})
+        }
+    }
+
+
+class PaymentResult extends TLObject {
+    static CONSTRUCTOR_ID = 0x4e5f810d;
+    static SUBCLASS_OF_ID = 0x8ae16a9d;
+
+    /**
+    Constructor for payments.PaymentResult: Instance of either PaymentResult, PaymentVerificationNeeded
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4e5f810d;
+        this.SUBCLASS_OF_ID = 0x8ae16a9d;
+
+        this.updates = args.updates;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0d815f4e","hex"),
+            this.updates.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _updates;
+        let _x;
+        let len;
+        _updates = reader.tgReadObject();
+        return new this({updates:_updates})
+    }
+}
+
+
+class PaymentVerificationNeeded extends TLObject {
+    static CONSTRUCTOR_ID = 0xd8411139;
+    static SUBCLASS_OF_ID = 0x8ae16a9d;
+
+    /**
+    Constructor for payments.PaymentResult: Instance of either PaymentResult, PaymentVerificationNeeded
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xd8411139;
+        this.SUBCLASS_OF_ID = 0x8ae16a9d;
+
+        this.url = args.url;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("391141d8","hex"),
+            TLObject.serializeBytes(this.url),
+            ])
+        }
+    static fromReader(reader) {
+        let _url;
+        let _x;
+        let len;
+        _url = reader.tgReadString();
+        return new this({url:_url})
+    }
+}
+
+
+class PaymentReceipt extends TLObject {
+    static CONSTRUCTOR_ID = 0x500911e1;
+    static SUBCLASS_OF_ID = 0x590093c9;
+
+    /**
+    Constructor for payments.PaymentReceipt: Instance of PaymentReceipt
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x500911e1;
+        this.SUBCLASS_OF_ID = 0x590093c9;
+
+        this.date = args.date;
+        this.botId = args.botId;
+        this.invoice = args.invoice;
+        this.providerId = args.providerId;
+        this.info = args.info || null;
+        this.shipping = args.shipping || null;
+        this.currency = args.currency;
+        this.totalAmount = args.totalAmount;
+        this.credentialsTitle = args.credentialsTitle;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e1110950","hex"),
+            struct.pack('<I', (this.info === undefined || this.info === false || this.info === null) ? 0 : 1 | (this.shipping === undefined || this.shipping === false || this.shipping === null) ? 0 : 2),
+            struct.pack('<i', this.date),
+            struct.pack('<i', this.botId),
+            this.invoice.getBytes(),
+            struct.pack('<i', this.providerId),
+            (this.info === undefined || this.info === false || this.info ===null) ? Buffer.alloc(0) : [this.info.getBytes()],
+            (this.shipping === undefined || this.shipping === false || this.shipping ===null) ? Buffer.alloc(0) : [this.shipping.getBytes()],
+            TLObject.serializeBytes(this.currency),
+            readBufferFromBigInt(this.totalAmount,8,true,true),
+            TLObject.serializeBytes(this.credentialsTitle),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _date;
+        let _bot_id;
+        let _invoice;
+        let _provider_id;
+        let _info;
+        let _shipping;
+        let _currency;
+        let _total_amount;
+        let _credentials_title;
+        let _users;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _date = reader.readInt();
+        _bot_id = reader.readInt();
+        _invoice = reader.tgReadObject();
+        _provider_id = reader.readInt();
+        if (flags & 1) {
+            _info = reader.tgReadObject();
+        }
+        else {
+            _info = null
+        }
+        if (flags & 2) {
+            _shipping = reader.tgReadObject();
+        }
+        else {
+            _shipping = null
+        }
+        _currency = reader.tgReadString();
+        _total_amount = reader.readLong();
+        _credentials_title = reader.tgReadString();
+        reader.readInt();
+        _users = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _users.push(_x);
+            }
+            return new this({date:_date,
+	botId:_bot_id,
+	invoice:_invoice,
+	providerId:_provider_id,
+	info:_info,
+	shipping:_shipping,
+	currency:_currency,
+	totalAmount:_total_amount,
+	credentialsTitle:_credentials_title,
+	users:_users})
+        }
+    }
+
+
+class SavedInfo extends TLObject {
+    static CONSTRUCTOR_ID = 0xfb8fe43c;
+    static SUBCLASS_OF_ID = 0xad3cf146;
+
+    /**
+    Constructor for payments.SavedInfo: Instance of SavedInfo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xfb8fe43c;
+        this.SUBCLASS_OF_ID = 0xad3cf146;
+
+        this.hasSavedCredentials = args.hasSavedCredentials || null;
+        this.savedInfo = args.savedInfo || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3ce48ffb","hex"),
+            struct.pack('<I', (this.hasSavedCredentials === undefined || this.hasSavedCredentials === false || this.hasSavedCredentials === null) ? 0 : 2 | (this.savedInfo === undefined || this.savedInfo === false || this.savedInfo === null) ? 0 : 1),
+            (this.savedInfo === undefined || this.savedInfo === false || this.savedInfo ===null) ? Buffer.alloc(0) : [this.savedInfo.getBytes()],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _has_saved_credentials;
+        let _saved_info;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _has_saved_credentials = Boolean(flags & 2);
+        if (flags & 1) {
+            _saved_info = reader.tgReadObject();
+        }
+        else {
+            _saved_info = null
+        }
+        return new this({hasSavedCredentials:_has_saved_credentials,
+	savedInfo:_saved_info})
+    }
+}
+
+module.exports = {
+    PaymentForm,
+    ValidatedRequestedInfo,
+    PaymentResult,
+    PaymentVerificationNeeded,
+    PaymentReceipt,
+    SavedInfo,
+};

+ 51 - 0
src/lib/gramjs/tl/types/phone.js

@@ -0,0 +1,51 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class PhoneCall extends TLObject {
+    static CONSTRUCTOR_ID = 0xec82e140;
+    static SUBCLASS_OF_ID = 0xd48afe4f;
+
+    /**
+    Constructor for phone.PhoneCall: Instance of PhoneCall
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xec82e140;
+        this.SUBCLASS_OF_ID = 0xd48afe4f;
+
+        this.phoneCall = args.phoneCall;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("40e182ec","hex"),
+            this.phoneCall.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _phone_call;
+        let _users;
+        let _x;
+        let len;
+        _phone_call = reader.tgReadObject();
+        reader.readInt();
+        _users = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _users.push(_x);
+            }
+            return new this({phoneCall:_phone_call,
+	users:_users})
+        }
+    }
+
+module.exports = {
+    PhoneCall,
+};

+ 154 - 0
src/lib/gramjs/tl/types/photos.js

@@ -0,0 +1,154 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class Photos extends TLObject {
+    static CONSTRUCTOR_ID = 0x8dca6aa5;
+    static SUBCLASS_OF_ID = 0x27cfb967;
+
+    /**
+    Constructor for photos.Photos: Instance of either Photos, PhotosSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x8dca6aa5;
+        this.SUBCLASS_OF_ID = 0x27cfb967;
+
+        this.photos = args.photos;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a56aca8d","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.photos.length),Buffer.concat(this.photos.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _photos;
+        let _users;
+        let _x;
+        let len;
+        reader.readInt();
+        _photos = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _photos.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({photos:_photos,
+	users:_users})
+            }
+        }
+
+
+class PhotosSlice extends TLObject {
+    static CONSTRUCTOR_ID = 0x15051f54;
+    static SUBCLASS_OF_ID = 0x27cfb967;
+
+    /**
+    Constructor for photos.Photos: Instance of either Photos, PhotosSlice
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x15051f54;
+        this.SUBCLASS_OF_ID = 0x27cfb967;
+
+        this.count = args.count;
+        this.photos = args.photos;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("541f0515","hex"),
+            struct.pack('<i', this.count),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.photos.length),Buffer.concat(this.photos.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _count;
+        let _photos;
+        let _users;
+        let _x;
+        let len;
+        _count = reader.readInt();
+        reader.readInt();
+        _photos = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _photos.push(_x);
+            }
+            reader.readInt();
+            _users = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _users.push(_x);
+                }
+                return new this({count:_count,
+	photos:_photos,
+	users:_users})
+            }
+        }
+
+
+class Photo extends TLObject {
+    static CONSTRUCTOR_ID = 0x20212ca8;
+    static SUBCLASS_OF_ID = 0xc292bd24;
+
+    /**
+    Constructor for photos.Photo: Instance of Photo
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x20212ca8;
+        this.SUBCLASS_OF_ID = 0xc292bd24;
+
+        this.photo = args.photo;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a82c2120","hex"),
+            this.photo.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _photo;
+        let _users;
+        let _x;
+        let len;
+        _photo = reader.tgReadObject();
+        reader.readInt();
+        _users = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _users.push(_x);
+            }
+            return new this({photo:_photo,
+	users:_users})
+        }
+    }
+
+module.exports = {
+    Photos,
+    PhotosSlice,
+    Photo,
+};

+ 248 - 0
src/lib/gramjs/tl/types/storage.js

@@ -0,0 +1,248 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class FileUnknown extends TLObject {
+    static CONSTRUCTOR_ID = 0xaa963b05;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xaa963b05;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("053b96aa","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FilePartial extends TLObject {
+    static CONSTRUCTOR_ID = 0x40bc6f52;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x40bc6f52;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("526fbc40","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FileJpeg extends TLObject {
+    static CONSTRUCTOR_ID = 0x007efe0e;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x007efe0e;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("0efe7e00","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FileGif extends TLObject {
+    static CONSTRUCTOR_ID = 0xcae1aadf;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xcae1aadf;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("dfaae1ca","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FilePng extends TLObject {
+    static CONSTRUCTOR_ID = 0x0a4f63c0;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x0a4f63c0;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("c0634f0a","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FilePdf extends TLObject {
+    static CONSTRUCTOR_ID = 0xae1e508d;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xae1e508d;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8d501eae","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FileMp3 extends TLObject {
+    static CONSTRUCTOR_ID = 0x528a0677;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x528a0677;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("77068a52","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FileMov extends TLObject {
+    static CONSTRUCTOR_ID = 0x4b09ebbc;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x4b09ebbc;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bceb094b","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FileMp4 extends TLObject {
+    static CONSTRUCTOR_ID = 0xb3cea0e4;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0xb3cea0e4;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("e4a0ceb3","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+
+class FileWebp extends TLObject {
+    static CONSTRUCTOR_ID = 0x1081464c;
+    static SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    constructor() {
+        super();
+        this.CONSTRUCTOR_ID = 0x1081464c;
+        this.SUBCLASS_OF_ID = 0xf3a1e6f3;
+
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4c468110","hex"),
+            ])
+        }
+    static fromReader(reader) {
+        let _x;
+        let len;
+        return new this({})
+    }
+}
+
+module.exports = {
+    FileUnknown,
+    FilePartial,
+    FileJpeg,
+    FileGif,
+    FilePng,
+    FilePdf,
+    FileMp3,
+    FileMov,
+    FileMp4,
+    FileWebp,
+};

+ 530 - 0
src/lib/gramjs/tl/types/updates.js

@@ -0,0 +1,530 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class State extends TLObject {
+    static CONSTRUCTOR_ID = 0xa56c2a3e;
+    static SUBCLASS_OF_ID = 0x23df1a01;
+
+    /**
+    Constructor for updates.State: Instance of State
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa56c2a3e;
+        this.SUBCLASS_OF_ID = 0x23df1a01;
+
+        this.pts = args.pts;
+        this.qts = args.qts;
+        this.date = args.date;
+        this.seq = args.seq;
+        this.unreadCount = args.unreadCount;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("3e2a6ca5","hex"),
+            struct.pack('<i', this.pts),
+            struct.pack('<i', this.qts),
+            struct.pack('<i', this.date),
+            struct.pack('<i', this.seq),
+            struct.pack('<i', this.unreadCount),
+            ])
+        }
+    static fromReader(reader) {
+        let _pts;
+        let _qts;
+        let _date;
+        let _seq;
+        let _unread_count;
+        let _x;
+        let len;
+        _pts = reader.readInt();
+        _qts = reader.readInt();
+        _date = reader.readInt();
+        _seq = reader.readInt();
+        _unread_count = reader.readInt();
+        return new this({pts:_pts,
+	qts:_qts,
+	date:_date,
+	seq:_seq,
+	unreadCount:_unread_count})
+    }
+}
+
+
+class DifferenceEmpty extends TLObject {
+    static CONSTRUCTOR_ID = 0x5d75a138;
+    static SUBCLASS_OF_ID = 0x20482874;
+
+    /**
+    Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x5d75a138;
+        this.SUBCLASS_OF_ID = 0x20482874;
+
+        this.date = args.date;
+        this.seq = args.seq;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("38a1755d","hex"),
+            struct.pack('<i', this.date),
+            struct.pack('<i', this.seq),
+            ])
+        }
+    static fromReader(reader) {
+        let _date;
+        let _seq;
+        let _x;
+        let len;
+        _date = reader.readInt();
+        _seq = reader.readInt();
+        return new this({date:_date,
+	seq:_seq})
+    }
+}
+
+
+class Difference extends TLObject {
+    static CONSTRUCTOR_ID = 0x00f49ca0;
+    static SUBCLASS_OF_ID = 0x20482874;
+
+    /**
+    Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x00f49ca0;
+        this.SUBCLASS_OF_ID = 0x20482874;
+
+        this.newMessages = args.newMessages;
+        this.newEncryptedMessages = args.newEncryptedMessages;
+        this.otherUpdates = args.otherUpdates;
+        this.chats = args.chats;
+        this.users = args.users;
+        this.state = args.state;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("a09cf400","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newMessages.length),Buffer.concat(this.newMessages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newEncryptedMessages.length),Buffer.concat(this.newEncryptedMessages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUpdates.length),Buffer.concat(this.otherUpdates.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            this.state.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _new_messages;
+        let _new_encrypted_messages;
+        let _other_updates;
+        let _chats;
+        let _users;
+        let _state;
+        let _x;
+        let len;
+        reader.readInt();
+        _new_messages = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _new_messages.push(_x);
+            }
+            reader.readInt();
+            _new_encrypted_messages = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _new_encrypted_messages.push(_x);
+                }
+                reader.readInt();
+                _other_updates = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _other_updates.push(_x);
+                    }
+                    reader.readInt();
+                    _chats = [];
+                    len = reader.readInt();
+                    for (let i=0;i<len;i++){
+                        _x = reader.tgReadObject();
+                        _chats.push(_x);
+                        }
+                        reader.readInt();
+                        _users = [];
+                        len = reader.readInt();
+                        for (let i=0;i<len;i++){
+                            _x = reader.tgReadObject();
+                            _users.push(_x);
+                            }
+                            _state = reader.tgReadObject();
+                            return new this({newMessages:_new_messages,
+	newEncryptedMessages:_new_encrypted_messages,
+	otherUpdates:_other_updates,
+	chats:_chats,
+	users:_users,
+	state:_state})
+                        }
+                    }
+
+
+class DifferenceSlice extends TLObject {
+    static CONSTRUCTOR_ID = 0xa8fb1981;
+    static SUBCLASS_OF_ID = 0x20482874;
+
+    /**
+    Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa8fb1981;
+        this.SUBCLASS_OF_ID = 0x20482874;
+
+        this.newMessages = args.newMessages;
+        this.newEncryptedMessages = args.newEncryptedMessages;
+        this.otherUpdates = args.otherUpdates;
+        this.chats = args.chats;
+        this.users = args.users;
+        this.intermediateState = args.intermediateState;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("8119fba8","hex"),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newMessages.length),Buffer.concat(this.newMessages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newEncryptedMessages.length),Buffer.concat(this.newEncryptedMessages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUpdates.length),Buffer.concat(this.otherUpdates.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            this.intermediateState.getBytes(),
+            ])
+        }
+    static fromReader(reader) {
+        let _new_messages;
+        let _new_encrypted_messages;
+        let _other_updates;
+        let _chats;
+        let _users;
+        let _intermediate_state;
+        let _x;
+        let len;
+        reader.readInt();
+        _new_messages = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _new_messages.push(_x);
+            }
+            reader.readInt();
+            _new_encrypted_messages = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _new_encrypted_messages.push(_x);
+                }
+                reader.readInt();
+                _other_updates = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _other_updates.push(_x);
+                    }
+                    reader.readInt();
+                    _chats = [];
+                    len = reader.readInt();
+                    for (let i=0;i<len;i++){
+                        _x = reader.tgReadObject();
+                        _chats.push(_x);
+                        }
+                        reader.readInt();
+                        _users = [];
+                        len = reader.readInt();
+                        for (let i=0;i<len;i++){
+                            _x = reader.tgReadObject();
+                            _users.push(_x);
+                            }
+                            _intermediate_state = reader.tgReadObject();
+                            return new this({newMessages:_new_messages,
+	newEncryptedMessages:_new_encrypted_messages,
+	otherUpdates:_other_updates,
+	chats:_chats,
+	users:_users,
+	intermediateState:_intermediate_state})
+                        }
+                    }
+
+
+class DifferenceTooLong extends TLObject {
+    static CONSTRUCTOR_ID = 0x4afe8f6d;
+    static SUBCLASS_OF_ID = 0x20482874;
+
+    /**
+    Constructor for updates.Difference: Instance of either DifferenceEmpty, Difference, DifferenceSlice, DifferenceTooLong
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x4afe8f6d;
+        this.SUBCLASS_OF_ID = 0x20482874;
+
+        this.pts = args.pts;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6d8ffe4a","hex"),
+            struct.pack('<i', this.pts),
+            ])
+        }
+    static fromReader(reader) {
+        let _pts;
+        let _x;
+        let len;
+        _pts = reader.readInt();
+        return new this({pts:_pts})
+    }
+}
+
+
+class ChannelDifferenceEmpty extends TLObject {
+    static CONSTRUCTOR_ID = 0x3e11affb;
+    static SUBCLASS_OF_ID = 0x29896f5d;
+
+    /**
+    Constructor for updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x3e11affb;
+        this.SUBCLASS_OF_ID = 0x29896f5d;
+
+        this.final = args.final || null;
+        this.pts = args.pts;
+        this.timeout = args.timeout || null;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("fbaf113e","hex"),
+            struct.pack('<I', (this.final === undefined || this.final === false || this.final === null) ? 0 : 1 | (this.timeout === undefined || this.timeout === false || this.timeout === null) ? 0 : 2),
+            struct.pack('<i', this.pts),
+            (this.timeout === undefined || this.timeout === false || this.timeout ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.timeout)],
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _final;
+        let _pts;
+        let _timeout;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _final = Boolean(flags & 1);
+        _pts = reader.readInt();
+        if (flags & 2) {
+            _timeout = reader.readInt();
+        }
+        else {
+            _timeout = null
+        }
+        return new this({final:_final,
+	pts:_pts,
+	timeout:_timeout})
+    }
+}
+
+
+class ChannelDifferenceTooLong extends TLObject {
+    static CONSTRUCTOR_ID = 0xa4bcc6fe;
+    static SUBCLASS_OF_ID = 0x29896f5d;
+
+    /**
+    Constructor for updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa4bcc6fe;
+        this.SUBCLASS_OF_ID = 0x29896f5d;
+
+        this.final = args.final || null;
+        this.timeout = args.timeout || null;
+        this.dialog = args.dialog;
+        this.messages = args.messages;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("fec6bca4","hex"),
+            struct.pack('<I', (this.final === undefined || this.final === false || this.final === null) ? 0 : 1 | (this.timeout === undefined || this.timeout === false || this.timeout === null) ? 0 : 2),
+            (this.timeout === undefined || this.timeout === false || this.timeout ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.timeout)],
+            this.dialog.getBytes(),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.messages.length),Buffer.concat(this.messages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _final;
+        let _timeout;
+        let _dialog;
+        let _messages;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _final = Boolean(flags & 1);
+        if (flags & 2) {
+            _timeout = reader.readInt();
+        }
+        else {
+            _timeout = null
+        }
+        _dialog = reader.tgReadObject();
+        reader.readInt();
+        _messages = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _messages.push(_x);
+            }
+            reader.readInt();
+            _chats = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _chats.push(_x);
+                }
+                reader.readInt();
+                _users = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _users.push(_x);
+                    }
+                    return new this({final:_final,
+	timeout:_timeout,
+	dialog:_dialog,
+	messages:_messages,
+	chats:_chats,
+	users:_users})
+                }
+            }
+
+
+class ChannelDifference extends TLObject {
+    static CONSTRUCTOR_ID = 0x2064674e;
+    static SUBCLASS_OF_ID = 0x29896f5d;
+
+    /**
+    Constructor for updates.ChannelDifference: Instance of either ChannelDifferenceEmpty, ChannelDifferenceTooLong, ChannelDifference
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x2064674e;
+        this.SUBCLASS_OF_ID = 0x29896f5d;
+
+        this.final = args.final || null;
+        this.pts = args.pts;
+        this.timeout = args.timeout || null;
+        this.newMessages = args.newMessages;
+        this.otherUpdates = args.otherUpdates;
+        this.chats = args.chats;
+        this.users = args.users;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4e676420","hex"),
+            struct.pack('<I', (this.final === undefined || this.final === false || this.final === null) ? 0 : 1 | (this.timeout === undefined || this.timeout === false || this.timeout === null) ? 0 : 2),
+            struct.pack('<i', this.pts),
+            (this.timeout === undefined || this.timeout === false || this.timeout ===null) ? Buffer.alloc(0) : [struct.pack('<i', this.timeout)],
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.newMessages.length),Buffer.concat(this.newMessages.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.otherUpdates.length),Buffer.concat(this.otherUpdates.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.chats.length),Buffer.concat(this.chats.map(x => x.getBytes())),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.users.length),Buffer.concat(this.users.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _flags;
+        let _final;
+        let _pts;
+        let _timeout;
+        let _new_messages;
+        let _other_updates;
+        let _chats;
+        let _users;
+        let _x;
+        let len;
+        let flags = reader.readInt();
+
+        _final = Boolean(flags & 1);
+        _pts = reader.readInt();
+        if (flags & 2) {
+            _timeout = reader.readInt();
+        }
+        else {
+            _timeout = null
+        }
+        reader.readInt();
+        _new_messages = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _new_messages.push(_x);
+            }
+            reader.readInt();
+            _other_updates = [];
+            len = reader.readInt();
+            for (let i=0;i<len;i++){
+                _x = reader.tgReadObject();
+                _other_updates.push(_x);
+                }
+                reader.readInt();
+                _chats = [];
+                len = reader.readInt();
+                for (let i=0;i<len;i++){
+                    _x = reader.tgReadObject();
+                    _chats.push(_x);
+                    }
+                    reader.readInt();
+                    _users = [];
+                    len = reader.readInt();
+                    for (let i=0;i<len;i++){
+                        _x = reader.tgReadObject();
+                        _users.push(_x);
+                        }
+                        return new this({final:_final,
+	pts:_pts,
+	timeout:_timeout,
+	newMessages:_new_messages,
+	otherUpdates:_other_updates,
+	chats:_chats,
+	users:_users})
+                    }
+                }
+
+module.exports = {
+    State,
+    DifferenceEmpty,
+    Difference,
+    DifferenceSlice,
+    DifferenceTooLong,
+    ChannelDifferenceEmpty,
+    ChannelDifferenceTooLong,
+    ChannelDifference,
+};

+ 224 - 0
src/lib/gramjs/tl/types/upload.js

@@ -0,0 +1,224 @@
+/*! File generated by TLObjects' generator. All changes will be ERASED !*/
+const { TLObject } = require('../tlobject');
+const struct = require('python-struct');
+const { readBigIntFromBuffer, 
+        readBufferFromBigInt, generateRandomBytes } = require('../../Helpers')
+
+
+class File extends TLObject {
+    static CONSTRUCTOR_ID = 0x096a18d5;
+    static SUBCLASS_OF_ID = 0x6c9bd728;
+
+    /**
+    Constructor for upload.File: Instance of either File, FileCdnRedirect
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x096a18d5;
+        this.SUBCLASS_OF_ID = 0x6c9bd728;
+
+        this.type = args.type;
+        this.mtime = args.mtime;
+        this.bytes = args.bytes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("d5186a09","hex"),
+            this.type.getBytes(),
+            struct.pack('<i', this.mtime),
+            TLObject.serializeBytes(this.bytes),
+            ])
+        }
+    static fromReader(reader) {
+        let _type;
+        let _mtime;
+        let _bytes;
+        let _x;
+        let len;
+        _type = reader.tgReadObject();
+        _mtime = reader.readInt();
+        _bytes = reader.tgReadBytes();
+        return new this({type:_type,
+	mtime:_mtime,
+	bytes:_bytes})
+    }
+}
+
+
+class FileCdnRedirect extends TLObject {
+    static CONSTRUCTOR_ID = 0xf18cda44;
+    static SUBCLASS_OF_ID = 0x6c9bd728;
+
+    /**
+    Constructor for upload.File: Instance of either File, FileCdnRedirect
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xf18cda44;
+        this.SUBCLASS_OF_ID = 0x6c9bd728;
+
+        this.dcId = args.dcId;
+        this.fileToken = args.fileToken;
+        this.encryptionKey = args.encryptionKey;
+        this.encryptionIv = args.encryptionIv;
+        this.fileHashes = args.fileHashes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("44da8cf1","hex"),
+            struct.pack('<i', this.dcId),
+            TLObject.serializeBytes(this.fileToken),
+            TLObject.serializeBytes(this.encryptionKey),
+            TLObject.serializeBytes(this.encryptionIv),
+            Buffer.from('15c4b51c', 'hex'),struct.pack('<i', this.fileHashes.length),Buffer.concat(this.fileHashes.map(x => x.getBytes())),
+            ])
+        }
+    static fromReader(reader) {
+        let _dc_id;
+        let _file_token;
+        let _encryption_key;
+        let _encryption_iv;
+        let _file_hashes;
+        let _x;
+        let len;
+        _dc_id = reader.readInt();
+        _file_token = reader.tgReadBytes();
+        _encryption_key = reader.tgReadBytes();
+        _encryption_iv = reader.tgReadBytes();
+        reader.readInt();
+        _file_hashes = [];
+        len = reader.readInt();
+        for (let i=0;i<len;i++){
+            _x = reader.tgReadObject();
+            _file_hashes.push(_x);
+            }
+            return new this({dcId:_dc_id,
+	fileToken:_file_token,
+	encryptionKey:_encryption_key,
+	encryptionIv:_encryption_iv,
+	fileHashes:_file_hashes})
+        }
+    }
+
+
+class WebFile extends TLObject {
+    static CONSTRUCTOR_ID = 0x21e753bc;
+    static SUBCLASS_OF_ID = 0x68f17f51;
+
+    /**
+    Constructor for upload.WebFile: Instance of WebFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0x21e753bc;
+        this.SUBCLASS_OF_ID = 0x68f17f51;
+
+        this.size = args.size;
+        this.mimeType = args.mimeType;
+        this.fileType = args.fileType;
+        this.mtime = args.mtime;
+        this.bytes = args.bytes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("bc53e721","hex"),
+            struct.pack('<i', this.size),
+            TLObject.serializeBytes(this.mimeType),
+            this.fileType.getBytes(),
+            struct.pack('<i', this.mtime),
+            TLObject.serializeBytes(this.bytes),
+            ])
+        }
+    static fromReader(reader) {
+        let _size;
+        let _mime_type;
+        let _file_type;
+        let _mtime;
+        let _bytes;
+        let _x;
+        let len;
+        _size = reader.readInt();
+        _mime_type = reader.tgReadString();
+        _file_type = reader.tgReadObject();
+        _mtime = reader.readInt();
+        _bytes = reader.tgReadBytes();
+        return new this({size:_size,
+	mimeType:_mime_type,
+	fileType:_file_type,
+	mtime:_mtime,
+	bytes:_bytes})
+    }
+}
+
+
+class CdnFileReuploadNeeded extends TLObject {
+    static CONSTRUCTOR_ID = 0xeea8e46e;
+    static SUBCLASS_OF_ID = 0xf5ccf928;
+
+    /**
+    Constructor for upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xeea8e46e;
+        this.SUBCLASS_OF_ID = 0xf5ccf928;
+
+        this.requestToken = args.requestToken;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("6ee4a8ee","hex"),
+            TLObject.serializeBytes(this.requestToken),
+            ])
+        }
+    static fromReader(reader) {
+        let _request_token;
+        let _x;
+        let len;
+        _request_token = reader.tgReadBytes();
+        return new this({requestToken:_request_token})
+    }
+}
+
+
+class CdnFile extends TLObject {
+    static CONSTRUCTOR_ID = 0xa99fca4f;
+    static SUBCLASS_OF_ID = 0xf5ccf928;
+
+    /**
+    Constructor for upload.CdnFile: Instance of either CdnFileReuploadNeeded, CdnFile
+    */
+    constructor(args) {
+        super();
+        args = args || {}
+        this.CONSTRUCTOR_ID = 0xa99fca4f;
+        this.SUBCLASS_OF_ID = 0xf5ccf928;
+
+        this.bytes = args.bytes;
+    }
+    getBytes() {
+        return Buffer.concat([
+            Buffer.from("4fca9fa9","hex"),
+            TLObject.serializeBytes(this.bytes),
+            ])
+        }
+    static fromReader(reader) {
+        let _bytes;
+        let _x;
+        let len;
+        _bytes = reader.tgReadBytes();
+        return new this({bytes:_bytes})
+    }
+}
+
+module.exports = {
+    File,
+    FileCdnRedirect,
+    WebFile,
+    CdnFileReuploadNeeded,
+    CdnFile,
+};

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov