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:
alechkos
2023-04-01 19:40:47 +03:00
committed by GitHub
parent ac7df25075
commit 9f15499592
4 changed files with 27 additions and 0 deletions

View File

@@ -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}`);
});