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:
Aliyss Snow
2020-03-01 19:32:58 +01:00
committed by GitHub
parent 588dc93c17
commit 48b9ae1e81
4 changed files with 154 additions and 2 deletions

View File

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