Count user connected devices (#3223)

* Update Store.js

* All

* Make Eslist god happy

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
This commit is contained in:
tuyuribr 2024-09-18 04:33:23 -03:00 • committed by GitHub
commit d2597bba72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 3 deletions

View file

@ -450,6 +450,14 @@ client.on('message', async msg => {
*/
const result = await msg.pin(60); // Will pin a message for 1 minute
console.log(result); // True if the operation completed successfully, false otherwise
}else if (msg.body === '!howManyConnections'){
/**
* Get user device count by ID
* Each WaWeb Connection counts as one device, and the phone (if exists) counts as one
* So for a non-enterprise user with one WaWeb connection it should return "2"
*/
let deviceCount = await client.getContactDeviceCount(msg.from);
await msg.reply(`You have *${deviceCount}* devices connected`);
}
});