Upload case.js
Browse files
case.js
CHANGED
|
@@ -940,6 +940,9 @@ module.exports = async (conn, dev, chatUpdate, store) => {
|
|
| 940 |
${readmore}
|
| 941 |
> βγ \`πππππ ππππ\` γ
|
| 942 |
> ${sign} update
|
|
|
|
|
|
|
|
|
|
| 943 |
> ββββββββββββββ
|
| 944 |
|
| 945 |
> βγ \`πππππ ππππ\` γ
|
|
@@ -998,27 +1001,114 @@ module.exports = async (conn, dev, chatUpdate, store) => {
|
|
| 998 |
await sleep(1500)
|
| 999 |
sendvn(dmusic)
|
| 1000 |
break;
|
| 1001 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1002 |
case 'update': {
|
| 1003 |
if (!isOwner) return reply(mess.only.owner);
|
| 1004 |
await loading();
|
|
|
|
| 1005 |
let fileUrl = 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js';
|
| 1006 |
let filePath = './message/case.js';
|
|
|
|
|
|
|
| 1007 |
try {
|
|
|
|
|
|
|
| 1008 |
let response = await fetch(fileUrl);
|
| 1009 |
-
if (!response.ok)
|
| 1010 |
-
|
| 1011 |
-
}
|
| 1012 |
let newContent = await response.text();
|
| 1013 |
-
const fs = require('fs');
|
| 1014 |
fs.writeFileSync(filePath, newContent, 'utf8');
|
| 1015 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1016 |
} catch (error) {
|
| 1017 |
console.error("Error updating case.js:", error);
|
| 1018 |
conn.sendMessage(m.chat, { text: "β An error occurred while updating the file. Please try again later." });
|
| 1019 |
}
|
| 1020 |
break;
|
| 1021 |
-
}
|
| 1022 |
case 'ping': {
|
| 1023 |
const startTime = performance.now();
|
| 1024 |
const initialMessage = await conn.sendMessage(m.chat, {
|
|
|
|
| 940 |
${readmore}
|
| 941 |
> βγ \`πππππ ππππ\` γ
|
| 942 |
> ${sign} update
|
| 943 |
+
> ${sign} addowner
|
| 944 |
+
> ${sign} delowner
|
| 945 |
+
> ${sign} listowner
|
| 946 |
> ββββββββββββββ
|
| 947 |
|
| 948 |
> βγ \`πππππ ππππ\` γ
|
|
|
|
| 1001 |
await sleep(1500)
|
| 1002 |
sendvn(dmusic)
|
| 1003 |
break;
|
| 1004 |
+
}
|
| 1005 |
+
case 'addowner': {
|
| 1006 |
+
if (!isOwner) return reply(mess.only.owner);
|
| 1007 |
+
|
| 1008 |
+
let newOwner;
|
| 1009 |
+
if (m.quoted) {
|
| 1010 |
+
newOwner = m.quoted.sender;
|
| 1011 |
+
} else if (mentionByTag.length) {
|
| 1012 |
+
newOwner = mentionByTag[0];
|
| 1013 |
+
} else if (q) {
|
| 1014 |
+
newOwner = q.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
|
| 1015 |
+
} else {
|
| 1016 |
+
return reply("Please tag, reply, or provide a number to add as an owner.");
|
| 1017 |
+
}
|
| 1018 |
+
|
| 1019 |
+
let ownerFile = './database/owner.json';
|
| 1020 |
+
let owners = fs.existsSync(ownerFile) ? JSON.parse(fs.readFileSync(ownerFile, 'utf8')) : [];
|
| 1021 |
+
|
| 1022 |
+
if (owners.includes(newOwner)) return reply("This number is already an owner.");
|
| 1023 |
+
|
| 1024 |
+
owners.push(newOwner);
|
| 1025 |
+
fs.writeFileSync(ownerFile, JSON.stringify(owners, null, 2));
|
| 1026 |
+
|
| 1027 |
+
conn.sendMessage(m.chat, {
|
| 1028 |
+
text: `β
Successfully added @${newOwner.replace('@s.whatsapp.net', '')} as an owner.`,
|
| 1029 |
+
mentions: [newOwner]
|
| 1030 |
+
});
|
| 1031 |
+
break;
|
| 1032 |
+
}
|
| 1033 |
+
|
| 1034 |
+
case 'delowner': {
|
| 1035 |
+
if (!isOwner) return reply(mess.only.owner);
|
| 1036 |
+
|
| 1037 |
+
let removeOwner;
|
| 1038 |
+
if (m.quoted) {
|
| 1039 |
+
removeOwner = m.quoted.sender;
|
| 1040 |
+
} else if (mentionByTag.length) {
|
| 1041 |
+
removeOwner = mentionByTag[0];
|
| 1042 |
+
} else if (q) {
|
| 1043 |
+
removeOwner = q.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
|
| 1044 |
+
} else {
|
| 1045 |
+
return reply("Please tag, reply, or provide a number to remove from owners.");
|
| 1046 |
+
}
|
| 1047 |
+
|
| 1048 |
+
let ownerFile = './database/owner.json';
|
| 1049 |
+
let owners = fs.existsSync(ownerFile) ? JSON.parse(fs.readFileSync(ownerFile, 'utf8')) : [];
|
| 1050 |
+
|
| 1051 |
+
if (!owners.includes(removeOwner)) return reply("This number is not an owner.");
|
| 1052 |
+
|
| 1053 |
+
owners = owners.filter(owner => owner !== removeOwner);
|
| 1054 |
+
fs.writeFileSync(ownerFile, JSON.stringify(owners, null, 2));
|
| 1055 |
+
|
| 1056 |
+
conn.sendMessage(m.chat, {
|
| 1057 |
+
text: `β
Successfully removed @${removeOwner.replace('@s.whatsapp.net', '')} from owners.`,
|
| 1058 |
+
mentions: [removeOwner]
|
| 1059 |
+
});
|
| 1060 |
+
break;
|
| 1061 |
+
}
|
| 1062 |
+
|
| 1063 |
+
case 'listowner': {
|
| 1064 |
+
if (!isOwner) return reply(mess.only.owner);
|
| 1065 |
+
try {
|
| 1066 |
+
let owners = JSON.parse(fs.readFileSync('./database/owner.json', 'utf8'));
|
| 1067 |
+
|
| 1068 |
+
if (owners.length === 0) return reply('*No owners found.*');
|
| 1069 |
+
|
| 1070 |
+
let ownerList = owners.map((owner, index) => `${index + 1}. @${owner.replace('@s.whatsapp.net', '')}`).join("\n");
|
| 1071 |
+
|
| 1072 |
+
conn.sendMessage(m.chat, {
|
| 1073 |
+
text: `π *Owner List:*\n\n${ownerList}`,
|
| 1074 |
+
mentions: owners
|
| 1075 |
+
});
|
| 1076 |
+
} catch (error) {
|
| 1077 |
+
console.error('Error reading owner file:', error);
|
| 1078 |
+
reply('Failed to retrieve owner list.');
|
| 1079 |
+
}
|
| 1080 |
+
break;
|
| 1081 |
+
}
|
| 1082 |
case 'update': {
|
| 1083 |
if (!isOwner) return reply(mess.only.owner);
|
| 1084 |
await loading();
|
| 1085 |
+
|
| 1086 |
let fileUrl = 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js';
|
| 1087 |
let filePath = './message/case.js';
|
| 1088 |
+
const fs = require('fs');
|
| 1089 |
+
|
| 1090 |
try {
|
| 1091 |
+
let oldSize = fs.existsSync(filePath) ? fs.statSync(filePath).size : 0;
|
| 1092 |
+
|
| 1093 |
let response = await fetch(fileUrl);
|
| 1094 |
+
if (!response.ok) return reply("β Failed to update bot.");
|
| 1095 |
+
|
|
|
|
| 1096 |
let newContent = await response.text();
|
|
|
|
| 1097 |
fs.writeFileSync(filePath, newContent, 'utf8');
|
| 1098 |
+
|
| 1099 |
+
let newSize = fs.statSync(filePath).size;
|
| 1100 |
+
let sizeDifference = ((newSize - oldSize) / 1024).toFixed(2);
|
| 1101 |
+
let updateMessage = sizeDifference > 0
|
| 1102 |
+
? `β
Bot updated successfully! ${sizeDifference}KB added.`
|
| 1103 |
+
: `β
Bot updated successfully! No size increase detected.`;
|
| 1104 |
+
|
| 1105 |
+
reply(updateMessage);
|
| 1106 |
} catch (error) {
|
| 1107 |
console.error("Error updating case.js:", error);
|
| 1108 |
conn.sendMessage(m.chat, { text: "β An error occurred while updating the file. Please try again later." });
|
| 1109 |
}
|
| 1110 |
break;
|
| 1111 |
+
}
|
| 1112 |
case 'ping': {
|
| 1113 |
const startTime = performance.now();
|
| 1114 |
const initialMessage = await conn.sendMessage(m.chat, {
|