How to use the telegram.link.createClient function in telegram

To help you get started, we’ve selected a few telegram examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pmarrapese / tg-logsaver / lib / TelegramClient.js View on Github external
return new Promise((resolve, reject) => {
      let app = {
        id: this.appId,
        hash: this.hash,
        version: this.version,
        langCode: DEFAULT_LANGUAGE_CODE,
        deviceModel: '(n/a)',
        systemVersion: '(n/a)',
        authKey: this.authKey
      };

      this.client = tg.createClient(app, this.dataCenter, (e) => {
        if (e) {
          return reject(e);
        }

        if (this.client.isReady()) {
          // Nothing else to do.
          return resolve();
        }

        // Create MTProto auth key before resolving.
        this.client.createAuthKey((authKey) => {
          this.authKey = authKey;
          resolve();
        });
      });
    });