Skip to content

Commit

Permalink
Update api.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerita233 authored Nov 4, 2024
1 parent a9b3127 commit d8271b1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@ import axios from 'axios';
import moment from 'moment-timezone';

/* Para agregar mΓ‘s APIs asegurate de poner global.apiname = ['APIKey'] */ /* By Skid πŸ€‘ */
const ytdl = require('ytdl-core');

// Usa tu clave de API aquΓ­
const API_KEY = 'AIzaSyDiapwiIPcUZG4_7wB0sCY4r1Tfi3fX3EM';

async function playCommand(url, chat) {
if (!ytdl.validateURL(url)) {
return chat.reply('Por favor, proporciona un enlace vΓ‘lido de YouTube.');
}

const info = await ytdl.getInfo(url);
const audioStream = ytdl(url, { filter: 'audioonly' });

// Enviar el audio al chat
chat.sendMessage({ audio: audioStream, filename: `${info.videoDetails.title}.mp3` });
}
global.openai_key = 'sk-0';
/* ObtΓ©n tu API Key en este enlace: https://platform.openai.com/account/api-keys */

Expand Down

0 comments on commit d8271b1

Please sign in to comment.