Skip to content

Instantly share code, notes, and snippets.

@kajju027
Forked from mistershubhamkumar/cplay.js
Last active November 28, 2025 16:46
Show Gist options
  • Select an option

  • Save kajju027/95545169ed806585e13bb261a14a808d to your computer and use it in GitHub Desktop.

Select an option

Save kajju027/95545169ed806585e13bb261a14a808d to your computer and use it in GitHub Desktop.
๐ŸŽถ No description? ๐Ÿ˜… Ohkay ohkay... Fast response powered by David Cyrilโ€™s API โšก๏ธ โ€” Made by Corex with ๐Ÿ’™
// Created by Corex with ๐Ÿ’™
// github.com/Corex24
// t.me/corex2410
const { bot } = require('../lib/')
const fetch = (...args) =>
import('node-fetch').then(({ default: fetch }) => fetch(...args))
bot(
{
pattern: 's ?(.*)',
type: 'music',
desc: 'Play a song from a search term',
},
async (message, match) => {
// No input message
if (!match)
return await message.send(
'โŒ Please enter a song name.\n\nExample: *.sonu Kiyu Ra MC ๐Ÿฅน๐Ÿ‘€*'
)
const api = `https://apis.davidcyriltech.my.id/play?query=${encodeURIComponent(match)}`
try {
const res = await fetch(api)
const data = await res.json()
if (!data.status || !data.result || !data.result.download_url) {
return await message.send('โŒ No song found for your query.\n')
}
// ---------- STYLED CAPTION ----------
const caption =
`๐ŸŽง *TITLE:* _${data.result.title || 'Unknown'}_\n\n` +
`๐Ÿ‘‹ *TOTAL VIEW:* ${data.result.views || '-'}\n\n` +
`โณ *DURATION:* ${data.result.duration || '-'}\n\n` +
`๐Ÿง *PUBLISHED:* ${data.result.published || '-'}\n\n` +
`> *แŽฎแดแดกแด‡ส€แด‡แด… แดส ๊•ถแด€สแด€ษด แดแด€ษช ๐ŸŒ*`
// ---------- SEND THUMBNAIL ----------
if (data.result.thumbnail) {
await message.sendFromUrl(
data.result.thumbnail,
{ caption },
'image'
)
}
// ---------- SEND AUDIO ----------
await message.sendFromUrl(
data.result.download_url,
{ mimetype: 'audio/mp4', ptt: false },
'audio'
)
} catch (err) {
console.error(err)
await message.send(
'โŒ An unexpected error occurred while processing your request.\nPlease try again later.'
)
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment