How to use tdweb - 2 common examples

To help you get started, we’ve selected a few tdweb 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 evgeny-nadymov / telegram-react / src / Controllers / TdLibController.js View on Github external
logVerbosityLevel: verbosity,
                jsLogVerbosityLevel: jsVerbosity,
                mode: mode, // 'wasm-streaming'/'wasm'/'asmjs'
                prefix: useTestDC ? 'tdlib_test' : 'tdlib',
                readOnly: readOnly,
                isBackground: false,
                useDatabase: useDatabase,
                wasmUrl: `${WASM_FILE_NAME}?_sw-precache=${WASM_FILE_HASH}`
                // onUpdate: update => this.emit('update', update)
            };

            console.log(
                `[TdLibController] (fast_updating=${fastUpdating}) Start client with params=${JSON.stringify(options)}`
            );

            this.client = new TdClient(options);
            this.client.onUpdate = update => {
                if (!this.disableLog) {
                    if (update['@type'] === 'updateFile') {
                        console.log('receive updateFile file_id=' + update.file.id, update);
                    } else {
                        console.log('receive update', update);
                    }
                }
                this.emit('update', update);
            };
        });
    };
github airgram / airgram / src / components / TdWebProvider.ts View on Github external
public initialize (
    handleUpdate: (update: Record) => Promise,
    handleError: (error: any) => void,
    models: ag.PlainObjectToModelTransformer
  ): void {
    this.handleUpdate = handleUpdate
    this.handleError = handleError
    this.models = models
    this.client = new TdWebClient({
      ...this.config,
      onUpdate: (update) => this.handleUpdate(this.deserialize(update))
    })
  }

tdweb

JavaScript interface for TDLib (Telegram library)

BSL-1.0
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Popular tdweb functions