From 44834d29fa64b4299dfedf1201dc5ca0bf1ee92f Mon Sep 17 00:00:00 2001 From: P Date: Mon, 23 May 2022 04:55:31 -0300 Subject: [PATCH] update profile pic in legacy version (#1611) Co-authored-by: Henrique --- src/LegacySocket/chats.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/LegacySocket/chats.ts b/src/LegacySocket/chats.ts index b516d2f..20d594c 100644 --- a/src/LegacySocket/chats.ts +++ b/src/LegacySocket/chats.ts @@ -1,6 +1,7 @@ import { BaileysEventMap, Chat, ChatModification, Contact, LastMessageList, LegacySocketConfig, PresenceData, WABusinessProfile, WAFlag, WAMessageKey, WAMessageUpdate, WAMetric, WAPresence } from '../Types' import { debouncedTimeout, unixTimestampSeconds } from '../Utils/generics' import { BinaryNode, jidNormalizedUser } from '../WABinary' +import { generateProfilePicture } from '../Utils' import makeAuthSocket from './auth' const makeChatsSocket = (config: LegacySocketConfig) => { @@ -474,16 +475,17 @@ const makeChatsSocket = (config: LegacySocketConfig) => { * @param jid * @param img */ - async updateProfilePicture(jid: string, img: Buffer) { + async updateProfilePicture(jid: string, imgBuffer: Buffer) { jid = jidNormalizedUser (jid) - const data = { img: Buffer.from([]), preview: Buffer.from([]) } //await generateProfilePicture(img) TODO + + const { img } = await generateProfilePicture(imgBuffer) const tag = this.generateMessageTag () const query: BinaryNode = { tag: 'picture', attrs: { jid: jid, id: tag, type: 'set' }, content: [ - { tag: 'image', attrs: {}, content: data.img }, - { tag: 'preview', attrs: {}, content: data.preview } + { tag: 'image', attrs: {}, content: img }, + { tag: 'preview', attrs: {}, content: img } ] }