简体   繁体   English

如何在 Node.js 中使用 Telegram 的 TDlib

[英]How to use Telegram's TDlib with Node.js

There is TDlib which allows to work with Telegram Client API. TDlib 允许使用 Telegram Client API。

Documentation says that it's possible to use it with almost any language.文档说它几乎可以用于任何语言。

I can't imagine myself how I can use it with Node.js我无法想象自己如何将它与 Node.js 一起使用

Could you tell me where to start from or provide me with a sample code?你能告诉我从哪里开始或给我提供一个示例代码吗?

You can make requests and get updates using td_json_client and node-ffi interfaces.您可以使用td_json_clientnode-ffi接口发出请求并获取更新。 Official repository provides a simple example .官方仓库提供了一个简单的例子

If you don't want to create API client from zero, you may use one of exists.如果您不想从零创建 API 客户端,您可以使用现有的其中之一。 For example, check out Airgram .例如,查看Airgram This is a strong typed tdlib client for NodeJS.这是tdlib的强类型tdlib客户端。

You can probably port one of the examples on their GitHub repos (Python can be an easy one).您可能可以在他们的GitHub 存储库上移植其中一个示例(Python 可以是一个简单的示例)。 You needs to learn how to use binary modules with node.您需要学习如何在 node.js 中使用二进制模块。

Or you can check one of the 3rd party libraries (eg. https://github.com/k-egor-smirnov/node-tg-native )或者您可以检查 3rd 方库之一(例如https://github.com/k-egor-smirnov/node-tg-native

There are 2 active TDLib wrappers in Node.js: Node.js 中有 2 个活动的 TDLib 包装器:

Both require you to build the TDLib binary yourself before using these wrapper: https://tdlib.github.io/td/build.html两者都要求您在使用这些包装器之前自己构建 TDLib 二进制文件: https ://tdlib.github.io/td/build.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM