zimbot-v4
Version:
Multi device wa bot created by Zim Bot Inc.
29 lines (25 loc) ⢠984 B
JavaScript
import { youtubeSearch } from '@bochilteam/scraper'
let handler = async (m, { conn, command, text, usedPrefix }) => {
if (!text) throw `Use example ${usedPrefix}${command} Minecraft`
let vid = (await youtubeSearch(text)).video[0]
if (!vid) throw 'Video/Audio Not found'
let { title, description, thumbnail, videoId, durationH, viewH, publishedTime } = vid
const url = 'https://www.youtube.com/watch?v=' + videoId
await conn.sendHydrated(m.chat, `
š *Title:* ${title}
š *Url:* ${url}
š¹ *Description:* ${description}
ā²ļø *Published:* ${publishedTime}
ā *Duration:* ${durationH}
šļø *Views:* ${viewH}
`.trim(), author, thumbnail, '', '', null, null, [
['Audio', `${usedPrefix}yta ${url} yes`],
['Video', `${usedPrefix}ytv ${url} yes`]
], m, { asLocation: 1 })
}
handler.help = ['play', 'play2'].map(v => v + ' <search>')
handler.tags = ['downloader']
handler.command = /^play2?$/i
handler.exp = 0
handler.limit = false
export default handler