Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ramdombot #12803

Open
Open
Ramdombot #12803
Labels
awaiting triageAwaiting triage from a maintainer
@pipineitor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting triageAwaiting triage from a maintainer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /