yt-dlp support

This commit is contained in:
synt-xerror
2026-03-12 01:22:29 -03:00
parent b96332e618
commit 240c392fad
5435 changed files with 991931 additions and 137 deletions

36
get_id.js Normal file
View File

@@ -0,0 +1,36 @@
// main.js
import pkg from 'whatsapp-web.js';
const { Client, LocalAuth } = pkg;
import qrcode from 'qrcode-terminal';
const CLIENT_ID = "bot_permanente"; // sempre o mesmo
const client = new Client({
authStrategy: new LocalAuth({ clientId: CLIENT_ID }),
puppeteer: { headless: true }
});
client.on('qr', qr => {
console.log("[BOT] QR Code gerado. Escaneie apenas uma vez:");
qrcode.generate(qr, { small: true });
});
client.on('ready', () => console.log("[BOT] WhatsApp conectado e sessão permanente"));
client.on('message_create', async msg => {
try {
const chat = await msg.getChat(); // pega o chat uma única vez
console.log("==================================");
console.log(`CHAT NAME : ${chat.name || chat.id.user || "Sem nome"}`);
console.log(`CHAT ID : ${chat.id._serialized}`);
console.log(`FROM : ${msg.from}`);
console.log(`BODY : ${msg.body}`);
console.log("==================================\n");
} catch (err) {
console.error("[ERRO]", err);
}
});
client.initialize();