Skip to content

Instantly share code, notes, and snippets.

@mistershubhamkumar
Forked from Corex24/cplay.js
Created August 23, 2025 14:39
Show Gist options
  • Select an option

  • Save mistershubhamkumar/88630a1fa2d76c6d19a82ba84ad72e08 to your computer and use it in GitHub Desktop.

Select an option

Save mistershubhamkumar/88630a1fa2d76c6d19a82ba84ad72e08 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 ๐Ÿ’™
//Create by Corex wuth ๐Ÿ’™
//github.com/Corex24
//t.me/corex2410
const { bot } = require('../lib/')
const fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args))
bot(
{
pattern: 'cplay ?(.*)',
type: 'music',
desc: 'Play a song from a search term',
},
async (message, match) => {
if (!match) return await message.send('โŒ Please enter a song name.\nExample: .cplay arike by kunmie')
const api = `https://apis.davidcyriltech.my.id/play?query=${encodeURIComponent(match)}`
try {
// Fetch data from the API
const res = await fetch(api)
const data = await res.json()
// download_url for David Cyril
if (data.status && data.result && data.result.download_url) {
// Send audio file
await message.sendFromUrl(data.result.download_url, { mimetype: 'audio/mp4', ptt: false }, 'audio')
const caption = `๐ŸŽถ *${data.result.title || 'Unknown'}*\n๐Ÿ“บ *Views:* ${data.result.views || '-'}\nโฑ *Duration:* ${data.result.duration || '-'}\n๐Ÿ“… *Published:* ${data.result.published || '-'}\n๐Ÿ“Ž *URL:* ${data.result.video_url || '-'}\n\n_Made by Corex with ๐Ÿ’™_`
await message.send(caption)
} else {
await message.send('โŒ No song found for your query.')
}
} catch (e) {
// crazy shi
console.error(e)
await message.send('โŒ An error occurred while processing your request.')
}
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment