Code Monkey home page Code Monkey logo

tglib's Introduction

tglib

TDLib (Telegram Database library) bindings for Node.js

npm


Getting started

  1. Build the binary (https://github.com/tdlib/td#building)
  2. npm i -S tglib

Node / WASM support

tglib support both Node and WASM environments:

// CommonJS, loads Node version tglib
const { Client } = require('tglib')

// ESModule, loads WASM version tglib
import { Client } from 'tglib'

By default, package.json will automatically handle it for you.

If use CommonJS (require() function, usally Node.js), it loads require('tglib/node')

If use ESModule (import syntax, usally bundlers), it loads import ... from 'tglib/wasm'

In case something misimported, you can manually set to the correct version you need:

import { Client } from 'tglib/node'

Options

new Client({
  apiId: '', // specify your API ID
  apiHash: '', // specify your API Hash
  verbosityLevel: 2, // specify TDLib verbosity level to control logging, default 2
  tdlibParameters: {}, // specify custom tdlibParameters object

  // Node only options
  appDir: '', // specify where to place tglib files, default "__tglib__" folder
  binaryPath: '', // specify the TDLib static binary path, default "libtdjson" in cwd

  // WASM only options
  wasmModule: null, // specify the WebAssembly module
  filesDir: '', // specify the files directory path
  databaseDir: '', // specify the database directory path
})

Callbacks / Authorization

You can register callbacks for the following events:

  • td:update, default empty function
  • td:error, default empty function
  • td:getInput, default console prompt in Node, exception in WASM
// register callback for updates
client.registerCallback('td:update', (update) => {
  console.log('[update]', update)
})

// register callback for errors
client.registerCallback('td:error', (error) => {
  console.log('[error]', error)
})

The td:getInput event can be configured to ask for user input.

It also be used for the authorization flow too.

You MUST register an async function or a function that returns a Promise.

To authorize a bot:

// Save tglib default handler which prompt input at console
const defaultHandler = client.callbacks['td:getInput']

// Register own callback for returning auth details
client.registerCallback('td:getInput', async (args) => {
  if (args.string === 'tglib.input.AuthorizationType') {
    return 'bot'
  } else if (args.string === 'tglib.input.AuthorizationValue') {
    return 'YOUR_BOT_TOKEN'
  }
  return await defaultHandler(args)
})

To authorize an user:

// Save tglib default handler which prompt input at console
const defaultHandler = client.callbacks['td:getInput']

// Register own callback for returning auth details
client.registerCallback('td:getInput', async (args) => {
  if (args.string === 'tglib.input.AuthorizationType') {
    return 'user'
  } else if (args.string === 'tglib.input.AuthorizationValue') {
    return 'YOUR_INTERNATIONAL_PHONE_NUMBER'
  }
  return await defaultHandler(args)
})

The string property in td:getInput argument object is used to determine what the input is:

  • tglib.input.AuthorizationType, authorization type: user or bot
  • tglib.input.AuthorizationValue, authorization value: bot token or phone number
  • tglib.input.FirstName, first name for new account creation
  • tglib.input.AuthorizationCode, authorization code received in Telegram or SMS
  • tglib.input.AuthorizationCodeIncorrect, authorization code re-input if wrong
  • tglib.input.AuthorizationPassword, authorization password (two-step verification)
  • tglib.input.AuthorizationPasswordIncorrect, authorization password re-input if wrong

These string can be used as identifier for i18n purpose.

An extras property may present in td:getInput argument object as well in some events.

Currently, a extras property will come up with hint property in the following events:

  • tglib.input.AuthorizationPassword
  • tglib.input.AuthorizationPasswordIncorrect

The hint property here indicates user cloud password hint.

client.registerCallback('td:getInput', async ({ string, extras: { hint } = {} }) => {
  const result = window.prompt(`${string}${hint ? ` ${hint}` : ''}`)
  return result
})

Connect with Telegram

tglib provide a ready Promise in client instances.

This Promise will resolve automatically when the authentication flow finishes.

In order words, when user successfully logged into their account, the Promise will be resolved.

const client = new Client(...)

await client.ready

// You are now connected!
await client.tg.sendTextMessage(...)

APIs

tglib provide some useful methods that makes your Telegram app development easier.

Most API classes/methods can be found in the official TDLib documentation.

Low Level APIs

client._send(query) -> Promise -> Object
Expand

This API is provided by TDLib, you can use this API to send asynchronous message to Telegram.

await client._send({
  '@type': 'sendMessage',
  'chat_id': -123456789,
  'input_message_content': {
    '@type': 'inputMessageText',
    'text': {
      '@type': 'formattedText',
      'text': '👻',
    },
  },
})

client._execute(query) -> Promise -> Object
Expand

This API is provided by TDLib, you can use this API to execute synchronous action to Telegram.

await client._execute({
  '@type': 'getTextEntities',
  'text': '@telegram /test_command https://telegram.org telegram.me',
})

client._destroy() -> Promise -> Void
Expand

This API is provided by TDLib, you can use this API to destroy the client.

await client._destroy()

client.fetch(query) -> Promise -> Object
Expand

This API is provided by tglib, you can use this API to send asynchronous message to Telegram and receive response.

const chats = await client.fetch({
  '@type': 'getChats',
  'offset_order': '9223372036854775807',
  'offset_chat_id': 0,
  'limit': 100,
})

High Level APIs

tglib provides a collection of APIs that designed for ease of use and handiness. These APIs are located under client.tg property.

client.tg.sendTextMessage(args = {}) -> Promise -> Void
Expand

This API is provided by tglib, you can use this API to send message to a chat. The function will combine custom options specified in args with its default.

The TextStruct struct uses "parseTextEntities" method which requires TDLib 1.1.0 or above, see TDLib changelog for details.

const { TextStruct } = require('tglib/structs')

await client.tg.sendTextMessage({
  '$text': new TextStruct('`Hello` world!', 'textParseModeMarkdown'),
  'chat_id': 123456789,
  'disable_notification': true,
  'clear_draft': false,
})

client.tg.sendPhotoMessage(args = {}) -> Promise -> Void
Expand

This API is provided by tglib, you can use this API to send photo to a chat. The function will combine custom options specified in args with its default.

The TextStruct struct uses "parseTextEntities" method which requires TDLib 1.1.0 or above, see TDLib changelog for details.

const { TextStruct } = require('tglib/structs')

await client.tg.sendPhotoMessage({
  '$caption': new TextStruct('Such doge much wow'),
  'chat_id': 123456789,
  'path': '/tmp/doge.jpg',
  'ttl': 5,
})

client.tg.sendStickerMessage(args = {}) -> Promise -> Void
Expand

This API is provided by tglib, you can use this API to send sticker to a chat. The function will combine custom options specified in args with its default.

await client.tg.sendStickerMessage({
  'chat_id': 123456789,
  'path': '/tmp/doge.webp',
})

client.tg.updateUsername(username, supergroupId = null) -> Promise -> Void
Expand

This API is provided by tglib, you can use this API to update the username for session user or a supergroup chat.

This API uses "checkChatUsername" method which requires TDLib 1.2.0 or above, see TDLib changelog for details.

await client.tg.updateUsername('a_new_username')

client.tg.getAllChats() -> Promise -> Array
Expand

This API is provided by tglib, you can use this API to get all available chats of session user.

const chats = await client.tg.getAllChats()

client.tg.openSecretChat(userId) -> Promise -> Object
Expand

This API is provided by tglib, you can use this API to open a secret chat with given user ID.

Note: Secret chats are associated with the corresponding TDLib folder. (i.e. only available on the same device).

const chat = await client.tg.openSecretChat(123456789)

client.tg.deleteChat(chatId) -> Promise -> Void
Expand

This API is provided by tglib, you can use this API to delete a chat and remove it from the chat list. You can use this API to delete "private", "secret", "basicGroup", and "supergroup" chats.

await client.tg.deleteChat(-12345678901234)

client.tg.getChat(args = {}) -> Promise -> Object
Expand

This API is provided by tglib, you can use this API to get a chat by username or chat id. This method requires either username option, or chat_id option.

const chat1 = await client.tg.getChat({ username: 'chat_username' })
const chat2 = await client.tg.getChat({ chat_id: '-12345678901234' })

client.tg.call(userId) -> Promise -> EventEmitter
Expand

This API is provided by tglib, you can use this API to call an user.

The promise will resolve with an EventEmitter when call succceeded.

The EventEmitter will emit ready and discarded events.

const emitter = await client.tg.call(4000000001)
emitter.on('ready', (call) => console.log(call))
emitter.on('discarded', (call) => console.log(call))


Requirements

  • Node.js 10 preferred (minimum >= 9.0.0)

Note: If you are using Node.js 9.x, you may encounter a warning message Warning: N-API is an experimental feature and could change at any time., this can be suppressed by upgrading to version 10.

  • TDLib binary (see build instructions below)

Windows

macOS

Linux - CentOS 7.5

Note: building TDLib binary requires at least 8GB of memory (or more...), otherwise building process will fail. Build in containers are recommended.


License

tglib uses the same license as TDLib. See tdlib/td for more information.

tglib's People

Contributors

dogwong avatar mnb3000 avatar nodegin avatar wseng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tglib's Issues

Segmentation fault on "this.tdlib.td_json_client_receive.async"

I just get the td lib built and trying on the sample
But I got segmentation fault even if I only new Client as below

const client = new Client({
apiId: 'YOUR_API_ID',
apiHash: 'YOUR_API_HASH',
phoneNumber: 'YOUR_PHONE_NUMBER',
})

And I go in the src and add some log to troubleshoot
I found that it is crashed after a few run of _recieve and end up in this.tdlib.td_json_client_receive.async
Is there any clue of how to resolve this issue?

_receive(timeout = 10) {
return new Promise((resolve, reject) => {
if (!this.client) {
return reject(new ClientNotCreatedError)
}
console.log(10)
this.tdlib.td_json_client_receive.async(this.client, timeout, (err, response) => {
console.log(11)
if (err) {
console.log(12)
return reject(err)
}
console.log(13)
if (!response) {
return resolve(null)
}
console.log(14)
resolve(JSON.parse(response))
})
})
}

path to lib

Hi. How to define path to tdlib in windows?

Error: Unable to create client: ENOENT: no such file or directory, open 'my/dir/libtdjson.so

`
const { Client } = require('tglib')
async function main() {
const client = new Client({
apiId: 'YOUR_API_ID',
apiHash: 'YOUR_API_HASH',
phoneNumber: 'YOUR_PHONE_NUMBER',
})

await client.connect()

const result = await client.fetch({
    '@type': 'getChats',
    'offset_order': '9223372036854775807',
    'offset_chat_id': 0,
    'limit': 100,
})

// latest 100 chats will be returned
console.log(result)

}

main()`

How to exit?

Once you're connected, is there any way for the script to decide when to close itself, or is the only option for the user to manually ctrl-C?

Call methods without auth?

Hello!

How can I call API methods without auth? For example, parseTextEntities or getTextEntities.

Thank you.

authorization isn't done for users who aren't signed up before

please add code to client.js => handleAuth => case authorizationStateWaitCode:

      case 'authorizationStateWaitCode': {
        let first_name = ''
        if(!update['authorization_state']['is_registered'])
          first_name = await getInput('input', 'Please enter first_name: ')
        const code = await getInput('input', 'Please enter auth code: ')
        this._send({
          '@type': 'checkAuthenticationCode',
          'code': code,
          'first_name' : first_name
        })
        break
      }

i got it from here

Image compression?

So, here's a strange situation.

In the telegram desktop client, I sent myself the following file as a photo (i.e., compressed):
RAW

When I look at the result in the desktop client, I see it with a small amount of compression added:
COPY
and if I select 'copy', I can paste a version that looks identical to the screenshot.

However, if I use tglib to download all sizes of that file, I only get two: one tiny thumbnail, and one full-sized file that looks like this:
FROMNODE

which is visibly even more compressed than the version shown in the desktop client!

Is it possible that tglib is accidentally performing lossy compression when it writes these images out to disk?
Because if not, does this mean that Telegram's servers don't actually report all the versions of a photo to TDlib clients?

__tglib__ folder location change

Hi,
Is there a way to change the tglib folder location? It seems to be hardcoded in the client constructor to the node workdir:
this.appDir = path.resolve(process.cwd(), '__tglib__', crc32(${type}${value}).toString())

As this folder is storing the auth key and the log, I would like to put it outside the node folder.

Thank you.

viewMessages

how to use method viewMessages?
this way doesn't work:

const result = await client.fetch({
  	'@type': 'viewMessages',
  	'chat_id': 47543915,
  	'message_ids': [8013217792]
})

Make auth possible via separate method

Can you split auth into 2 parts? First part is constructing Client, it requests auth code and the second one is completing sign in via client.completeAuth method which has code as an argument. This will cut the need of getInput, which can be made by a developer of an app if needed

How to send InputPeer

https://core.telegram.org/method/messages.deleteHistory

I try:

await client.fetch({
  '@type': 'deleteHistory',
  peer: -123123123,
  offset: 0,
})

But get:

[ 1][t 0][1521294648.291917086][ClientJson.cpp:78][&status.is_error()]  Failed to parse [request:{\042@type\042:\04
2deleteHistory\042,\042peer\042:-123123123,\042offset\042:0,\042@extra\042:\0421ad27c05-2ea5-428b-879f-4c1b4819
18de\042}] [Error : 0 : Unknown class]

Segmentation fault (core dumped)

When I trying to execute examples/handleUpdates.js, returns:

Got update: {
  "@type": "ok",
  "@extra": null
}
Segmentation fault (core dumped)

I trying in Ubuntu 16.04
node v10.0.0

about compiling td lib

hi I know that it's not a direct problem to this library and I'm sorry about that
when I compile tdlib it dosen't produce a libtdjson.so file which is expected by this library

my questions:

1.what's the problem with my compile? here's a directory list of my directory at the end (sorry its long)

2.how can I change the default options of this library
I am SUPER grateful for any help

directories
.
├── benchmark
│   ├── bench_actor.cpp
│   ├── bench_crypto.cpp
│   ├── bench_db.cpp
│   ├── bench_empty.cpp
│   ├── bench_handshake.cpp
│   ├── bench_http.cpp
│   ├── bench_http_reader.cpp
│   ├── bench_http_server_cheat.cpp
│   ├── bench_http_server.cpp
│   ├── bench_http_server_fast.cpp
│   ├── bench_log.cpp
│   ├── bench_misc.cpp
│   ├── bench_queue.cpp
│   ├── bench_tddb.cpp
│   ├── CMakeLists.txt
│   ├── rmdir.cpp
│   └── wget.cpp
├── bitbucket-pipelines.yml
├── build
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   │   ├── 3.5.1
│   │   │   ├── CMakeCCompiler.cmake
│   │   │   ├── CMakeCXXCompiler.cmake
│   │   │   ├── CMakeDetermineCompilerABI_C.bin
│   │   │   ├── CMakeDetermineCompilerABI_CXX.bin
│   │   │   ├── CMakeSystem.cmake
│   │   │   ├── CompilerIdC
│   │   │   │   ├── a.out
│   │   │   │   └── CMakeCCompilerId.c
│   │   │   └── CompilerIdCXX
│   │   │   ├── a.out
│   │   │   └── CMakeCXXCompilerId.cpp
│   │   ├── cmake.check_cache
│   │   ├── CMakeDirectoryInformation.cmake
│   │   ├── CMakeError.log
│   │   ├── CMakeOutput.log
│   │   ├── CMakeRuleHashes.txt
│   │   ├── CMakeTmp
│   │   ├── feature_tests.bin
│   │   ├── feature_tests.c
│   │   ├── feature_tests.cxx
│   │   ├── Makefile2
│   │   ├── Makefile.cmake
│   │   ├── prepare_cross_compiling.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   └── progress.make
│   │   ├── progress.marks
│   │   └── TargetDirectories.txt
│   ├── cmake_install.cmake
│   ├── compile_commands.json
│   ├── CTestTestfile.cmake
│   ├── Makefile
│   ├── td
│   │   └── generate
│   │   ├── CMakeFiles
│   │   │   ├── CMakeDirectoryInformation.cmake
│   │   │   ├── generate_c.dir
│   │   │   │   ├── build.make
│   │   │   │   ├── cmake_clean.cmake
│   │   │   │   ├── CXX.includecache
│   │   │   │   ├── DependInfo.cmake
│   │   │   │   ├── depend.internal
│   │   │   │   ├── depend.make
│   │   │   │   ├── flags.make
│   │   │   │   ├── generate_c.cpp.o
│   │   │   │   ├── link.txt
│   │   │   │   └── progress.make
│   │   │   ├── generate_common.dir
│   │   │   │   ├── build.make
│   │   │   │   ├── cmake_clean.cmake
│   │   │   │   ├── CXX.includecache
│   │   │   │   ├── DependInfo.cmake
│   │   │   │   ├── depend.internal
│   │   │   │   ├── depend.make
│   │   │   │   ├── flags.make
│   │   │   │   ├── generate_common.cpp.o
│   │   │   │   ├── link.txt
│   │   │   │   ├── progress.make
│   │   │   │   ├── tl_writer_cpp.cpp.o
│   │   │   │   ├── tl_writer_h.cpp.o
│   │   │   │   ├── tl_writer_hpp.cpp.o
│   │   │   │   ├── tl_writer_jni_cpp.cpp.o
│   │   │   │   ├── tl_writer_jni_h.cpp.o
│   │   │   │   └── tl_writer_td.cpp.o
│   │   │   ├── generate_json.dir
│   │   │   │   ├── build.make
│   │   │   │   ├── cmake_clean.cmake
│   │   │   │   ├── CXX.includecache
│   │   │   │   ├── DependInfo.cmake
│   │   │   │   ├── depend.internal
│   │   │   │   ├── depend.make
│   │   │   │   ├── flags.make
│   │   │   │   ├── generate_json.cpp.o
│   │   │   │   ├── link.txt
│   │   │   │   ├── progress.make
│   │   │   │   └── tl_json_converter.cpp.o
│   │   │   ├── progress.marks
│   │   │   ├── remove_documentation.dir
│   │   │   │   ├── build.make
│   │   │   │   ├── cmake_clean.cmake
│   │   │   │   ├── CXX.includecache
│   │   │   │   ├── DependInfo.cmake
│   │   │   │   ├── depend.internal
│   │   │   │   ├── depend.make
│   │   │   │   ├── flags.make
│   │   │   │   ├── link.txt
│   │   │   │   ├── progress.make
│   │   │   │   └── remove_documentation.cpp.o
│   │   │   ├── td_generate_java_api.dir
│   │   │   │   ├── build.make
│   │   │   │   ├── cmake_clean.cmake
│   │   │   │   ├── CXX.includecache
│   │   │   │   ├── DependInfo.cmake
│   │   │   │   ├── depend.internal
│   │   │   │   ├── depend.make
│   │   │   │   ├── flags.make
│   │   │   │   ├── generate_java.cpp.o
│   │   │   │   ├── link.txt
│   │   │   │   ├── progress.make
│   │   │   │   └── tl_writer_java.cpp.o
│   │   │   ├── tl_generate_c.dir
│   │   │   │   ├── build.make
│   │   │   │   ├── cmake_clean.cmake
│   │   │   │   ├── DependInfo.cmake
│   │   │   │   └── progress.make
│   │   │   ├── tl_generate_common.dir
│   │   │   │   ├── build.make
│   │   │   │   ├── cmake_clean.cmake
│   │   │   │   ├── DependInfo.cmake
│   │   │   │   └── progress.make
│   │   │   └── tl_generate_json.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   └── progress.make
│   │   ├── cmake_install.cmake
│   │   ├── CTestTestfile.cmake
│   │   ├── generate_c
│   │   ├── generate_common
│   │   ├── generate_json
│   │   ├── Makefile
│   │   ├── remove_documentation
│   │   └── td_generate_java_api
│   ├── tdtl
│   │   ├── CMakeFiles
│   │   │   ├── CMakeDirectoryInformation.cmake
│   │   │   ├── progress.marks
│   │   │   └── tdtl.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── cmake_clean_target.cmake
│   │   │   ├── CXX.includecache
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.internal
│   │   │   ├── depend.make
│   │   │   ├── flags.make
│   │   │   ├── link.txt
│   │   │   ├── progress.make
│   │   │   └── td
│   │   │   └── tl
│   │   │   ├── tl_config.cpp.o
│   │   │   ├── tl_core.cpp.o
│   │   │   ├── tl_file_outputer.cpp.o
│   │   │   ├── tl_file_utils.cpp.o
│   │   │   ├── tl_generate.cpp.o
│   │   │   ├── tl_outputer.cpp.o
│   │   │   ├── tl_string_outputer.cpp.o
│   │   │   └── tl_writer.cpp.o
│   │   ├── cmake_install.cmake
│   │   ├── CTestTestfile.cmake
│   │   ├── libtdtl.a
│   │   └── Makefile
│   └── tdutils
│   ├── CMakeFiles
│   │   ├── CMakeDirectoryInformation.cmake
│   │   ├── progress.marks
│   │   └── tdutils.dir
│   │   ├── build.make
│   │   ├── cmake_clean.cmake
│   │   ├── cmake_clean_target.cmake
│   │   ├── CXX.includecache
│   │   ├── DependInfo.cmake
│   │   ├── depend.internal
│   │   ├── depend.make
│   │   ├── flags.make
│   │   ├── generate
│   │   │   └── auto
│   │   │   ├── extension_to_mime_type.cpp.o
│   │   │   └── mime_type_to_extension.cpp.o
│   │   ├── link.txt
│   │   ├── progress.make
│   │   └── td
│   │   └── utils
│   │   ├── base64.cpp.o
│   │   ├── BigNum.cpp.o
│   │   ├── buffer.cpp.o
│   │   ├── crypto.cpp.o
│   │   ├── FileLog.cpp.o
│   │   ├── filesystem.cpp.o
│   │   ├── find_boundary.cpp.o
│   │   ├── GzipByteFlow.cpp.o
│   │   ├── Gzip.cpp.o
│   │   ├── Hints.cpp.o
│   │   ├── HttpUrl.cpp.o
│   │   ├── JsonBuilder.cpp.o
│   │   ├── logging.cpp.o
│   │   ├── MimeType.cpp.o
│   │   ├── misc.cpp.o
│   │   ├── port
│   │   │   ├── Clocks.cpp.o
│   │   │   ├── detail
│   │   │   │   ├── Epoll.cpp.o
│   │   │   │   ├── EventFdBsd.cpp.o
│   │   │   │   ├── EventFdLinux.cpp.o
│   │   │   │   ├── EventFdWindows.cpp.o
│   │   │   │   ├── KQueue.cpp.o
│   │   │   │   ├── Poll.cpp.o
│   │   │   │   ├── Select.cpp.o
│   │   │   │   ├── ThreadIdGuard.cpp.o
│   │   │   │   └── WineventPoll.cpp.o
│   │   │   ├── Fd.cpp.o
│   │   │   ├── FileFd.cpp.o
│   │   │   ├── IPAddress.cpp.o
│   │   │   ├── path.cpp.o
│   │   │   ├── ServerSocketFd.cpp.o
│   │   │   ├── signals.cpp.o
│   │   │   ├── sleep.cpp.o
│   │   │   ├── SocketFd.cpp.o
│   │   │   ├── Stat.cpp.o
│   │   │   ├── thread_local.cpp.o
│   │   │   └── wstring_convert.cpp.o
│   │   ├── Random.cpp.o
│   │   ├── StackAllocator.cpp.o
│   │   ├── Status.cpp.o
│   │   ├── StringBuilder.cpp.o
│   │   ├── Time.cpp.o
│   │   ├── Timer.cpp.o
│   │   ├── tl_parsers.cpp.o
│   │   ├── translit.cpp.o
│   │   ├── unicode.cpp.o
│   │   └── utf8.cpp.o
│   ├── cmake_install.cmake
│   ├── CTestTestfile.cmake
│   ├── generate
│   │   ├── CMakeFiles
│   │   │   ├── CMakeDirectoryInformation.cmake
│   │   │   ├── generate_mime_types_gperf.dir
│   │   │   │   ├── build.make
│   │   │   │   ├── cmake_clean.cmake
│   │   │   │   ├── CXX.includecache
│   │   │   │   ├── DependInfo.cmake
│   │   │   │   ├── depend.internal
│   │   │   │   ├── depend.make
│   │   │   │   ├── flags.make
│   │   │   │   ├── generate_mime_types_gperf.cpp.o
│   │   │   │   ├── link.txt
│   │   │   │   └── progress.make
│   │   │   ├── progress.marks
│   │   │   └── tdmime_auto.dir
│   │   │   ├── build.make
│   │   │   ├── cmake_clean.cmake
│   │   │   ├── DependInfo.cmake
│   │   │   ├── depend.internal
│   │   │   ├── depend.make
│   │   │   └── progress.make
│   │   ├── cmake_install.cmake
│   │   ├── CTestTestfile.cmake
│   │   ├── generate_mime_types_gperf
│   │   └── Makefile
│   ├── libtdutils.a
│   ├── Makefile
│   └── td
│   └── utils
│   └── config.h
├── CHANGELOG.md
├── CMake
│   ├── AddCXXCompilerFlag.cmake
│   ├── FindReadline.cmake
│   └── iOS.cmake
├── CMakeLists.txt
├── Doxyfile
├── example
│   ├── cpp
│   │   ├── CMakeLists.txt
│   │   ├── README.md
│   │   ├── td_example.cpp
│   │   └── tdjson_example.cpp
│   ├── csharp
│   │   ├── README.md
│   │   ├── TdExample.cs
│   │   ├── TdExample.csproj
│   │   └── TdExample.sln
│   ├── go
│   │   └── main.go
│   ├── ios
│   │   ├── build-openssl.sh
│   │   ├── build.sh
│   │   └── README.md
│   ├── java
│   │   ├── CMakeLists.txt
│   │   ├── org
│   │   │   └── drinkless
│   │   │   └── tdlib
│   │   │   ├── Client.java
│   │   │   ├── example
│   │   │   │   └── Example.java
│   │   │   └── Log.java
│   │   ├── README.md
│   │   └── td_jni.cpp
│   ├── javascript
│   │   ├── example.js
│   │   ├── package.json
│   │   └── README.md
│   ├── python
│   │   ├── README.md
│   │   └── tdjson_example.py
│   ├── README.md
│   ├── ruby
│   │   ├── example.rb
│   │   ├── Gemfile
│   │   └── Gemfile.lock
│   ├── swift
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── main.swift
│   │   │   └── td-Bridging-Header.h
│   │   └── td.xcodeproj
│   │   └── project.pbxproj
│   └── uwp
│   ├── app
│   │   ├── ApplicationInsights.config
│   │   ├── App.xaml
│   │   ├── App.xaml.cs
│   │   ├── Assets
│   │   │   ├── LockScreenLogo.scale-200.png
│   │   │   ├── SplashScreen.scale-200.png
│   │   │   ├── Square150x150Logo.scale-200.png
│   │   │   ├── Square44x44Logo.scale-200.png
│   │   │   ├── Square44x44Logo.targetsize-24_altform-unplated.png
│   │   │   ├── StoreLogo.png
│   │   │   └── Wide310x150Logo.scale-200.png
│   │   ├── MainPage.xaml
│   │   ├── MainPage.xaml.cs
│   │   ├── Package.appxmanifest
│   │   ├── project.json
│   │   ├── Properties
│   │   │   ├── AssemblyInfo.cs
│   │   │   └── Default.rd.xml
│   │   ├── TdApp.csproj
│   │   ├── TdApp.sln
│   │   └── TdApp_TemporaryKey.pfx
│   ├── build.ps1
│   ├── [Content_Types].xml
│   ├── extension.vsixmanifest
│   ├── LICENSE_1_0.txt
│   ├── README.md
│   └── SDKManifest.xml
├── format.ps1
├── format.sh
├── gen_git_commit_h.ps1
├── gen_git_commit_h.sh
├── LICENSE_1_0.txt
├── memprof
│   ├── memprof.cpp
│   └── memprof.h
├── README.md
├── sqlite
│   ├── CMakeLists.txt
│   └── sqlite
│   ├── LICENSE
│   ├── sqlite3.c
│   ├── sqlite3ext.h
│   ├── sqlite3.h
│   └── sqlite3session.h
├── src.ps1
├── src.sh
├── td
│   ├── generate
│   │   ├── auto
│   │   │   └── td
│   │   │   ├── mtproto
│   │   │   └── telegram
│   │   ├── CMakeLists.txt
│   │   ├── DotnetTlDocumentationGenerator.php
│   │   ├── DoxygenTlDocumentationGenerator.php
│   │   ├── generate_c.cpp
│   │   ├── generate_common.cpp
│   │   ├── generate_dotnet.cpp
│   │   ├── generate_java.cpp
│   │   ├── generate_json.cpp
│   │   ├── JavadocTlDocumentationGenerator.php
│   │   ├── remove_documentation.cpp
│   │   ├── scheme
│   │   │   ├── mtproto_api.tl
│   │   │   ├── mtproto_api.tlo
│   │   │   ├── secret_api.tl
│   │   │   ├── secret_api.tlo
│   │   │   ├── td_api.tl
│   │   │   ├── td_api.tlo
│   │   │   ├── telegram_api.tl
│   │   │   ├── telegram_api.tlo
│   │   │   └── update-tlo.sh
│   │   ├── TlDocumentationGenerator.php
│   │   ├── tl_json_converter.cpp
│   │   ├── tl_json_converter.h
│   │   ├── tl_writer_c.h
│   │   ├── tl_writer_cpp.cpp
│   │   ├── tl_writer_cpp.h
│   │   ├── tl_writer_dotnet.h
│   │   ├── tl_writer_h.cpp
│   │   ├── tl_writer_h.h
│   │   ├── tl_writer_hpp.cpp
│   │   ├── tl_writer_hpp.h
│   │   ├── tl_writer_java.cpp
│   │   ├── tl_writer_java.h
│   │   ├── tl_writer_jni_cpp.cpp
│   │   ├── tl_writer_jni_cpp.h
│   │   ├── tl_writer_jni_h.cpp
│   │   ├── tl_writer_jni_h.h
│   │   ├── tl_writer_td.cpp
│   │   └── tl_writer_td.h
│   ├── mtproto
│   │   ├── AuthData.cpp
│   │   ├── AuthData.h
│   │   ├── AuthKey.h
│   │   ├── crypto.cpp
│   │   ├── crypto.h
│   │   ├── CryptoStorer.h
│   │   ├── HandshakeActor.cpp
│   │   ├── HandshakeActor.h
│   │   ├── HandshakeConnection.h
│   │   ├── Handshake.cpp
│   │   ├── Handshake.h
│   │   ├── HttpTransport.cpp
│   │   ├── HttpTransport.h
│   │   ├── IStreamTransport.cpp
│   │   ├── IStreamTransport.h
│   │   ├── NoCryptoStorer.h
│   │   ├── PacketStorer.h
│   │   ├── PingConnection.h
│   │   ├── RawConnection.cpp
│   │   ├── RawConnection.h
│   │   ├── SessionConnection.cpp
│   │   ├── SessionConnection.h
│   │   ├── TcpTransport.cpp
│   │   ├── TcpTransport.h
│   │   ├── Transport.cpp
│   │   ├── Transport.h
│   │   ├── utils.cpp
│   │   └── utils.h
│   ├── telegram
│   │   ├── AccessRights.h
│   │   ├── AnimationsManager.cpp
│   │   ├── AnimationsManager.h
│   │   ├── AnimationsManager.hpp
│   │   ├── AudiosManager.cpp
│   │   ├── AudiosManager.h
│   │   ├── AudiosManager.hpp
│   │   ├── AuthManager.cpp
│   │   ├── AuthManager.h
│   │   ├── AuthManager.hpp
│   │   ├── CallActor.cpp
│   │   ├── CallActor.h
│   │   ├── CallbackQueriesManager.cpp
│   │   ├── CallbackQueriesManager.h
│   │   ├── CallDiscardReason.cpp
│   │   ├── CallDiscardReason.h
│   │   ├── CallId.h
│   │   ├── CallManager.cpp
│   │   ├── CallManager.h
│   │   ├── ChannelId.h
│   │   ├── ChatId.h
│   │   ├── cli.cpp
│   │   ├── ClientActor.cpp
│   │   ├── ClientActor.h
│   │   ├── Client.cpp
│   │   ├── ClientDotNet.cpp
│   │   ├── Client.h
│   │   ├── ClientJson.cpp
│   │   ├── ClientJson.h
│   │   ├── ConfigManager.cpp
│   │   ├── ConfigManager.h
│   │   ├── ConfigShared.cpp
│   │   ├── ConfigShared.h
│   │   ├── Contact.cpp
│   │   ├── Contact.h
│   │   ├── ContactsManager.cpp
│   │   ├── ContactsManager.h
│   │   ├── DelayDispatcher.cpp
│   │   ├── DelayDispatcher.h
│   │   ├── DeviceTokenManager.cpp
│   │   ├── DeviceTokenManager.h
│   │   ├── DhCache.cpp
│   │   ├── DhCache.h
│   │   ├── DhConfig.h
│   │   ├── DialogDb.cpp
│   │   ├── DialogDb.h
│   │   ├── DialogId.cpp
│   │   ├── DialogId.h
│   │   ├── DialogParticipant.cpp
│   │   ├── DialogParticipant.h
│   │   ├── DocumentsManager.cpp
│   │   ├── DocumentsManager.h
│   │   ├── DocumentsManager.hpp
│   │   ├── files
│   │   │   ├── FileDb.cpp
│   │   │   ├── FileDb.h
│   │   │   ├── FileDownloader.cpp
│   │   │   ├── FileDownloader.h
│   │   │   ├── FileFromBytes.cpp
│   │   │   ├── FileFromBytes.h
│   │   │   ├── FileGcParameters.cpp
│   │   │   ├── FileGcParameters.h
│   │   │   ├── FileGcWorker.cpp
│   │   │   ├── FileGcWorker.h
│   │   │   ├── FileGenerateManager.cpp
│   │   │   ├── FileGenerateManager.h
│   │   │   ├── FileHashUploader.cpp
│   │   │   ├── FileHashUploader.h
│   │   │   ├── FileId.h
│   │   │   ├── FileId.hpp
│   │   │   ├── FileLoaderActor.h
│   │   │   ├── FileLoader.cpp
│   │   │   ├── FileLoader.h
│   │   │   ├── FileLoaderUtils.cpp
│   │   │   ├── FileLoaderUtils.h
│   │   │   ├── FileLoadManager.cpp
│   │   │   ├── FileLoadManager.h
│   │   │   ├── FileLocation.h
│   │   │   ├── FileManager.cpp
│   │   │   ├── FileManager.h
│   │   │   ├── FileManager.hpp
│   │   │   ├── FileStats.cpp
│   │   │   ├── FileStats.h
│   │   │   ├── FileStatsWorker.cpp
│   │   │   ├── FileStatsWorker.h
│   │   │   ├── FileUploader.cpp
│   │   │   ├── FileUploader.h
│   │   │   ├── PartsManager.cpp
│   │   │   ├── PartsManager.h
│   │   │   ├── ResourceManager.cpp
│   │   │   ├── ResourceManager.h
│   │   │   └── ResourceState.h
│   │   ├── Game.cpp
│   │   ├── Game.h
│   │   ├── Game.hpp
│   │   ├── Global.cpp
│   │   ├── Global.h
│   │   ├── HashtagHints.cpp
│   │   ├── HashtagHints.h
│   │   ├── InlineQueriesManager.cpp
│   │   ├── InlineQueriesManager.h
│   │   ├── LanguagePackManager.cpp
│   │   ├── LanguagePackManager.h
│   │   ├── Location.cpp
│   │   ├── Location.h
│   │   ├── Log.cpp
│   │   ├── LogDotNet.cpp
│   │   ├── logevent
│   │   │   ├── LogEvent.h
│   │   │   ├── LogEventHelper.h
│   │   │   └── SecretChatEvent.h
│   │   ├── Log.h
│   │   ├── MessageEntity.cpp
│   │   ├── MessageEntity.h
│   │   ├── MessageEntity.hpp
│   │   ├── MessageId.h
│   │   ├── MessagesDb.cpp
│   │   ├── MessagesDb.h
│   │   ├── MessagesManager.cpp
│   │   ├── MessagesManager.h
│   │   ├── misc.cpp
│   │   ├── misc.h
│   │   ├── net
│   │   │   ├── AuthDataShared.cpp
│   │   │   ├── AuthDataShared.h
│   │   │   ├── ConnectionCreator.cpp
│   │   │   ├── ConnectionCreator.h
│   │   │   ├── DcAuthManager.cpp
│   │   │   ├── DcAuthManager.h
│   │   │   ├── DcId.h
│   │   │   ├── DcOptions.h
│   │   │   ├── DcOptionsSet.cpp
│   │   │   ├── DcOptionsSet.h
│   │   │   ├── MtprotoHeader.cpp
│   │   │   ├── MtprotoHeader.h
│   │   │   ├── NetActor.cpp
│   │   │   ├── NetActor.h
│   │   │   ├── NetQueryCounter.cpp
│   │   │   ├── NetQueryCounter.h
│   │   │   ├── NetQuery.cpp
│   │   │   ├── NetQueryCreator.cpp
│   │   │   ├── NetQueryCreator.h
│   │   │   ├── NetQueryDelayer.cpp
│   │   │   ├── NetQueryDelayer.h
│   │   │   ├── NetQueryDispatcher.cpp
│   │   │   ├── NetQueryDispatcher.h
│   │   │   ├── NetQuery.h
│   │   │   ├── NetStatsManager.cpp
│   │   │   ├── NetStatsManager.h
│   │   │   ├── NetType.h
│   │   │   ├── PublicRsaKeyShared.cpp
│   │   │   ├── PublicRsaKeyShared.h
│   │   │   ├── PublicRsaKeyWatchdog.cpp
│   │   │   ├── PublicRsaKeyWatchdog.h
│   │   │   ├── Session.cpp
│   │   │   ├── Session.h
│   │   │   ├── SessionMultiProxy.cpp
│   │   │   ├── SessionMultiProxy.h
│   │   │   ├── SessionProxy.cpp
│   │   │   ├── SessionProxy.h
│   │   │   └── TempAuthKeyWatchdog.h
│   │   ├── PasswordManager.cpp
│   │   ├── PasswordManager.h
│   │   ├── Payments.cpp
│   │   ├── Payments.h
│   │   ├── Payments.hpp
│   │   ├── Photo.cpp
│   │   ├── Photo.h
│   │   ├── Photo.hpp
│   │   ├── PrivacyManager.cpp
│   │   ├── PrivacyManager.h
│   │   ├── PtsManager.h
│   │   ├── ReplyMarkup.cpp
│   │   ├── ReplyMarkup.h
│   │   ├── ReplyMarkup.hpp
│   │   ├── SecretChatActor.cpp
│   │   ├── SecretChatActor.h
│   │   ├── SecretChatDb.cpp
│   │   ├── SecretChatDb.h
│   │   ├── SecretChatId.h
│   │   ├── SecretChatsManager.cpp
│   │   ├── SecretChatsManager.h
│   │   ├── SecretInputMedia.h
│   │   ├── SecureManager.cpp
│   │   ├── SecureManager.h
│   │   ├── SecureStorage.cpp
│   │   ├── SecureStorage.h
│   │   ├── SecureValue.cpp
│   │   ├── SecureValue.h
│   │   ├── SecureValue.hpp
│   │   ├── SequenceDispatcher.cpp
│   │   ├── SequenceDispatcher.h
│   │   ├── StateManager.cpp
│   │   ├── StateManager.h
│   │   ├── StickersManager.cpp
│   │   ├── StickersManager.h
│   │   ├── StickersManager.hpp
│   │   ├── StorageManager.cpp
│   │   ├── StorageManager.h
│   │   ├── TdCallback.h
│   │   ├── td_c_client.cpp
│   │   ├── td_c_client.h
│   │   ├── Td.cpp
│   │   ├── TdDb.cpp
│   │   ├── TdDb.h
│   │   ├── td_emscripten.cpp
│   │   ├── Td.h
│   │   ├── td_json_client.cpp
│   │   ├── td_json_client.h
│   │   ├── td_log.cpp
│   │   ├── td_log.h
│   │   ├── TdParameters.h
│   │   ├── TermsOfService.cpp
│   │   ├── TermsOfService.h
│   │   ├── TopDialogManager.cpp
│   │   ├── TopDialogManager.h
│   │   ├── UniqueId.h
│   │   ├── UpdatesManager.cpp
│   │   ├── UpdatesManager.h
│   │   ├── UserId.h
│   │   ├── Version.h
│   │   ├── VideoNotesManager.cpp
│   │   ├── VideoNotesManager.h
│   │   ├── VideoNotesManager.hpp
│   │   ├── VideosManager.cpp
│   │   ├── VideosManager.h
│   │   ├── VideosManager.hpp
│   │   ├── VoiceNotesManager.cpp
│   │   ├── VoiceNotesManager.h
│   │   ├── VoiceNotesManager.hpp
│   │   ├── WebPageId.h
│   │   ├── WebPagesManager.cpp
│   │   └── WebPagesManager.h
│   └── tl
│   ├── tl_dotnet_object.h
│   ├── tl_jni_object.cpp
│   ├── tl_jni_object.h
│   ├── tl_json.h
│   ├── TlObject.h
│   ├── tl_object_parse.h
│   └── tl_object_store.h
├── tdactor
│   ├── CMakeLists.txt
│   ├── example
│   │   └── example.cpp
│   ├── td
│   │   └── actor
│   │   ├── actor.h
│   │   ├── Condition.h
│   │   ├── impl
│   │   │   ├── Actor-decl.h
│   │   │   ├── Actor.h
│   │   │   ├── ActorId-decl.h
│   │   │   ├── ActorId.h
│   │   │   ├── ActorInfo-decl.h
│   │   │   ├── ActorInfo.h
│   │   │   ├── ConcurrentScheduler.cpp
│   │   │   ├── ConcurrentScheduler.h
│   │   │   ├── EventFull-decl.h
│   │   │   ├── EventFull.h
│   │   │   ├── Event.h
│   │   │   ├── Scheduler.cpp
│   │   │   ├── Scheduler-decl.h
│   │   │   └── Scheduler.h
│   │   ├── MultiPromise.cpp
│   │   ├── MultiPromise.h
│   │   ├── PromiseFuture.h
│   │   ├── SchedulerLocalStorage.h
│   │   ├── SignalSlot.h
│   │   ├── SleepActor.h
│   │   ├── Timeout.cpp
│   │   └── Timeout.h
│   └── test
│   ├── actors_bugs.cpp
│   ├── actors_main.cpp
│   ├── actors_simple.cpp
│   └── actors_workers.cpp
├── tdclientjson_export_list
├── TdConfig.cmake
├── tddb
│   ├── CMakeLists.txt
│   └── td
│   └── db
│   ├── binlog
│   │   ├── Binlog.cpp
│   │   ├── binlog_dump.cpp
│   │   ├── BinlogEvent.cpp
│   │   ├── BinlogEvent.h
│   │   ├── Binlog.h
│   │   ├── BinlogHelper.h
│   │   ├── BinlogInterface.h
│   │   ├── ConcurrentBinlog.cpp
│   │   ├── ConcurrentBinlog.h
│   │   └── detail
│   │   ├── BinlogEventsBuffer.cpp
│   │   ├── BinlogEventsBuffer.h
│   │   ├── BinlogEventsProcessor.cpp
│   │   └── BinlogEventsProcessor.h
│   ├── BinlogKeyValue.h
│   ├── DbKey.h
│   ├── detail
│   │   ├── RawSqliteDb.cpp
│   │   └── RawSqliteDb.h
│   ├── KeyValueSyncInterface.h
│   ├── Pmc.h
│   ├── SeqKeyValue.h
│   ├── SqliteConnectionSafe.h
│   ├── SqliteDb.cpp
│   ├── SqliteDb.h
│   ├── SqliteKeyValueAsync.cpp
│   ├── SqliteKeyValueAsync.h
│   ├── SqliteKeyValue.cpp
│   ├── SqliteKeyValue.h
│   ├── SqliteKeyValueSafe.h
│   ├── SqliteStatement.cpp
│   ├── SqliteStatement.h
│   └── TsSeqKeyValue.h
├── tdnet
│   ├── CMakeLists.txt
│   └── td
│   └── net
│   ├── GetHostByNameActor.cpp
│   ├── GetHostByNameActor.h
│   ├── HttpChunkedByteFlow.cpp
│   ├── HttpChunkedByteFlow.h
│   ├── HttpConnectionBase.cpp
│   ├── HttpConnectionBase.h
│   ├── HttpContentLengthByteFlow.cpp
│   ├── HttpContentLengthByteFlow.h
│   ├── HttpFile.cpp
│   ├── HttpFile.h
│   ├── HttpHeaderCreator.h
│   ├── HttpInboundConnection.cpp
│   ├── HttpInboundConnection.h
│   ├── HttpOutboundConnection.cpp
│   ├── HttpOutboundConnection.h
│   ├── HttpProxy.cpp
│   ├── HttpProxy.h
│   ├── HttpQuery.cpp
│   ├── HttpQuery.h
│   ├── HttpReader.cpp
│   ├── HttpReader.h
│   ├── NetStats.h
│   ├── Socks5.cpp
│   ├── Socks5.h
│   ├── SslStream.cpp
│   ├── SslStream.h
│   ├── TcpListener.cpp
│   ├── TcpListener.h
│   ├── TransparentProxy.cpp
│   ├── TransparentProxy.h
│   ├── Wget.cpp
│   └── Wget.h
├── tdtl
│   ├── CMakeLists.txt
│   └── td
│   └── tl
│   ├── tl_config.cpp
│   ├── tl_config.h
│   ├── tl_core.cpp
│   ├── tl_core.h
│   ├── tl_file_outputer.cpp
│   ├── tl_file_outputer.h
│   ├── tl_file_utils.cpp
│   ├── tl_file_utils.h
│   ├── tl_generate.cpp
│   ├── tl_generate.h
│   ├── tl_outputer.cpp
│   ├── tl_outputer.h
│   ├── tl_simple.h
│   ├── tl_simple_parser.h
│   ├── tl_string_outputer.cpp
│   ├── tl_string_outputer.h
│   ├── tl_writer.cpp
│   └── tl_writer.h
├── tdutils
│   ├── CMakeLists.txt
│   ├── generate
│   │   ├── auto
│   │   │   ├── extension_to_mime_type.cpp
│   │   │   ├── extension_to_mime_type.gperf
│   │   │   ├── mime_type_to_extension.cpp
│   │   │   └── mime_type_to_extension.gperf
│   │   ├── CMakeLists.txt
│   │   ├── generate_mime_types_gperf.cpp
│   │   └── mime_types.txt
│   ├── td
│   │   └── utils
│   │   ├── AesCtrByteFlow.h
│   │   ├── base64.cpp
│   │   ├── base64.h
│   │   ├── benchmark.h
│   │   ├── BigNum.cpp
│   │   ├── BigNum.h
│   │   ├── buffer.cpp
│   │   ├── BufferedFd.h
│   │   ├── BufferedReader.h
│   │   ├── buffer.h
│   │   ├── ByteFlow.h
│   │   ├── ChangesProcessor.h
│   │   ├── Closure.h
│   │   ├── common.h
│   │   ├── config.h.in
│   │   ├── Container.h
│   │   ├── crypto.cpp
│   │   ├── crypto.h
│   │   ├── Enumerator.h
│   │   ├── FileLog.cpp
│   │   ├── FileLog.h
│   │   ├── filesystem.cpp
│   │   ├── filesystem.h
│   │   ├── find_boundary.cpp
│   │   ├── find_boundary.h
│   │   ├── FloodControlFast.h
│   │   ├── FloodControlStrict.h
│   │   ├── format.h
│   │   ├── GitInfo.cpp
│   │   ├── GitInfo.h
│   │   ├── GzipByteFlow.cpp
│   │   ├── GzipByteFlow.h
│   │   ├── Gzip.cpp
│   │   ├── Gzip.h
│   │   ├── HazardPointers.h
│   │   ├── Heap.h
│   │   ├── Hints.cpp
│   │   ├── Hints.h
│   │   ├── HttpUrl.cpp
│   │   ├── HttpUrl.h
│   │   ├── int_types.h
│   │   ├── invoke.h
│   │   ├── JsonBuilder.cpp
│   │   ├── JsonBuilder.h
│   │   ├── List.h
│   │   ├── logging.cpp
│   │   ├── logging.h
│   │   ├── MemoryLog.h
│   │   ├── MimeType.cpp
│   │   ├── MimeType.h
│   │   ├── misc.cpp
│   │   ├── misc.h
│   │   ├── MovableValue.h
│   │   ├── MpmcQueue.h
│   │   ├── MpmcWaiter.h
│   │   ├── MpscLinkQueue.h
│   │   ├── MpscPollableQueue.h
│   │   ├── Named.h
│   │   ├── ObjectPool.h
│   │   ├── Observer.h
│   │   ├── optional.h
│   │   ├── OptionsParser.h
│   │   ├── OrderedEventsProcessor.h
│   │   ├── overloaded.h
│   │   ├── Parser.h
│   │   ├── PathView.h
│   │   ├── port
│   │   │   ├── Clocks.cpp
│   │   │   ├── Clocks.h
│   │   │   ├── config.h
│   │   │   ├── CxCli.h
│   │   │   ├── detail
│   │   │   │   ├── Epoll.cpp
│   │   │   │   ├── Epoll.h
│   │   │   │   ├── EventFdBsd.cpp
│   │   │   │   ├── EventFdBsd.h
│   │   │   │   ├── EventFdLinux.cpp
│   │   │   │   ├── EventFdLinux.h
│   │   │   │   ├── EventFdWindows.cpp
│   │   │   │   ├── EventFdWindows.h
│   │   │   │   ├── KQueue.cpp
│   │   │   │   ├── KQueue.h
│   │   │   │   ├── Poll.cpp
│   │   │   │   ├── Poll.h
│   │   │   │   ├── Select.cpp
│   │   │   │   ├── Select.h
│   │   │   │   ├── ThreadIdGuard.cpp
│   │   │   │   ├── ThreadIdGuard.h
│   │   │   │   ├── ThreadPthread.h
│   │   │   │   ├── ThreadStl.h
│   │   │   │   ├── WineventPoll.cpp
│   │   │   │   └── WineventPoll.h
│   │   │   ├── EventFdBase.h
│   │   │   ├── EventFd.h
│   │   │   ├── Fd.cpp
│   │   │   ├── Fd.h
│   │   │   ├── FileFd.cpp
│   │   │   ├── FileFd.h
│   │   │   ├── IPAddress.cpp
│   │   │   ├── IPAddress.h
│   │   │   ├── path.cpp
│   │   │   ├── path.h
│   │   │   ├── platform.h
│   │   │   ├── PollBase.h
│   │   │   ├── Poll.h
│   │   │   ├── RwMutex.h
│   │   │   ├── ServerSocketFd.cpp
│   │   │   ├── ServerSocketFd.h
│   │   │   ├── signals.cpp
│   │   │   ├── signals.h
│   │   │   ├── sleep.cpp
│   │   │   ├── sleep.h
│   │   │   ├── SocketFd.cpp
│   │   │   ├── SocketFd.h
│   │   │   ├── Stat.cpp
│   │   │   ├── Stat.h
│   │   │   ├── thread.h
│   │   │   ├── thread_local.cpp
│   │   │   ├── thread_local.h
│   │   │   ├── wstring_convert.cpp
│   │   │   └── wstring_convert.h
│   │   ├── queue.h
│   │   ├── Random.cpp
│   │   ├── Random.h
│   │   ├── ScopeGuard.h
│   │   ├── SharedObjectPool.h
│   │   ├── Slice-decl.h
│   │   ├── Slice.h
│   │   ├── SpinLock.h
│   │   ├── StackAllocator.cpp
│   │   ├── StackAllocator.h
│   │   ├── Status.cpp
│   │   ├── Status.h
│   │   ├── StorerBase.h
│   │   ├── Storer.h
│   │   ├── StringBuilder.cpp
│   │   ├── StringBuilder.h
│   │   ├── tests.h
│   │   ├── Time.cpp
│   │   ├── TimedStat.h
│   │   ├── Time.h
│   │   ├── Timer.cpp
│   │   ├── Timer.h
│   │   ├── tl_helpers.h
│   │   ├── tl_parsers.cpp
│   │   ├── tl_parsers.h
│   │   ├── tl_storers.h
│   │   ├── translit.cpp
│   │   ├── translit.h
│   │   ├── type_traits.h
│   │   ├── unicode.cpp
│   │   ├── unicode.h
│   │   ├── utf8.cpp
│   │   ├── utf8.h
│   │   └── Variant.h
│   └── test
│   ├── crypto.cpp
│   ├── Enumerator.cpp
│   ├── filesystem.cpp
│   ├── gzip.cpp
│   ├── HazardPointers.cpp
│   ├── heap.cpp
│   ├── json.cpp
│   ├── misc.cpp
│   ├── MpmcQueue.cpp
│   ├── MpmcWaiter.cpp
│   ├── MpscLinkQueue.cpp
│   ├── OrderedEventsProcessor.cpp
│   ├── pq.cpp
│   ├── SharedObjectPool.cpp
│   └── variant.cpp
└── test
├── CMakeLists.txt
├── data.cpp
├── data.h
├── db.cpp
├── fuzz_url.cpp
├── http.cpp
├── main.cpp
├── message_entities.cpp
├── mtproto.cpp
├── secret.cpp
├── secure_storage.cpp
├── string_cleaning.cpp
├── tdclient.cpp
├── tests_runner.cpp
├── TestsRunner.cpp
├── tests_runner.h
└── TestsRunner.h

Call methods without auth?

Hello!

How can I call API methods without auth? For example, parseTextEntities or getTextEntities.

Thank you.

regeneratorRuntime is not defined

version 0.0.6 with handleUpdates.js example

➜  node index.js
/Users/beautyfree/projects/side/hobby/telegram/node_modules/tglib/lib/Client.js:70
      var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
                                                 ^

ReferenceError: regeneratorRuntime is not defined
    at /Users/beautyfree/projects/side/hobby/telegram/node_modules/tglib/lib/Client.js:70:50
    at /Users/beautyfree/projects/side/hobby/telegram/node_modules/tglib/lib/Client.js:107:6
    at Object.<anonymous> (/Users/beautyfree/projects/side/hobby/telegram/node_modules/tglib/lib/Client.js:506:2)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)

Multiply Login

Hi! How can I log in to another account using the same configuration?

Local Database

Hi
Does maintaining a local database of messages is supported in tglib?

//@use_chat_info_database If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies use_file_database
--
//@use_message_database If set to true, the library will maintain a cache of chats and messages. Implies use_chat_info_database

TDLib

"Error: Client is not created" after client._destroy()

Every time I use client._destroy(), I have the following exception thrown:
(node:20) UnhandledPromiseRejectionWarning: Error: Client is not created at Promise (<path>/node_modules/tglib/Client.js:314:23) at new Promise (<anonymous>) at Client._receive (<path>/node_modules/tglib/Client.js:312:12) at Client.loop (<path>/node_modules/tglib/Client.js:112:31) at Client.loop (<path>/node_modules/tglib/Client.js:128:10)
I seems that while the TDLIB client is deleted, the loop function is still running and tries to fetch updates.
How to avoid this issue? Can the loop be stopped?

SIGSEGV, Segmentation fault

Very good idea to bring tdlibs in nodejs realm.

running an example with phone +app_id+app_hash

i used tdlibs ins the same directory ...
i get

`
[New Thread 0x7ffff5333700 (LWP 62410)]
[New Thread 0x7ffff7ff6700 (LWP 62411)]
[New Thread 0x7fffe7fff700 (LWP 62412)]
[New Thread 0x7fffe77fe700 (LWP 62413)]
[New Thread 0x7fffe6ffd700 (LWP 62414)]
[New Thread 0x7fffe67fc700 (LWP 62415)]
[New Thread 0x7fffe4c55700 (LWP 62416)]
[New Thread 0x7fffdbfff700 (LWP 62417)]
[New Thread 0x7fffdb7fe700 (LWP 62418)]
[New Thread 0x7fffdaffd700 (LWP 62419)]

Thread 14 "node" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffdaffd700 (LWP 62419)]
0x0000000001344a26 in EVP_MD_CTX_clear_flags ()
(gdb) bt
#0 0x0000000001344a26 in EVP_MD_CTX_clear_flags ()
#1 0x000000000132e95e in EVP_DigestInit_ex ()
#2 0x000000000134e113 in HMAC_Init_ex ()
#3 0x00007fffe56f5d2b in sqlcipher_openssl_hmac () from /tmp/js/libtdjson.so
#4 0x00007fffe5700d80 in sqlcipher_page_cipher () from /tmp/js/libtdjson.so
#5 0x00007fffe57278dd in sqlite3Codec () from /tmp/js/libtdjson.so
#6 0x00007fffe5743adf in pager_write_pagelist () from /tmp/js/libtdjson.so
#7 0x00007fffe5752e20 in sqlite3PagerCommitPhaseOne.part.591 () from /tmp/js/libtdjson.so
#8 0x00007fffe5752fbf in sqlite3BtreeCommitPhaseOne.part.592 () from /tmp/js/libtdjson.so
#9 0x00007fffe5757da7 in sqlite3VdbeHalt () from /tmp/js/libtdjson.so
#10 0x00007fffe578d101 in sqlite3VdbeExec () from /tmp/js/libtdjson.so
#11 0x00007fffe578e547 in sqlite3_step () from /tmp/js/libtdjson.so
#12 0x00007fffe578f7f2 in sqlcipher_execExecSql () from /tmp/js/libtdjson.so
#13 0x00007fffe578fa96 in sqlcipher_exportFunc () from /tmp/js/libtdjson.so
#14 0x00007fffe5784619 in sqlite3VdbeExec () from /tmp/js/libtdjson.so
#15 0x00007fffe578e547 in sqlite3_step () from /tmp/js/libtdjson.so
#16 0x00007fffe5781daa in sqlite3_exec () from /tmp/js/libtdjson.so
#17 0x00007fffe56d91cc in td::SqliteDb::exec(td::CSlice) () from /tmp/js/libtdjson.so
#18 0x00007fffe56db770 in td::SqliteDb::change_key(td::CSlice, td::DbKey const&, td::DbKey const&) () from /tmp/js/libtdjson.so
#19 0x00007fffe510fdd0 in td::TdDb::init_sqlite(int, td::TdParameters const&, td::DbKey, td::DbKey, td::BinlogKeyValuetd::Binlog&) () from /tmp/js/libtdjson.so
#20 0x00007fffe511141b in td::TdDb::init(int, td::TdParameters const&, td::DbKey, td::TdDb::Events&) () from /tmp/js/libtdjson.so
#21 0x00007fffe5111e41 in td::TdDb::open(int, td::TdParameters const&, td::DbKey, td::TdDb::Events&) () from /tmp/js/libtdjson.so
#22 0x00007fffe50dcd07 in td::Td::init(td::DbKey) () from /tmp/js/libtdjson.so
#23 0x00007fffe50e204c in td::Td::request(unsigned long, std::unique_ptr<td::td_api::Function, std::default_deletetd::td_api::Function >) () from /tmp/js/libtdjson.so
#24 0x00007fffe4fdcdbc in td::ClosureEvent<td::DelayedClosure<td::Td, void (td::Td::)(unsigned long, std::unique_ptr<td::td_api::Function, std::default_deletetd::td_api::Function >), unsigned long&, std::unique_ptr<td::td_api::Function, std::default_deletetd::td_api::Function >&&> >::run(td::Actor) () from /tmp/js/libtdjson.so
#25 0x00007fffe56e5cff in td::Scheduler::do_event(td::ActorInfo*, td::Event&&) () from /tmp/js/libtdjson.so
#26 0x00007fffe56ea27a in void td::Scheduler::flush_mailbox<void ()(td::ActorInfo), td::Event ()()>(td::ActorInfo, void (* const&)(td::ActorInfo*), td::Event (* const&)()) ()
from /tmp/js/libtdjson.so
#27 0x00007fffe56ea5e9 in td::Scheduler::run_mailbox() () from /tmp/js/libtdjson.so
#28 0x00007fffe56ead78 in td::Scheduler::run_no_guard(double) () from /tmp/js/libtdjson.so
#29 0x00007fffe56e2d02 in td::ConcurrentScheduler::run_main(double) () from /tmp/js/libtdjson.so
#30 0x00007fffe4fdcbc1 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<td::detail::ThreadStl::ThreadStltd::Client::Impl::init()::{lambda()#1}(td::Client::Impl::init()::{lambda()#1}&&)::{lambda()#1}> > >::_M_run() () from /tmp/js/libtdjson.so
#31 0x00007ffff76fc57f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#32 0x00007ffff6f086ba in start_thread (arg=0x7fffdaffd700) at pthread_create.c:333
#33 0x00007ffff6c3e41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

`

latest tdlibs version:
image

gdb output:
image

botcommands example doesnt work :(

lepres@akho ~/telegram-javascript $ node botcommands.js
(node:3038) Warning: N-API is an experimental feature and could change at any time.
Authorizing bot (671139129:AAETpkzzIRTvUDDN3UXUpx8kCdJB8PcOEEA)
(node:3038) UnhandledPromiseRejectionWarning: Error: No text defined for method "sendTextMessage".
at TG.sendTextMessage (/home/lepres/node_modules/tglib/TG.js:24:13)
at client.registerCallback (/home/lepres/telegram-javascript/botcommands.js:26:27)
at Client.handleUpdate (/home/lepres/node_modules/tglib/Client.js:263:37)
at Client.loop (/home/lepres/node_modules/tglib/Client.js:124:22)
at
(node:3038) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:3038) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:3038) UnhandledPromiseRejectionWarning: Error: No text defined for method "sendTextMessage".
at TG.sendTextMessage (/home/lepres/node_modules/tglib/TG.js:24:13)
at client.registerCallback (/home/lepres/telegram-javascript/botcommands.js:24:27)
at Client.handleUpdate (/home/lepres/node_modules/tglib/Client.js:263:37)
at Client.loop (/home/lepres/node_modules/tglib/Client.js:124:22)
at
(node:3038) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)

Importing TGLib troubleshooting

Hello,

What I have done so far
I'm trying to use tglib and followed the first step of compiling the official tdlib and followed the second step to create a node project and installing tglib.

My problem
is the following console log. I'm using NodeJS v15.6.0 which is above the preferred requirement of v10.0.0.
What can I do about it? The error message is telling me anything, hope you can help.
EDIT: I guess it has probably something to do with ffi-napi, because it looks like a buffer?

My Code
app

Console Log
log

Successful compilation of TDLIB
successful compilation

Kind regards and thank you for your help
Max

Cannot find module

With clean install its asking for module

Error: Cannot find module 'babel-runtime/core-js/object/keys'

Search libtdjson in LD_LIBRARY_PATH

Currently tglib assumes libtdjson is in current directory, but I have libtdjson installed system-wide. If i change this to binaryPath: "libtdjson" it works for me as expected but it will break existing behavior for current directory (Or it works if run LD_LIBRARY_PATH=. node script.js). Is it possible to search library in LD_LIBRARY_PATH (default for node-ffi) + current directory?

Authorization

I'm using tdlib 1.5 and I'd some problems with authorization

node.js
image

line 494: undefined property is_registered
line 495: undefined variable value

How does one set TDLib binary path? I would let myself out but I cant close stuff D:

Thread name is my question. This is not documented afaik, I don't want to mess with tglib source. I wanna know the proper way. Sorry if I missed it, I may have lost half my intelligence wrestling with endless installation errors xD

Yes, I built it myself, yes I installed all dependencies, yes I acquired my api key and stuff. I just need to know where to specify a path. Also, should it be a path to td/build/release ?

Found #2 , will try now, sorry for your trouble!

Problem with getSupergroupMembers

the command getSupergroupMembers and many other getSupergroup* don't work for me.
It gives no details in error messages, just "Query timed out after 30 seconds."
I googled a lot about tdlib + getSupergroupMembers to find probable simillar problem but it seems nobody else had this problem before me. Also I checked sample codes from other languages and found no mistake in my code. Here it is:

let chatMembers = await client.fetch({
      '@type': 'getSupergroupMembers',
      'supergroup_id': -1001304740402,
      'filter': null,
      'offset': 0,
      'limit': 20
    })

I'm using TDLib 1.3 on Linux. I updated tglib from 2.x to 3.0.1 but there in no difference.

How to use Local Database

Hi
Thanks for your great contribution.
Is it possible to query the local database for getting messages without fetching from telegram servers?
It is required for a permanent loop message fetching which is better done on local db.
Thanks

Executing client.fetch immediately after client.connect will encounter error.

This issue just for logging.

const client = new Client(...}
await client.connect()
await client.fetch({
  '@type': 'createPrivateChat',
  'user_id': 1234,
})

Error

(node:7969) UnhandledPromiseRejectionWarning: Error: {"@type":"error","code":6,"message":"Chat info not found"}

Resolved in version 1.3 by adding short delay.

Node Error when importing

Node version: v14.16.0 and v15.13.0 (tried on both)
did a npm install tglib

then made a index.js and required the module then ran with node index.js

then it threw error

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x7ffd7c848da0
 1: 0xaf68b1  [node]
 2: 0x1afe1e4 V8_Fatal(char const*, ...) [node]
 3: 0xf5e7f9 v8::internal::GlobalBackingStoreRegistry::Register(std::shared_ptr<v8::internal::BackingStore>) [node]
 4: 0xc9c938 v8::ArrayBuffer::GetBackingStore() [node]
 5: 0xa3ff40 napi_get_typedarray_info [node]
 6: 0x7f2dc4101a83  [/home/sonisins/prujekts/node/channel-dl/node_modules/ffi-napi/build/Release/ffi_bindings.node]
 7: 0x7f2dc4104e76 FFI::FFI::InitializeBindings(Napi::Env, Napi::Object) [/home/sonisins/prujekts/node/channel-dl/node_modules/ffi-napi/build/Release/ffi_bindings.node]
 8: 0x7f2dc41055f0  [/home/sonisins/prujekts/node/channel-dl/node_modules/ffi-napi/build/Release/ffi_bindings.node]
 9: 0x7f2dc4101b15 __napi_Init(napi_env__*, napi_value__*) [/home/sonisins/prujekts/node/channel-dl/node_modules/ffi-napi/build/Release/ffi_bindings.node]
10: 0xa52e49 napi_module_register_by_symbol(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, napi_value__* (*)(napi_env__*, napi_value__*)) [node]
11: 0xa575f0  [node]
12: 0xa57c69 node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) [node]
13: 0xcdbb5b  [node]
14: 0xcdd10c  [node]
15: 0xcdd786 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
16: 0x14fdff9  [node]
[1]    32742 illegal hardware instruction (core dumped)  node download.js

asks for Authorization credential though given in code

I had many scripts with tglib and they were logged in accounts and was working perfectly. After months now I want to use them again but not are logged in nor can login! They prompt me with:
tglib.input.AuthorizationType
tglib.input.AuthorizationValue
But no response after entering them. I don't remember what is changed during this time that stop it from working. Could you guide me please to find the problem?
(I also registered a callback for td:getInput following readme but no difference)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.