Spaces:
Paused
Paused
File size: 2,250 Bytes
8d8d92b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
/*╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺
⭐PROJECT NAME:
SUBZERO WHATSAPP MD BOT
⭐DEVELOPER
MR FRANK
⭐ MY TEAM
XERO CODERS
⭐ OUR WEBSITE
https://github.com/ZwSyntax/SUBZERO-MD
© TRY DECRYPTING IF YOU CAN⚠
╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺╺*/
const config = require('../config');
let fs = require('fs');
const { exec } = require('child_process');
const { cmd } = require('../command');
cmd({
pattern: "update",
react: "🔄",
desc: "Update folder from GitHub",
category: "system",
use: '.update',
filename: __filename
}, async (conn, mek, m, { from, reply }) => {
try {
const repoUrl = 'https://github.com/Kgtech-cmr/KERM_MD-V4.git'; // لینک مخزن گیتهاب
const targetFolder = 'plugins'; // پوشهای که باید بهروز شود
// بررسی وجود پوشه هدف
if (!fs.existsSync(targetFolder)) {
fs.mkdirSync(targetFolder); // ساخت پوشه در صورت عدم وجود
}
// تعیین دستور مناسب گیت
const gitCommand = fs.existsSync(`${targetFolder}/.git`)
? `git -C ${targetFolder} pull`
: `git clone ${repoUrl} ${targetFolder}`;
// اجرای دستور گیت
await new Promise((resolve, reject) => {
exec(gitCommand, (err, stdout, stderr) => {
if (err) {
reject(`Git command failed: ${stderr}`);
} else {
resolve(stdout);
}
});
});
// ارسال پیام موفقیت
await conn.sendMessage(from, { text: '*✅ Update completed successfully!*' }, { quoted: mek });
} catch (error) {
console.error(error);
reply(`*Error during update:* ${error.message}`);
}
});
|