Skip to content

Instantly share code, notes, and snippets.

@ishkumarr
Last active December 10, 2022 20:12
Show Gist options
  • Save ishkumarr/f04f966c8771f2dfffd1821d3d76051c to your computer and use it in GitHub Desktop.
Save ishkumarr/f04f966c8771f2dfffd1821d3d76051c to your computer and use it in GitHub Desktop.
const { Function, h2k, prefix, isPublic, runtime } = require('../lib')
const yts = require("yt-search")
Function({pattern: 'play ?(.*)', fromMe: isPublic, desc: 'Music search', type: 'search'}, async (message, match) => {
if (!match) return await message.reply('*Lord Arin wants you to specify a song name.*')
const videos = await yts(match)
const text = `
╭──────━•
│🎀 Title: ${videos.all[0].title}
│👁️Views : ${h2k(videos.all[0].views)}
│📛 Duration : ${runtime(videos.all[0].duration.seconds)}
│📅 Published : ${videos.all[0].ago}
│🧿 Channel : ${videos.all[0].author.name}
┗──────━•\n\n`
let buttons = [
{buttonId: `${prefix}song ${videos.all[0].url}`, buttonText: {displayText: '🎧 ᴀᴜᴅɪᴏ 🎧'}, type: 1},
{buttonId: `${prefix}video ${videos.all[0].url}`, buttonText: {displayText: '📽 ᴠɪᴅᴇᴏ 📽'}, type: 1},
]
const buttonMessage = {
image: {url: `${videos.all[0].image}` },
caption: text,
footer: `\n© Lord Arin 𝟏.𝟎 \n`,
buttons: buttons,
headerType: 1
}
await message.client.sendMessage(m.chat, buttonMessage)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment