𝐃𝐀𝐑𝐑𝐄𝐋𝐋 πŒπ”π‚π‡π„π‘πˆ ⚑ commited on
Commit
93e18e8
Β·
unverified Β·
1 Parent(s): 63fd395

Create update2.js

Browse files
Files changed (1) hide show
  1. plugins/update2.js +28 -0
plugins/update2.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ const config = require('../config');
3
+ const fs = require('fs');
4
+ const { execSync } = require('child_process');
5
+ const { cmd } = require('../command');
6
+
7
+ cmd({
8
+ pattern: "update",
9
+ react: "πŸ’–",
10
+ desc: "Update bot",
11
+ category: "system",
12
+ use: '.update',
13
+ filename: __filename
14
+ }, async (conn, mek, m, { from, reply }) => {
15
+ try {
16
+ await conn.sendMessage(from, { text: 'Please wait... Updating bot...' }, { quoted: mek });
17
+
18
+ const repoUrl = `https://github.com/mrfrank-ofc/SUBZERO-MD`;
19
+
20
+ console.log("Updating repository using rsync...");
21
+ execSync(`rsync -avz --delete --exclude=.git ${repoUrl}/ ./`);
22
+
23
+ await conn.sendMessage(from, { text: '*βœ… Bot updated successfully!*' }, { quoted: mek });
24
+ } catch (error) {
25
+ console.error(error);
26
+ reply(`*Error during update:* ${error.message}`);
27
+ }
28
+ });