WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
4.08k stars 1.38k forks source link

[BUG] Profile Picture #1067

Closed Riders004 closed 2 weeks ago

Riders004 commented 1 month ago

await sock.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' })

Not working

Riders004 commented 1 month ago

@PurpShell @SheIITear any idea ?

dimasmpp130 commented 1 month ago

I have a solution to use the feature from sock.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' }) , maybe in the current baileys version it doesn't work due to an error with the system code "408 error timeout"

You can use it with your eval bot for the case version, please tinker with it yourself. I'm just sharing, here is an example of the code I use:

const { S_WHATSAPP_NET } = require("@whiskeysockets/baileys");

const buffer = await mastahyabang.downloadAndSaveMediaMessage(quoted) var { img } = await generateProfilePicture(buffer) await mastahyabang.query({ tag: 'iq', attrs: { // target: '0', to: S_WHATSAPP_NET, type: 'set', xmlns: 'w:profile:picture' }, content: [ { tag: 'picture', attrs: { type: 'image' }, content: img } ] }) fs.unlinkSync(buffer) mek.reply(Sukses)

Note: if there is a sign like "//" don't delete it, for example if you delete the code it won't work and for the "generateProfilePicture" code it's just the default function code from my bot, not from baileys directly

This code works on the previous and latest versions of Baileys, please try the code if it works for you. I have tested it myself and the results work well without errors, thank you!!

Riders004 commented 1 month ago

I have a solution to use the feature from sock.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' }) , maybe in the current baileys version it doesn't work due to an error with the system code "408 error timeout"

You can use it with your eval bot for the case version, please tinker with it yourself. I'm just sharing, here is an example of the code I use:

const { S_WHATSAPP_NET } = require("@whiskeysockets/baileys");

const buffer = await mastahyabang.downloadAndSaveMediaMessage(quoted) var { img } = await generateProfilePicture(buffer) await mastahyabang.query({ tag: 'iq', attrs: { // target: '0', to: S_WHATSAPP_NET, type: 'set', xmlns: 'w:profile:picture' }, content: [ { tag: 'picture', attrs: { type: 'image' }, content: img } ] }) fs.unlinkSync(buffer) mek.reply(Sukses)

Note: if there is a sign like "//" don't delete it, for example if you delete the code it won't work and for the "generateProfilePicture" code it's just the default function code from my bot, not from baileys directly

This code works on the previous and latest versions of Baileys, please try the code if it works for you. I have tested it myself and the results work well without errors, thank you!!

Code of generateProfilePicture ?

And here to: S_WHATSAPP_NET, it's need a jid I'd but there's is s_whatsapp_net it's work only for our profile picture but not for group

// target: '0', is commented so by default bot can't run it

Riders004 commented 1 month ago

I have a solution to use the feature from sock.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' }) , maybe in the current baileys version it doesn't work due to an error with the system code "408 error timeout"

You can use it with your eval bot for the case version, please tinker with it yourself. I'm just sharing, here is an example of the code I use:

const { S_WHATSAPP_NET } = require("@whiskeysockets/baileys");

const buffer = await mastahyabang.downloadAndSaveMediaMessage(quoted) var { img } = await generateProfilePicture(buffer) await mastahyabang.query({ tag: 'iq', attrs: { // target: '0', to: S_WHATSAPP_NET, type: 'set', xmlns: 'w:profile:picture' }, content: [ { tag: 'picture', attrs: { type: 'image' }, content: img } ] }) fs.unlinkSync(buffer) mek.reply(Sukses)

Note: if there is a sign like "//" don't delete it, for example if you delete the code it won't work and for the "generateProfilePicture" code it's just the default function code from my bot, not from baileys directly

This code works on the previous and latest versions of Baileys, please try the code if it works for you. I have tested it myself and the results work well without errors, thank you!!

@dimasmpp130

ImYanXiao commented 1 month ago

I have a solution to use the feature from sock.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' }) , maybe in the current baileys version it doesn't work due to an error with the system code "408 error timeout" You can use it with your eval bot for the case version, please tinker with it yourself. I'm just sharing, here is an example of the code I use: const { S_WHATSAPP_NET } = require("@whiskeysockets/baileys"); const buffer = await mastahyabang.downloadAndSaveMediaMessage(quoted) var { img } = await generateProfilePicture(buffer) await mastahyabang.query({ tag: 'iq', attrs: { // target: '0', to: S_WHATSAPP_NET, type: 'set', xmlns: 'w:profile:picture' }, content: [ { tag: 'picture', attrs: { type: 'image' }, content: img } ] }) fs.unlinkSync(buffer) mek.reply(Sukses) Note: if there is a sign like "//" don't delete it, for example if you delete the code it won't work and for the "generateProfilePicture" code it's just the default function code from my bot, not from baileys directly This code works on the previous and latest versions of Baileys, please try the code if it works for you. I have tested it myself and the results work well without errors, thank you!!

@dimasmpp130

if you use it to change the group profile then target: group jid is what you want to change, whereas if you want to use it for the bot number itself, delete target:

Salientekill commented 1 month ago

I have a solution to use the feature from sock.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' }) , maybe in the current baileys version it doesn't work due to an error with the system code "408 error timeout"

You can use it with your eval bot for the case version, please tinker with it yourself. I'm just sharing, here is an example of the code I use:

const { S_WHATSAPP_NET } = require("@whiskeysockets/baileys");

const buffer = await mastahyabang.downloadAndSaveMediaMessage(quoted) var { img } = await generateProfilePicture(buffer) await mastahyabang.query({ tag: 'iq', attrs: { // target: '0', to: S_WHATSAPP_NET, type: 'set', xmlns: 'w:profile:picture' }, content: [ { tag: 'picture', attrs: { type: 'image' }, content: img } ] }) fs.unlinkSync(buffer) mek.reply(Sukses)

Note: if there is a sign like "//" don't delete it, for example if you delete the code it won't work and for the "generateProfilePicture" code it's just the default function code from my bot, not from baileys directly

This code works on the previous and latest versions of Baileys, please try the code if it works for you. I have tested it myself and the results work well without errors, thank you!!

Error: No image processing library available

viniciuscenci commented 4 weeks ago

I have a solution to use the feature from sock.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' }) , maybe in the current baileys version it doesn't work due to an error with the system code "408 error timeout" You can use it with your eval bot for the case version, please tinker with it yourself. I'm just sharing, here is an example of the code I use: const { S_WHATSAPP_NET } = require("@whiskeysockets/baileys"); const buffer = await mastahyabang.downloadAndSaveMediaMessage(quoted) var { img } = await generateProfilePicture(buffer) await mastahyabang.query({ tag: 'iq', attrs: { // target: '0', to: S_WHATSAPP_NET, type: 'set', xmlns: 'w:profile:picture' }, content: [ { tag: 'picture', attrs: { type: 'image' }, content: img } ] }) fs.unlinkSync(buffer) mek.reply(Sukses) Note: if there is a sign like "//" don't delete it, for example if you delete the code it won't work and for the "generateProfilePicture" code it's just the default function code from my bot, not from baileys directly This code works on the previous and latest versions of Baileys, please try the code if it works for you. I have tested it myself and the results work well without errors, thank you!!

Error: No image processing library available

npm i sharp

Riders004 commented 2 weeks ago

I have a solution to use the feature from sock.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' }) , maybe in the current baileys version it doesn't work due to an error with the system code "408 error timeout" You can use it with your eval bot for the case version, please tinker with it yourself. I'm just sharing, here is an example of the code I use: const { S_WHATSAPP_NET } = require("@whiskeysockets/baileys"); const buffer = await mastahyabang.downloadAndSaveMediaMessage(quoted) var { img } = await generateProfilePicture(buffer) await mastahyabang.query({ tag: 'iq', attrs: { // target: '0', to: S_WHATSAPP_NET, type: 'set', xmlns: 'w:profile:picture' }, content: [ { tag: 'picture', attrs: { type: 'image' }, content: img } ] }) fs.unlinkSync(buffer) mek.reply(Sukses) Note: if there is a sign like "//" don't delete it, for example if you delete the code it won't work and for the "generateProfilePicture" code it's just the default function code from my bot, not from baileys directly This code works on the previous and latest versions of Baileys, please try the code if it works for you. I have tested it myself and the results work well without errors, thank you!!

@dimasmpp130

if you use it to change the group profile then target: group jid is what you want to change, whereas if you want to use it for the bot number itself, delete target:

I'll got it