mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-19 03:59:16 +00:00
feat: listen to group events (#90)
This allows you to listen for user joins or leaves, description updates, subject updates, picture updates, and group settings updates. Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
This commit is contained in:
17
example.js
17
example.js
@@ -219,6 +219,23 @@ client.on('message_ack', (msg, ack) => {
|
||||
}
|
||||
});
|
||||
|
||||
client.on('group_join', (notification) => {
|
||||
// User has joined or been added to the group.
|
||||
console.log('join', notification);
|
||||
notification.reply('User joined.');
|
||||
});
|
||||
|
||||
client.on('group_leave', (notification) => {
|
||||
// User has left or been kicked from the group.
|
||||
console.log('leave', notification);
|
||||
notification.reply('User left.');
|
||||
});
|
||||
|
||||
client.on('group_update', (notification) => {
|
||||
// Group picture, subject or description has been updated.
|
||||
console.log('update', notification);
|
||||
});
|
||||
|
||||
client.on('disconnected', (reason) => {
|
||||
console.log('Client was logged out', reason);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user