zimbot-v4
Version:
Multi device wa bot created by Zim Bot Inc.
27 lines (25 loc) ⢠824 B
JavaScript
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