mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Change profile name for yourself (#1913)
* feat: change profile name * fix: unnecessary return
This commit is contained in:
@@ -695,6 +695,11 @@ await sock.sendMessage(
|
|||||||
const status = 'Hello World!'
|
const status = 'Hello World!'
|
||||||
await sock.updateProfileStatus(status)
|
await sock.updateProfileStatus(status)
|
||||||
```
|
```
|
||||||
|
- To change your profile name
|
||||||
|
``` ts
|
||||||
|
const name = 'My name'
|
||||||
|
await sock.updateProfileName(name)
|
||||||
|
```
|
||||||
- To get the display picture of some person/group
|
- To get the display picture of some person/group
|
||||||
``` ts
|
``` ts
|
||||||
// for low res picture
|
// for low res picture
|
||||||
|
|||||||
@@ -192,6 +192,10 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateProfileName = async(name: string) => {
|
||||||
|
await chatModify({ pushNameSetting: name }, '')
|
||||||
|
}
|
||||||
|
|
||||||
const fetchBlocklist = async() => {
|
const fetchBlocklist = async() => {
|
||||||
const result = await query({
|
const result = await query({
|
||||||
tag: 'iq',
|
tag: 'iq',
|
||||||
@@ -786,6 +790,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
fetchStatus,
|
fetchStatus,
|
||||||
updateProfilePicture,
|
updateProfilePicture,
|
||||||
updateProfileStatus,
|
updateProfileStatus,
|
||||||
|
updateProfileName,
|
||||||
updateBlockStatus,
|
updateBlockStatus,
|
||||||
getBusinessProfile,
|
getBusinessProfile,
|
||||||
resyncAppState,
|
resyncAppState,
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ export type ChatModification =
|
|||||||
archive: boolean
|
archive: boolean
|
||||||
lastMessages: LastMessageList
|
lastMessages: LastMessageList
|
||||||
} |
|
} |
|
||||||
|
{
|
||||||
|
pushNameSetting: string
|
||||||
|
} |
|
||||||
{
|
{
|
||||||
pin: boolean
|
pin: boolean
|
||||||
} |
|
} |
|
||||||
|
|||||||
@@ -578,6 +578,18 @@ export const chatModificationToAppPatch = (
|
|||||||
apiVersion: 6,
|
apiVersion: 6,
|
||||||
operation: OP.SET
|
operation: OP.SET
|
||||||
}
|
}
|
||||||
|
} else if('pushNameSetting' in mod) {
|
||||||
|
patch = {
|
||||||
|
syncAction: {
|
||||||
|
pushNameSetting: {
|
||||||
|
name: mod.pushNameSetting
|
||||||
|
}
|
||||||
|
},
|
||||||
|
index: ['setting_pushName'],
|
||||||
|
type: 'critical_block',
|
||||||
|
apiVersion: 1,
|
||||||
|
operation: OP.SET,
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Boom('not supported')
|
throw new Boom('not supported')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user