diff --git a/README.md b/README.md index e52df36..a1c7023 100644 --- a/README.md +++ b/README.md @@ -688,6 +688,11 @@ await sock.sendMessage( const status = await sock.fetchStatus("xyz@s.whatsapp.net") console.log("status: " + status) ``` +- To change your profile status + ``` ts + const status = 'Hello World!' + await sock.updateProfileStatus(status) + ``` - To get the display picture of some person/group ``` ts // for low res picture diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index eb2d3c9..0942951 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -175,6 +175,25 @@ export const makeChatsSocket = (config: SocketConfig) => { }) } + /** update the profile status for yourself */ + const updateProfileStatus = async(status: string) => { + await query({ + tag: 'iq', + attrs: { + to: S_WHATSAPP_NET, + type: 'set', + xmlns: 'status' + }, + content: [ + { + tag: 'status', + attrs: { }, + content: Buffer.from(status, 'utf-8') + } + ] + }) + } + const fetchBlocklist = async() => { const result = await query({ tag: 'iq', @@ -770,10 +789,11 @@ export const makeChatsSocket = (config: SocketConfig) => { fetchBlocklist, fetchStatus, updateProfilePicture, + updateProfileStatus, updateBlockStatus, getBusinessProfile, resyncAppState, chatModify, resyncMainAppState, } -} \ No newline at end of file +}