【问题标题】:whatsapp-web.js, how do I send someone a contact card of someone else?whatsapp-web.js,我如何向某人发送别人的名片?
【发布时间】:2021-12-15 13:29:11
【问题描述】:

如何在 whatsapp-web.js 中向某人发送其他人的名片? 我可以在何时发送联系人卡片 我发送联系人卡片的人已保存在我的手机上,但我要发送的联系人不在我手机的联系人列表中

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: javascript node.js whatsapp


【解决方案1】:
client.on('ready', async () => {   try {
    console.log('Client is ready!');
    const saved = [];

    var array = fs.readFileSync('numb.txt').toString().split("\n"); //reading file
    for (i in array) {
      //console.log(array[i]);
      saved.push(array[i].substring(1)); //array with number 
    }

    const contacts = [];
    for (var i = 0; i < saved.length; i++) {
      contacts.push(await client.getContactById(saved[i] + '@c.us')); }
    client.sendMessage(to, contacts); //sending contact cards   
} });

【讨论】:

    猜你喜欢
    • 2021-08-26
    • 2021-03-17
    • 2023-01-15
    • 1970-01-01
    • 2021-03-03
    • 2015-06-17
    • 2013-09-24
    • 2021-10-10
    • 2019-06-22
    相关资源
    最近更新 更多