let yts = require('yt-search') let handler = async (m, { text, reply }) => { if (!db.data.users[m.sender].daftar) return m.reply(message.register) if (!text) return reply('Cari apa?') let results = await yts(text) let teks = results.all.map(v => { switch (v.type) { case 'video': return ` *${v.title}* (${v.url}) Duration: ${v.timestamp} Uploaded ${v.ago} ${v.views} views `.trim() case 'channel': return ` *${v.name}* (${v.url}) _${v.subCountLabel} (${v.subCount}) Subscriber_ ${v.videoCount} video `.trim() } }).filter(v => v).join('\n========================\n') reply(teks) } handler.command = ['ytsearch', 'yts']; module.exports = handler