Skip to content

Instantly share code, notes, and snippets.

@Corex24
Last active November 3, 2025 23:02
Show Gist options
  • Select an option

  • Save Corex24/7884863f7a625d2c7dacca3799698fc3 to your computer and use it in GitHub Desktop.

Select an option

Save Corex24/7884863f7a625d2c7dacca3799698fc3 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: 'cplay ?(.*)',
type: 'music',
desc: 'Play a song from YouTube by search term',
},
async (message, match) => {
if (!match)
return await message.send('โŒ Please enter a song name.\nExample: `.cplay faded`')
const api = `https://apis.davidcyriltech.my.id/play?query=${encodeURIComponent(match)}`
try {
const res = await fetch(api)
const text = await res.text()
let data
// Safely parse JSON
try {
data = JSON.parse(text)
} catch {
console.error('โŒ JSON Parse Error:', text)
return await message.send('โŒ Failed to read API response. Try again later.')
}
// Check structure
if (data?.status === true && data?.result?.download_url) {
const song = data.result
// Send audio file
await message.sendFromUrl(song.download_url, { mimetype: 'audio/mp4', ptt: false }, 'audio')
// Song caption
const caption = `๐ŸŽถ *${song.title || 'Unknown'}*\n๐Ÿ“บ *Views:* ${song.views || '-'}\nโฑ *Duration:* ${song.duration || '-'}\n๐Ÿ“… *Published:* ${song.published || '-'}\n๐Ÿ“Ž *URL:* ${song.video_url || '-'}\n\n_Made by Corex with ๐Ÿ’™_`
await message.send(caption)
} else {
console.log('โš ๏ธ Unexpected API data:', data)
await message.send('โŒ No song found for your query.')
}
} catch (e) {
console.error('CPLAY ERROR:', e)
await message.send('โŒ An error occurred while processing your request.')
}
}
)
@Allenbizz
Copy link

๐—•๐—ฟ๐—ผ ๐—ฐ๐—ฎ๐—ป ๐˜†๐—ผ๐˜‚ ๐—บ๐—ฎ๐—ธ๐—ฒ ๐—Ÿ๐—ถ๐˜ƒ๐—ฒ๐˜€๐—ฐ๐—ผ๐—ฟ๐—ฒ ๐—ฝ๐—น๐˜‚๐—ด๐—ถ๐—ป ๐—ณ๐—ผ๐—ฟ ๐—ณ๐—ผ๐—ผ๐˜๐—ฏ๐—ฎ๐—น๐—น ๐—น๐—ถ๐˜ƒ๐—ฒ๐˜€๐—ฐ๐—ผ๐—ฟ๐—ฒ ๐—ฟ๐—ฒ๐˜€๐˜‚๐—น๐˜๐˜€. ๐—Ÿ๐—ถ๐—ธ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—ฝ๐—ฟ๐—ฒ๐—บ๐—ถ๐—ฒ๐—ฟ ๐—น๐—ฒ๐—ฎ๐—ด๐˜‚๐—ฒ, ๐—น๐—ฎ๐—น๐—ถ๐—ด๐—ฎ ๐—ฎ๐—ป๐—ฑ ๐—ฐ๐—ต๐—ฎ๐—บ๐—ฝ๐—ถ๐—ผ๐—ป๐˜€ ๐—น๐—ฒ๐—ฎ๐—ด๐˜‚๐—ฒ

@Allenbizz
Copy link

https://gist.github.com/Corex24/7884863f7a625d2c7dacca3799698fc3

๐—•๐—ฟ๐—ผ ๐—ฐ๐—ฎ๐—ป ๐˜†๐—ผ๐˜‚ ๐—บ๐—ฎ๐—ธ๐—ฒ ๐—Ÿ๐—ถ๐˜ƒ๐—ฒ๐˜€๐—ฐ๐—ผ๐—ฟ๐—ฒ ๐—ฝ๐—น๐˜‚๐—ด๐—ถ๐—ป ๐—ณ๐—ผ๐—ฟ ๐—ณ๐—ผ๐—ผ๐˜๐—ฏ๐—ฎ๐—น๐—น ๐—น๐—ถ๐˜ƒ๐—ฒ๐˜€๐—ฐ๐—ผ๐—ฟ๐—ฒ ๐—ฟ๐—ฒ๐˜€๐˜‚๐—น๐˜๐˜€. ๐—Ÿ๐—ถ๐—ธ๐—ฒ ๐—ณ๐—ผ๐—ฟ ๐—ฝ๐—ฟ๐—ฒ๐—บ๐—ถ๐—ฒ๐—ฟ ๐—น๐—ฒ๐—ฎ๐—ด๐˜‚๐—ฒ, ๐—น๐—ฎ๐—น๐—ถ๐—ด๐—ฎ ๐—ฎ๐—ป๐—ฑ ๐—ฐ๐—ต๐—ฎ๐—บ๐—ฝ๐—ถ๐—ผ๐—ป๐˜€ ๐—น๐—ฒ๐—ฎ๐—ด๐˜‚๐—ฒ

@Corex24
Copy link
Author

Corex24 commented Nov 3, 2025

Hiii

Hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment