电报无法导入节点js中的联系人

时间:2019-07-09 13:29:17

标签: node.js telegram tdlib

使用电话号码导入excel,并尝试将相同的消息发送到所有号码。我在节点js中使用电报API的“ tdlib”。节点版本10.16。我总是遇到以下错误

[ 2][t 4][1562735989.296543121][ConnectionCreator.cpp:992][#1][!ConnectionCreator]  [[2001:b28:f23f:f005::a]:443] to DcId{5}: [PosixError : No route to host : 65 : Failed to connect to [[2001:b28:f23f:f005::a]:443]]

    { _: 'error',
      code: 429,
      message: 'Too Many Requests: retry after 295' }

这是我的代码

const telegramConnect = async () => {
    const { Client } = require('tdl');
    const { TDLib } = require('tdl-tdlib-ffi');

    const number = '+9196xxxxxx43';
    const telegramClient = new Client(new TDLib(), {
        number,
        apiId: 86xxx5, // Your api_id
        apiHash: '27xxxxxxxxxxxxxxxxxc7b1', // Your api_hash
    });

    telegramClient.on('Telegram Connection Error ', console.error);

    await telegramClient.connectAndLogin();

    return telegramClient;
}

在节点js中,我调用了上述函数

 client = await telegramConnect();
    contacts = [
    {
        _: 'contact',
        phone_number: '+9196xxxxxx36',
        first_name: 'Jegan',
        last_name: '',
        vcard: '',
        user_id: 0
    },
    {
        _: 'contact',
        phone_number: '+9198xxxxxx10',
        first_name: 'mob12',
        last_name: 'mob12',
        vcard: '',
        user_id: 0
    }
];

const importContact = await client.invoke({
                _: 'importContacts',
                contacts: contacts
            });

使用此方法后,我正在尝试发送消息。我的代码执行在这里停止了。帮助我解决此问题。

0 个答案:

没有答案