mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Added method to update the profile name
This commit is contained in:
@@ -76,10 +76,31 @@ export class WAConnection extends Base {
|
||||
Buffer.from (status, 'utf-8')
|
||||
]
|
||||
]
|
||||
)
|
||||
)
|
||||
this.emit ('contact-update', { jid: this.user.jid, status })
|
||||
|
||||
// emit deprecated
|
||||
this.emit ('user-status-update', { jid: this.user.jid, status })
|
||||
return response
|
||||
}
|
||||
async updateProfileName (name: string) {
|
||||
const response = (await this.setQuery (
|
||||
[
|
||||
[
|
||||
'profile',
|
||||
{
|
||||
name
|
||||
},
|
||||
null
|
||||
]
|
||||
]
|
||||
)) as any as {status: number, pushname: string}
|
||||
if (response.status === 200) {
|
||||
this.user.name = response.pushname;
|
||||
this.emit ('contact-update', { jid: this.user.jid, name })
|
||||
}
|
||||
return response
|
||||
}
|
||||
/** Get your contacts */
|
||||
async getContacts() {
|
||||
const json = ['query', { epoch: this.msgCount.toString(), type: 'contacts' }, null]
|
||||
|
||||
Reference in New Issue
Block a user