mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-17 19:26:20 +00:00
feat: added group_admin_changed event (#2018)
* docs: updated * added group-admin-change event * minor changes * added usage example * minor changes: code docs updated
This commit is contained in:
11
example.js
11
example.js
@@ -270,3 +270,14 @@ client.on('disconnected', (reason) => {
|
||||
console.log('Client was logged out', reason);
|
||||
});
|
||||
|
||||
client.on('group_admin_changed', (notification) => {
|
||||
if (notification.type === 'promote') {
|
||||
/**
|
||||
* Emitted when a current user is promoted to an admin.
|
||||
* {@link notification.author} is a user who performs the action of promoting/demoting the current user.
|
||||
*/
|
||||
console.log(`You were promoted by ${notification.author}`);
|
||||
} else if (notification.type === 'demote')
|
||||
/** Emitted when a current user is demoted to a regular user. */
|
||||
console.log(`You were demoted by ${notification.author}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user