Description
What would you like to share?
pkg update && pkg upgrade
pkg install nodejs git ffmpeg
npm install -g ytdl-core yt-dlp
git clone https://github.com/tu-repositorio/bot-whatsapp
cd bot-whatsapp
npm install
const { default: makeWASocket } = require('@adiwajshing/baileys');
const ytdl = require('yt-dlp');
const sock = makeWASocket({});
sock.ev.on('messages.upsert', async ({ messages }) => {
const msg = messages[0];
if (msg.message && msg.message.conversation.startsWith('!descargar')) {
let url = msg.message.conversation.split(' ')[1];
let file = ./canciones/${Date.now()}.mp3
;
await ytdl(url, { format: 'bestaudio', output: file });
await sock.sendMessage(msg.key.remoteJid, { document: { url: file }, mimetype: 'audio/mp3' });
}
});
const { default: makeWASocket } = require('@adiwajshing/baileys');
const ytdl = require('yt-dlp');
const ffmpeg = require('fluent-ffmpeg');
const axios = require('axios');
const sharp = require('sharp');
const fs = require('fs');
const sock = makeWASocket({});
sock.ev.on('messages.upsert', async ({ messages }) => {
const msg = messages[0];
const chatId = msg.key.remoteJid;
if (!msg.message) return;
const text = msg.message.conversation || '';
// 🔹 Descarga de canciones
if (text.startsWith('!descargar')) {
let url = text.split(' ')[1];
let file = `./canciones/${Date.now()}.mp3`;
await ytdl(url, { format: 'bestaudio', output: file });
await sock.sendMessage(chatId, { document: { url: file }, mimetype: 'audio/mp3' });
}
// 🔹 Generación de stickers
else if (text.startsWith('!sticker')) {
let imgPath = './temp/image.jpg';
let stickerPath = './temp/sticker.webp';
let media = msg.message.imageMessage;
fs.writeFileSync(imgPath, media.data);
await sharp(imgPath).resize(512, 512).toFormat('webp').toFile(stickerPath);
await sock.sendMessage(chatId, { sticker: { url: stickerPath } });
}
// 🔹 Text-to-Speech
else if (text.startsWith('!tts')) {
let speechFile = `./temp/${Date.now()}.mp3`;
let speechText = text.replace('!tts ', '');
await ffmpeg().input(`https://api.voicerss.org/?key=TU_API_KEY&hl=es-es&src=${encodeURI(speechText)}`)
.save(speechFile);
await sock.sendMessage(chatId, { audio: { url: speechFile }, mimetype: 'audio/mp3' });
}
// 🔹 Búsqueda de canciones por nombre
else if (text.startsWith('!buscar')) {
let query = text.replace('!buscar ', '');
let search = await axios.get(`https://www.googleapis
Additional information
No response