2

使用电话号码导入 excel 并尝试向所有号码发送相同的消息。我在节点 js 中使用“tdlib”作为电报 API。节点版本 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
            });

在这种方法之后,我正在尝试发送消息。我的代码执行在这里停止。帮我解决这个问题。

4

0 回答 0