UNPKG

zimbot-v4

Version:

Multi device wa bot created by Zim Bot Inc.

27 lines (25 loc) • 824 B
import { youtubeSearch } from '@bochilteam/scraper' let handler = async (m, { text }) => { if (!text) throw 'What are you looking for?' const { video, channel } = await youtubeSearch(text) let teks = [...video, ...channel].map(v => { switch (v.type) { case 'video': return ` šŸ“Œ *${v.title}* (${v.url}) ⌚ Duration: ${v.durationH} ā²ļø Uploaded ${v.publishedTime} šŸ‘ļø ${v.view} views `.trim() case 'channel': return ` šŸ“Œ *${v.channelName}* (${v.url}) šŸ§‘ā€šŸ¤ā€šŸ§‘ _${v.subscriberH} (${v.subscriber}) Subscriber_ šŸŽ„ ${v.videoCount} video `.trim() } }).filter(v => v).join('\n\n========================\n\n') m.reply(teks) } handler.help = ['', 'earch'].map(v => 'yts' + v + ' <SEARCH>') handler.tags = ['tools'] handler.command = /^yts(earch)?$/i export default handler