forked from xIKRATOSx/Shizu-Bot-MD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdownloader-play.js
48 lines (48 loc) Β· 3.06 KB
/
downloader-play.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { youtubeSearch } from '@bochilteam/scraper'
import fetch from 'node-fetch'
let handler = async (m, { conn, command, text, usedPrefix }) => {
if (!text) throw `*[βπππ
πβ] π½πΎπΌπ±ππ΄ π³π΄ π»π° π²π°π½π²πΈπΎπ½ π΅π°π»ππ°π½ππ΄, πΏπΎπ π΅π°π
πΎπ πΈπ½πΆππ΄ππ΄ π΄π» π²πΎπΌπ°π½π³πΎ πΌπ°π π΄π» π½πΎπΌπ±ππ΄/ππΈπππ»πΎ π³π΄ ππ½π° π²π°π½π²πΈπΎπ½*\n\n*ββ π΄πΉπ΄πΌπΏπ»πΎ:*\n*${usedPrefix + command} Good Feeling - Flo Rida*`
let vid = (await youtubeSearch(text)).video[0]
if (!vid) throw '*[βπππ
πβ] π»πΎ ππΈπ΄π½ππΎ, π½πΎ πΏππ³π΄ π΄π½π²πΎπ½πππ°π π΄π» π°ππ³πΈπΎ/π
πΈπ³π΄πΎ, πΈπ½ππ΄π½ππ΄ π²πΎπ½ πΎπππΎ π½πΎπΌπ±ππ΄/ππΈπππ»πΎ*'
try {
let { title, description, thumbnail, videoId, durationH, viewH, publishedTime } = vid
const url = 'https://www.youtube.com/watch?v=' + videoId
var doc = ['pdf','zip','vnd.openxmlformats-officedocument.presentationml.presentation','vnd.openxmlformats-officedocument.spreadsheetml.sheet','vnd.openxmlformats-officedocument.wordprocessingml.document']
var document = doc[Math.floor(Math.random() * doc.length)]
const buttons = [
{ buttonId: `#ytmp3 ${url}`, buttonText: { displayText: 'π΅ πππππ π΅' }, type: 1 },
{ buttonId: `#ytmp4 ${url}`, buttonText: { displayText: 'π₯ πππππ π₯' }, type: 1 },
{ buttonId: `#playlist ${text}`, buttonText: { displayText: 'π πππ ππππππππππ π' }, type: 1 }, ]
let texto1 = `*βββπ πππππππ ππππ πβββ*\n
β π *ππΈπππ»πΎ:* ${title}
β π *πΏππ±π»πΈπ²π°π³πΎ:* ${publishedTime}
β β *π³πππ°π²πΈπΎπ½:* ${durationH}
β π *π
πΈπππ°π:* ${viewH}
β π *π³π΄ππ²ππΈπΏπ²πΈπΎπ½:* ${description}`.trim()
let buttonMessage = {
"document": { url: "https://wa.me/34623442554" },
"fileName": 'β πΏ Κα΄α΄Κα΄α΄
α΄α΄α΄α΄Κ α΄
α΄ Κα΄α΄α΄α΄Κα΄',
"mimetype": 'application/vnd.ms-excel',
"caption": texto1,
"fileLength": '99999999999999',
"mentions": [m.sender],
"footer": wm,
"buttons": buttons,
"headerType": 4,
contextInfo: {
"mentionedJid": [m.sender],
"externalAdReply": {
"showAdAttribution": true,
"title": `${title}`,
"mediaType": 2,
"previewType": "VIDEO",
"thumbnail": await (await fetch(thumbnail)).buffer(),
"mediaUrl": `${url}`,
"sourceUrl": `https://github.com/Shizu-Hub/Shizu-Bot-MD` }}}
conn.sendMessage(m.chat, buttonMessage, { quoted: m })
} catch {
m.reply('*[βπππ
πβ] π΄πππΎπ, πΏπΎπ π΅π°π
πΎπ π
ππ΄π»π
π° π° πΈπ½ππ΄π½ππ°ππ»πΎ*')}}
handler.help = ['play', 'play2'].map(v => v + ' <pencarian>')
handler.tags = ['downloader']
handler.command = /^play2?$/i
export default handler