简体   繁体   English

如何从telegram.link模块连接到telegram api?

[英]How to connect to telegram api from telegram.link module?

I am using telegram.link for implementing telegram methods in node.js and working with my telegram account by sending and receiving messages. 我正在使用telegram.link在node.js中实现电报方法,并通过发送和接收消息来处理我的电报帐户。 but when I want to connect to telegram server as follow: 但是当我想连接到电报服务器时如下:

  1 app = require("telegram.link")() 2 client = app.createClient({ 3 id: 48820 4 hash: '0028ba7cd67b8e9e487f7700cc4760e9' 5 version: '1.0.0' 6 lang: 'en' 7 }, app.TEST_PRIMARY_DC, (ex) -> 8 if !ex 9 console.log 'ok' 10 client.contacts.getContacts (err, result) -> 11 console.log result 12 else 13 console.log 'Not ok' 14 ) 15 16 dc = client.getDataCenters() 17 18 cosole.log dc 

but when I want run this this error appear in my console [ERROR] Thu, 05 May 2016 16:19:41 GMT telegram-link Client is not yet ready! 但是当我想要运行时,这个错误出现在我的控制台中[ERROR] Thu, 05 May 2016 16:19:41 GMT telegram-link Client is not yet ready! What do you think about this error? 你怎么看待这个错误?

你不能调用getDataCenters()方法连接已经配合建立之前,即你必须createClient回调里面你的电话,只需调用之前client.contacts.getContacts

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

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