Well, I'm trying to make a system that makes stickers for the user, when I send a photo it works normally, I send a video it works normally, but if I try the video again, it simply stops working.
Expected behavior
make the sticker normally, whether video or photo, photos work normally, while video always breaks the code. I am using the DownloadMedia() function. It works really well, but when I send two videos, one works, the rest make downloadMedia undefined.
Videos:
first attempt (bot has just been turned on)
in the console, it normally returns the base64 of the video.
second attempt
now, in the console it returns undefined.
Images:
first attempt
second attempt
Ok, I think you already understand.
Steps to Reproduce the Bug or Issue
.
Relevant Code
Archive Sticker.js
const Command = require('../../config/Command');
module.exports = class StickerCommand extends Command {
constructor(zap) {
super(zap, {
name: 'sticker',
aliases: ['figurinha', 's', 'fig'],
category: 'utils',
description: 'Deixe-me fazer um sticker com alguma foto/gif/vídeo que tu me mandar! (Às vezes pode bugar!)',
example: 'sticker <arquivo>',
groupOnly: false,
groupAdmPermission: {
bot: false,
user: false,
},
ownerOnly: false,
isWorking: true,
});
}
async execute({ msg, prefix }) {
try {
const quotedMsg = await msg.getQuotedMessage();
const mediaQuoted = quotedMsg && quotedMsg.hasMedia ? await quotedMsg.downloadMedia() : null;
const media = msg.hasMedia ? await msg.downloadMedia() : null;
if (!media && !mediaQuoted) {
return await msg.send(`Oops, mencione ou mande a imagem/gif/vídeo que tu quer e escreva no texto "${prefix}s"`, { reply: true });
}
await msg.send('Seu sticker está a caminho!!!', { reply: true });
if (media) {
try {
await msg.sendSticker(media);
} catch (error) {
console.log(error);
}
}
if (mediaQuoted) {
try {
await msg.sendSticker(mediaQuoted);
} catch (error) {
console.log(error);
}
}
} catch (err) {
await msg.zapFail(err);
}
}
};
Archive message.js (msg.sendSticker function)
msg.sendSticker = async (sticker) => {
const errortext = 'Não foi possível transformar o arquivo em um sticker. Se por acaso você estiver enviando um vídeo, na hora de enviar selecione a opção "gif".\nhttps://is.gd/aJNpv7';
try {
await zap.atizap.sendMessage(msg.from, sticker, { sendMediaAsSticker: true, stickerAuthor: '*************', stickerName: 'Skye! ❤' })
.catch(e => {
msg.zapFail(errortext + '\n\n' + e)
msg.react("❎")
}
);
msg.react("✅")
} catch (error) {
msg.zapFail('Erro ao processar o sticker: ' + error);
}
};
Browser Type
Google Chrome
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS: Windows 10
Phone OS: Android
whatsapp-web.js version: 1.23.0
WhatsApp Web version 2.2353.59
Node.js Version v21.4.0
Is there an existing issue for this?
Describe the bug
Well, I'm trying to make a system that makes stickers for the user, when I send a photo it works normally, I send a video it works normally, but if I try the video again, it simply stops working.
Expected behavior
make the sticker normally, whether video or photo, photos work normally, while video always breaks the code. I am using the DownloadMedia() function. It works really well, but when I send two videos, one works, the rest make downloadMedia undefined.
Videos:
first attempt (bot has just been turned on)
in the console, it normally returns the base64 of the video.
second attempt
now, in the console it returns undefined.
Images:
first attempt![image](https://github.com/pedroslopez/whatsapp-web.js/assets/68620332/41529abc-0c3a-41b5-849c-b36382d725d7)
second attempt![image](https://github.com/pedroslopez/whatsapp-web.js/assets/68620332/f0a7bff9-5f82-4b6f-b0ff-716db60da744)
Ok, I think you already understand.
Steps to Reproduce the Bug or Issue
.
Relevant Code
Archive Sticker.js
Archive message.js (msg.sendSticker function)
Browser Type
Google Chrome
WhatsApp Account Type
WhatsApp Business
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi Device
Environment
OS: Windows 10 Phone OS: Android whatsapp-web.js version: 1.23.0 WhatsApp Web version 2.2353.59 Node.js Version v21.4.0
Additional context
No response