MyGit

v1.15.1

pedroslopez/whatsapp-web.js

版本发布时间: 2021-10-30 12:47:23

pedroslopez/whatsapp-web.js最新发布版本:v1.26.1-alpha.2(2024-10-04 12:29:54)

This is a hotfix to address issues with replying to messages with v1.15.0

Patch notes since last version didn't have them:

Patch notes for 1.15.0 and 1.15.1:

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

// sending buttons
client.sendMessage(to, new Buttons('Body text/ MessageMedia instance', [{id:'customId',body:'button1'},{body:'button2'},{body:'button3'},{body:'button4'}], 'Title here, doesn\'t work with media', 'Footer here'), {caption: 'if you used a MessageMedia instance, use the caption here'})

// sending lists
client.sendMessage(to, new List('Body text/ MessageMedia instance', 'List message button text', [{title: 'sectionTitle', rows: [{id: 'customId', title: 'ListItem2', description: 'desc'}, {title: 'ListItem2'}]}] 'Title here, doesn\'t work with media', 'Footer here'), {caption: 'if you used a MessageMedia instance, use the caption here'})

//getting response
client.on('message', m => {
  if (m.type == 'buttons_response') {
    const {selectedButtonId: bid} = message;
    if (bid == 'customId') m.reply('You chose button 1')
    // this is a buttons message response
  } else if (m.type == 'list_response' /* not sure */) {
    const {selectedButtonId: bid} = message;
    if (bid == 'customId') m.reply('You chose list item 2')
    // this is a list message response
  }
});

docs: https://docs.wwebjs.dev/List.html https://docs.wewbjs.dev/Buttons.html

client.on('message', async m => {
   if (message.type == 'payment') {
    const paymentInfo = await m.getPayment();
    // do hat you want here
  }
});

docs: class missing from docs :D

both return a Promise (use await)

const blockedIds = await client.getBlockedIds();
//['62813xxx@c.us', '628xxx@c.us']

相关地址:原始地址 下载(tar) 下载(zip)

查看:2021-10-30发行的版本