-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,36 @@ | ||
import Starlights from '@StarlightsTeam/Scraper' | ||
import fetch from 'node-fetch' | ||
import Starlights from '@StarlightsTeam/Scraper'; | ||
import fetch from 'node-fetch'; | ||
|
||
let handler = async (m, { conn, text }) => { | ||
if (!text) throw `🚩 Ingresa el enlace de algún Track, PlayList o Álbum de Spotify.`; | ||
let isSpotifyUrl = text.match(/^(https:\/\/open\.spotify\.com\/(album|track|playlist)\/[a-zA-Z0-9]+)/i); | ||
if (!isSpotifyUrl && !text) throw `🚩 Ingresa el enlace de algún Track, Playlist o Álbum de Spotify.` | ||
await m.react('🕓') | ||
if (!text) return conn.reply(m.chat, '🚩 Ingresa el enlace de algún Track, Playlist o Álbum de Spotify.', m); | ||
|
||
let isSpotifyUrl = text.match(/^(https:\/\/open\.spotify\.com\/(album|track|playlist)\/[a-zA-Z0-9]+)/i); | ||
if (!isSpotifyUrl) return conn.reply(m.chat, '🚩 Ingresa un enlace válido de Track, Playlist o Álbum de Spotify.', m); | ||
|
||
await m.react('🕓') | ||
try { | ||
let { title, artist, album, thumbnail, dl_url} = await Starlights.spotifydl(text) | ||
let img = await (await fetch(`${thumbnail}`)).buffer() | ||
let txt = `*乂 S P O T I F Y - D O W N L O A D*\n\n` | ||
txt += ` ✩ *Titulo* : ${title}\n` | ||
txt += ` ✩ *Album* : ${album}\n` | ||
txt += ` ✩ *Artista* :${artist}\n\n` | ||
txt += `*- ↻ Los audios se estan enviando espera un momento, soy lenta. . .*` | ||
await conn.sendFile(m.chat, img, 'thumbnail.jpg', txt, m) | ||
await conn.sendMessage(m.chat, { audio: { url: dl_url }, fileName: title + '.mp3', mimetype: 'audio/mp4' }, { quoted: m }) | ||
await m.react('✅') | ||
let { title, artist, album, thumbnail, dl_url } = await Starlights.spotifydl(text); | ||
let img = await (await fetch(thumbnail)).buffer(); | ||
|
||
let txt = `*乂 S P O T I F Y - D O W N L O A D*\n\n`; | ||
txt += ` ✩ *Título* : ${title}\n`; | ||
txt += ` ✩ *Álbum* : ${album}\n`; | ||
txt += ` ✩ *Artista* : ${artist}\n\n`; | ||
txt += `*- ↻ Los audios se están enviando, espera un momento. . .*`; | ||
|
||
await conn.sendFile(m.chat, img, 'thumbnail.jpg', txt, m); | ||
await conn.sendMessage(m.chat, { audio: { url: dl_url }, fileName: `${title}.mp3`, mimetype: 'audio/mp4' }, { quoted: m }); | ||
|
||
await m.react('✅'); | ||
} catch { | ||
await m.react('✖️') | ||
}} | ||
handler.help = ['spotifydl'] | ||
handler.tags = ['downloader'] | ||
handler.command = ['spotifydl'] | ||
//handler.limit = 1 | ||
handler.register = true | ||
export default handler | ||
await m.react('✖️'); | ||
} | ||
}; | ||
|
||
handler.help = ['spotifydl']; | ||
handler.tags = ['downloader']; | ||
handler.command = ['spotifydl']; | ||
// handler.limit = 1; // Si necesitas limitar el uso del comando | ||
handler.register = true; | ||
|
||
export default handler; |