mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-19 12:09:15 +00:00
feat: change status message
This commit is contained in:
@@ -62,6 +62,7 @@ Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/
|
|||||||
| Mention users | _pending_ |
|
| Mention users | _pending_ |
|
||||||
| Get contact info | ✅ |
|
| Get contact info | ✅ |
|
||||||
| Get profile pictures | ✅ |
|
| Get profile pictures | ✅ |
|
||||||
|
| Set user status message | ✅ |
|
||||||
|
|
||||||
Something missing? Make an issue and let us know!
|
Something missing? Make an issue and let us know!
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,10 @@ client.on('message', async msg => {
|
|||||||
msg.reply(new Location(37.422, -122.084, 'Googleplex\nGoogle Headquarters'));
|
msg.reply(new Location(37.422, -122.084, 'Googleplex\nGoogle Headquarters'));
|
||||||
} else if(msg.location) {
|
} else if(msg.location) {
|
||||||
msg.reply(msg.location);
|
msg.reply(msg.location);
|
||||||
|
} else if(msg.body.startsWith('!status ')) {
|
||||||
|
const newStatus = msg.body.split(' ')[1];
|
||||||
|
await client.setStatus(newStatus);
|
||||||
|
msg.reply(`Status was updated to *${newStatus}*`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -331,6 +331,16 @@ class Client extends EventEmitter {
|
|||||||
return chatId._serialized;
|
return chatId._serialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the current user's status message
|
||||||
|
* @param {string} status New status message
|
||||||
|
*/
|
||||||
|
async setStatus(status) {
|
||||||
|
await this.pupPage.evaluate(async status => {
|
||||||
|
return await window.Store.Wap.sendSetStatus(status);
|
||||||
|
}, status);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Client;
|
module.exports = Client;
|
||||||
|
|||||||
Reference in New Issue
Block a user