Spaces:
Paused
Paused
๐๐๐๐๐๐๐ ๐๐๐๐๐๐๐ โก
commited on
Create dl-mediafire.js
Browse files- plugins/dl-mediafire.js +63 -0
plugins/dl-mediafire.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const config = require('../config');
|
| 2 |
+
const { cmd, commands } = require('../command');
|
| 3 |
+
const { fetchJson } = require('../lib/functions');
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
cmd({
|
| 9 |
+
pattern: 'mediafirepro',
|
| 10 |
+
desc: 'Download MediaFire files',
|
| 11 |
+
category: 'download',
|
| 12 |
+
filename: __filename
|
| 13 |
+
}, async (conn, mek, m, {
|
| 14 |
+
text,
|
| 15 |
+
from,
|
| 16 |
+
quoted,
|
| 17 |
+
body,
|
| 18 |
+
isCmd,
|
| 19 |
+
command,
|
| 20 |
+
args,
|
| 21 |
+
q,
|
| 22 |
+
isGroup,
|
| 23 |
+
sender,
|
| 24 |
+
senderNumber,
|
| 25 |
+
botNumber2,
|
| 26 |
+
botNumber,
|
| 27 |
+
pushname,
|
| 28 |
+
isMe,
|
| 29 |
+
isOwner,
|
| 30 |
+
groupMetadata,
|
| 31 |
+
groupName,
|
| 32 |
+
participants,
|
| 33 |
+
groupAdmins,
|
| 34 |
+
isBotAdmins,
|
| 35 |
+
isAdmins,
|
| 36 |
+
reply
|
| 37 |
+
}) => {
|
| 38 |
+
try {
|
| 39 |
+
if (!text) return reply(`*Example*: ${command} https://www.mediafire.com/file/n6tgcrktbnov1oy/Queen_Anita-V4.zip/file`);
|
| 40 |
+
|
| 41 |
+
await reply('> *Processing...*');
|
| 42 |
+
|
| 43 |
+
const apiUrl = `https://api.davidcyriltech.my.id/mediafire?url=${encodeURIComponent(text)}`;
|
| 44 |
+
|
| 45 |
+
const apiResponse = await axios.get(apiUrl);
|
| 46 |
+
|
| 47 |
+
if (apiResponse.data && apiResponse.data.downloadLink) {
|
| 48 |
+
const { fileName, mimeType, downloadLink } = apiResponse.data;
|
| 49 |
+
|
| 50 |
+
await conn.sendMessage(m.chat, {
|
| 51 |
+
document: { url: downloadLink },
|
| 52 |
+
mimetype: mimeType,
|
| 53 |
+
fileName: fileName,
|
| 54 |
+
caption: `๐ฆ *File Name:* ${fileName}\n\n> แดแดแดกแดสแดแด
สส แดส าสแดษดแด แดาแด`
|
| 55 |
+
}, { quoted: m });
|
| 56 |
+
} else {
|
| 57 |
+
reply(`*Failed to fetch file details! Please check the MediaFire URL and try again.*`);
|
| 58 |
+
}
|
| 59 |
+
} catch (error) {
|
| 60 |
+
console.error('Error during MediaFire command:', error);
|
| 61 |
+
reply(`*An error occurred while processing your request. Please try again later.*`);
|
| 62 |
+
}
|
| 63 |
+
});
|