Skip to content

Superchats #2839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
luccasmarra opened this issue Feb 10, 2025 · 1 comment
Open

Superchats #2839

luccasmarra opened this issue Feb 10, 2025 · 1 comment
Labels
needs triage Needs avaliation question Further information is requested

Comments

@luccasmarra
Copy link

await client.setPicture(phoneNumber, imagePath)

Keeps loading forever and not works.
fica somente lendo e não da resultado. A função não funciona.

Explicação
**Set Picture
Set image for profile or group

//number of chat, file local path
let response = await client.setPicture("5561981590153", "./image-profile.png")**

Codig:
_let result = await client.setPicture(phoneNumber, imagePath);

// Update Profile Photo
app.post(/${sessionName}/update-profile-photo, async (req, res) => {
const { phoneNumber, url } = req.body;

try {
    // Baixar a imagem da URL
    const response = await axios({ url, responseType: 'arraybuffer' });

    // Gerar um caminho absoluto para o arquivo
    const imagePath = path.resolve(__dirname, `profile-${Date.now()}.jpg`);

    // Salvar a imagem localmente
    fs.writeFileSync(imagePath, response.data);

    // Verificar se o arquivo foi salvo corretamente antes de enviar
    if (!fs.existsSync(imagePath)) {
        throw new Error('Arquivo não foi salvo corretamente.');
    }

    // Atualizar a foto de perfil
    let result = await client.setPicture(phoneNumber, imagePath);
    console.log(result);

    res.json(`Atualizada foto perfil da sessão ${sessionName}!`);

    // Remover o arquivo após o uso
    fs.unlinkSync(imagePath);
} catch (error) {
    console.error(`Erro ao atualizar foto perfil sessão ${sessionName}:`, error);
    res.status(500).json("Erro ao atualizar foto perfil sessão");
}

});

@luccasmarra luccasmarra added needs triage Needs avaliation question Further information is requested labels Feb 10, 2025
@9cb14c1ec0
Copy link
Contributor

9cb14c1ec0 commented Feb 11, 2025

client.setPicture is not a valid function. You can checkout out our actively maintained fork at venomlib/venom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Needs avaliation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants