{"id":20266899,"url":"https://github.com/wfjsw/node-tdlib","last_synced_at":"2025-04-11T03:36:17.582Z","repository":{"id":47436508,"uuid":"134917297","full_name":"wfjsw/node-tdlib","owner":"wfjsw","description":"TDLib Binding with Telegram Bot API Reimplemention for Node.js","archived":false,"fork":false,"pushed_at":"2022-12-07T18:50:50.000Z","size":443,"stargazers_count":37,"open_issues_count":5,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T01:37:19.542Z","etag":null,"topics":["bindings","node-tdlib","nodejs","tdlib","telegram","telegram-api","telegram-bot-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wfjsw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-26T00:45:59.000Z","updated_at":"2024-08-14T10:06:47.000Z","dependencies_parsed_at":"2023-01-24T20:30:35.517Z","dependency_job_id":null,"html_url":"https://github.com/wfjsw/node-tdlib","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wfjsw%2Fnode-tdlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wfjsw%2Fnode-tdlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wfjsw%2Fnode-tdlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wfjsw%2Fnode-tdlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wfjsw","download_url":"https://codeload.github.com/wfjsw/node-tdlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248337912,"owners_count":21087127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindings","node-tdlib","nodejs","tdlib","telegram","telegram-api","telegram-bot-api"],"created_at":"2024-11-14T12:12:09.413Z","updated_at":"2025-04-11T03:36:17.554Z","avatar_url":"https://github.com/wfjsw.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-tdlib\n\n## Install\n\n### Use prebuilt binaries\n\n```\nnpm i wfjsw/node-tdlib --save\n```\n\nNPM will automatically download the appropriate `tdlib.node` binary.\n\nWill compile automatically (using a lot of time) if there doesn't exist a suitable binary. If you do not need it, pass `--ignore-scripts` to `npm`.\n\nList of prebuilt binary is available [here](https://github.com/wfjsw/node-tdlib/releases).\n\n### Compile on your own\n\n```\ngit clone https://github.com/wfjsw/node-tdlib.git\ncd node-tdlib\nnpm i\nnpm run compile\nnpm ln\n```\n\nWhen you need to use it, run\n\n```\nnpm ln tdlib\n```\n\nDependencies: cmake, gperf, zlib, node \u003e= 10.0.0, same OpenSSL(libssl-dev) version with Node.js\n\nYou may check your Node.js Dependency by using `node -p process.versions`\n\nBe careful when use `gcc` and `g++` as they will use up to 8GB memory. `clang` compiler is preferred but not required. Using `clang` will result in less memory requirement on compilation.\n\nOptional Dependencies: ccache (will speed up subsequent compilation.)\n\n## TdLib Raw Interface\n\n```typescript\ninterface TDLib {\n    /** \n     * Create a TDLib Client \n     * @returns {number} Return a sequence number for client identifier\n     */\n    td_client_create(): number;\n    /**\n     * Destroy a TDLib Client\n     * @param {number} client_id Client identifier\n     */\n    td_client_destroy(client_id: number);\n    /**\n     * Sends request to TDLib.\n     * @param {number} client_id Client identifier\n     * @param {string} request JSON serialized request\n     */\n    td_client_send(client_id: number, request: string);\n    /**\n     * Receives incoming updates and request responses from TDLib.\n     * @param {number} client_id Client identifier\n     * @param {number} timeout Maximum number of seconds allowed for this function to wait for new data.\n     */\n    td_client_receive(client_id: number, timeout: number);\n    /**\n     * Sends synchronized request to TDLib.\n     * @param client_id Client identifier\n     * @param request JSON serialized request\n     */\n    td_client_execute(client_id: number, request: string): string;\n\n}\n```\n\n## TdClient Interface\n\nSee [TDLib Documentation](https://core.telegram.org/tdlib/docs/annotated.html) for further reference.\n\n```typescript\nclass TdClientActor extends EventEmitter {\n    constructor(options: TdClientActorOptions);\n    run(method: string, params: object): Promise\u003cobject\u003e;\n    destroy(): Promise\u003cvoid\u003e;\n\n    // Events:\n    // ready\n    // closed\n    // __\u003ctypes\u003e\n    // _fileDownloaded\n    // _fileDownloaded:\u003cfile_id\u003e\n}\n\ninterface TdClientActorOptions {\n    identifier: string;\n    database_encryption_key: string;\n    /** Application identifier for Telegram API access, which can be obtained at https://my.telegram.org.  */\n    api_id: string;\n    /** Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org.  */\n    api_hash: string;\n    /** If set to true, the Telegram test environment will be used instead of the production environment.  */\n    use_test_dc?: boolean;\n    /** The path to the directory for the persistent database; if empty, a dedicated directory named in identifier will be used.  */\n    database_directory?: string;\n    /** If set to true, information about downloaded and uploaded files will be saved between application restarts.  */\n    use_file_database?: boolean;\n    /** If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies use_file_database.  */\n    use_chat_info_database?: boolean;\n    /** If set to true, the library will maintain a cache of chats and messages. Implies use_chat_info_database.  */\n    use_message_database?: boolean;\n    /** If set to true, support for secret chats will be enabled.  */\n    use_secret_chats?: boolean;\n    /** IETF language tag of the user's operating system language; must be non-empty.  */\n    system_language_code?: string;\n    /** Model of the device the application is being run on; must be non-empty.  */\n    device_model?: string;\n    /** Version of the operating system the application is being run on; must be non-empty. */\n    system_version?: string;\n    /** Application version; must be non-empty.  */\n    application_version?: string;\n    /** If set to true, old files will automatically be deleted.  */\n    enable_storage_optimizer?: string;\n    /** If set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name.  */\n    ignore_file_names?: boolean;\n}\n```\n\n\n## Bot API Interface\n\nSee [Telegram Bot API](https://core.telegram.org/bots/api) and bundled TypeScript file for reference.\n\n## License\n\nThis is free and unencumbered software released into the public domain.\n\nAnyone is free to copy, modify, publish, use, compile, sell, or\ndistribute this software, either in source code form or as a compiled\nbinary, for any purpose, commercial or non-commercial, and by any\nmeans.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwfjsw%2Fnode-tdlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwfjsw%2Fnode-tdlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwfjsw%2Fnode-tdlib/lists"}