pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
14.92k stars 3.54k forks source link

Please update example for groupchat - remove participant from group #280

Closed itsecres-nandant closed 4 years ago

itsecres-nandant commented 4 years ago

example.js has limited implementation of features that it supports so please update example.js with all methods available, thank you

pedroslopez commented 4 years ago

I'm actually looking to get rid of example.js and instead opt for a clearer description of all functionality through a guide https://waguide.pedroslopez.me/. The example file is getting pretty messy and is far from ideal for new people to learn how to do things with the library.

For now, you can check out the initial part of the guide in the link above, or read the full documentation and all available methods at https://pedroslopez.me/whatsapp-web.js

labitacoradeunprogramador commented 9 months ago

Example: of removing a participant.

client.on("message", async (msg) => { if (msg.body.includes("!kick")) {

const contact = await msg.getMentions();
const chat = await msg.getChat();
await chat.removeParticipants([contact[0].id._serialized]);

} });