发送按钮在 Whatsapp Web js 中不起作用

Sha*_*har 4 javascript node.js whatsapp

由于某种原因它不想发送按钮,我在网上查找但没有找到帮助,这是我的代码:


const { Client, LocalAuth ,MessageMedia, Buttons } = require('whatsapp-web.js');

const client = new Client({
    authStrategy: new LocalAuth()
});

client.on('qr', qr => {
    qrcode.generate(qr, {small: true});
});

client.on('ready', () => {
    console.log('Client is ready!');
});


client.on('message', message => {
    console.log('message from', message.from)
    if (message.body === "!button") {

        let button = new Buttons('Button body',[{body:'bt1'},{body:'bt2'},{body:'bt3'}],'title','footer');
        client.sendMessage(message.from, button);

    }
});
 
client.initialize();
Run Code Online (Sandbox Code Playgroud)

小智 5

安装使用:

npm i github:pedroslopez/whatsapp-web.js#fix-buttons-list
Run Code Online (Sandbox Code Playgroud)

或者

yarn add github:pedroslopez/whatsapp-web.js#fix-buttons-list
Run Code Online (Sandbox Code Playgroud)