-
-
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 ๐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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