Spaces:
Paused
Paused
πππππππ πππππππ β‘
commited on
Update dl-mediafire.js
Browse files- plugins/dl-mediafire.js +21 -12
plugins/dl-mediafire.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
| 1 |
const config = require('../config');
|
| 2 |
const { cmd, commands } = require('../command');
|
| 3 |
const { fetchJson } = require('../lib/functions');
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
cmd({
|
| 8 |
-
pattern: '
|
| 9 |
desc: 'Download MediaFire files',
|
| 10 |
category: 'download',
|
| 11 |
filename: __filename
|
|
@@ -41,19 +44,25 @@ cmd({
|
|
| 41 |
|
| 42 |
const apiUrl = `https://api.davidcyriltech.my.id/mediafire?url=${encodeURIComponent(text)}`;
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
}
|
| 58 |
} catch (error) {
|
| 59 |
console.error('Error during MediaFire command:', error);
|
|
|
|
| 1 |
const config = require('../config');
|
| 2 |
const { cmd, commands } = require('../command');
|
| 3 |
const { fetchJson } = require('../lib/functions');
|
| 4 |
+
const axios = require("axios");
|
| 5 |
+
|
| 6 |
+
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
cmd({
|
| 11 |
+
pattern: 'mediafirepro',
|
| 12 |
desc: 'Download MediaFire files',
|
| 13 |
category: 'download',
|
| 14 |
filename: __filename
|
|
|
|
| 44 |
|
| 45 |
const apiUrl = `https://api.davidcyriltech.my.id/mediafire?url=${encodeURIComponent(text)}`;
|
| 46 |
|
| 47 |
+
try {
|
| 48 |
+
const apiResponse = await axios.get(apiUrl);
|
| 49 |
+
console.log('API response:', apiResponse);
|
| 50 |
|
| 51 |
+
if (apiResponse.data && apiResponse.data.downloadLink) {
|
| 52 |
+
const { fileName, mimeType, downloadLink } = apiResponse.data;
|
| 53 |
|
| 54 |
+
await conn.sendMessage(m.chat, {
|
| 55 |
+
document: { url: downloadLink },
|
| 56 |
+
mimetype: mimeType,
|
| 57 |
+
fileName: fileName,
|
| 58 |
+
caption: `π¦ *File Name:* ${fileName}\n\n> α΄α΄α΄‘α΄Κα΄α΄
ΚΚ α΄
α΄α΄ Ιͺα΄
α΄ΚΚΙͺΚ α΄α΄α΄Κ`
|
| 59 |
+
}, { quoted: m });
|
| 60 |
+
} else {
|
| 61 |
+
reply(`*Failed to fetch file details! Please check the MediaFire URL and try again.*`);
|
| 62 |
+
}
|
| 63 |
+
} catch (error) {
|
| 64 |
+
console.error('Error fetching API response:', error);
|
| 65 |
+
reply(`*Error fetching API response: ${error.message}*`);
|
| 66 |
}
|
| 67 |
} catch (error) {
|
| 68 |
console.error('Error during MediaFire command:', error);
|