Upload case.js
Browse files
case.js
CHANGED
@@ -889,7 +889,7 @@ module.exports = async (conn, dev, chatUpdate, store) => {
|
|
889 |
try {
|
890 |
switch (command) {
|
891 |
case 'menu':
|
892 |
-
case '
|
893 |
await loading();
|
894 |
const randomImage = images[Math.floor(Math.random() * images.length)];
|
895 |
|
@@ -952,6 +952,7 @@ module.exports = async (conn, dev, chatUpdate, store) => {
|
|
952 |
> ${sign} ${prefix}antivirtex
|
953 |
> ${sign} ${prefix}promote
|
954 |
> ${sign} ${prefix}demote
|
|
|
955 |
> ${sign} ${prefix}opentime
|
956 |
> ${sign} ${prefix}closetime
|
957 |
> ${sign} ${prefix}tagadmin
|
@@ -1147,149 +1148,113 @@ module.exports = async (conn, dev, chatUpdate, store) => {
|
|
1147 |
}
|
1148 |
break;
|
1149 |
}
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js',
|
1161 |
-
path: './temp/media/links.js',
|
1162 |
-
name: 'links.js'
|
1163 |
-
},
|
1164 |
-
{
|
1165 |
-
url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/group.js',
|
1166 |
-
path: './message/group.js',
|
1167 |
-
name: 'group.js'
|
1168 |
-
},
|
1169 |
-
{
|
1170 |
-
url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/message.js',
|
1171 |
-
path: './message/message.js',
|
1172 |
-
name: 'message.js'
|
1173 |
-
},
|
1174 |
-
];
|
1175 |
|
1176 |
-
|
1177 |
-
|
|
|
1178 |
|
1179 |
-
|
1180 |
-
|
1181 |
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
|
1196 |
-
|
1197 |
-
|
1198 |
|
1199 |
-
|
1200 |
-
|
|
|
|
|
|
|
|
|
1201 |
|
1202 |
-
|
1203 |
-
sizeDifference > 0 ?
|
1204 |
-
`π *${file.name}* has an update available! (+${sizeDifference}KB)` :
|
1205 |
-
`β
*${file.name}* is up to date.`
|
1206 |
-
);
|
1207 |
-
}
|
1208 |
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
if (!isOwner) return reply(mess.only.owner);
|
1220 |
-
await loading();
|
1221 |
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js',
|
1229 |
-
path: './temp/media/links.js',
|
1230 |
-
name: 'links.js'
|
1231 |
-
},
|
1232 |
-
{
|
1233 |
-
url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/group.js',
|
1234 |
-
path: './message/group.js',
|
1235 |
-
name: 'group.js'
|
1236 |
-
},
|
1237 |
-
{
|
1238 |
-
url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/message.js',
|
1239 |
-
path: './message/message.js',
|
1240 |
-
name: 'message.js'
|
1241 |
-
},
|
1242 |
-
];
|
1243 |
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
|
1258 |
-
|
1259 |
-
|
1260 |
|
1261 |
-
|
1262 |
-
|
1263 |
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
|
1268 |
-
|
1269 |
-
|
1270 |
-
.map(c => c.replace("case '", "").replace("'", ""));
|
1271 |
-
}
|
1272 |
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
break;
|
1292 |
-
}
|
1293 |
case 'ping': {
|
1294 |
const startTime = performance.now();
|
1295 |
const initialMessage = await conn.sendMessage(m.chat, {
|
@@ -2125,6 +2090,22 @@ ${_meta.desc}`
|
|
2125 |
}
|
2126 |
break;
|
2127 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2128 |
case 'encrypt':
|
2129 |
case 'obfuscate':
|
2130 |
case 'hard-encrypt': {
|
|
|
889 |
try {
|
890 |
switch (command) {
|
891 |
case 'menu':
|
892 |
+
case 'hey-minorr': {
|
893 |
await loading();
|
894 |
const randomImage = images[Math.floor(Math.random() * images.length)];
|
895 |
|
|
|
952 |
> ${sign} ${prefix}antivirtex
|
953 |
> ${sign} ${prefix}promote
|
954 |
> ${sign} ${prefix}demote
|
955 |
+
> ${sign} ${prefix}welcome
|
956 |
> ${sign} ${prefix}opentime
|
957 |
> ${sign} ${prefix}closetime
|
958 |
> ${sign} ${prefix}tagadmin
|
|
|
1148 |
}
|
1149 |
break;
|
1150 |
}
|
1151 |
+
case 'checkupdate': {
|
1152 |
+
if (!isOwner) return reply(mess.only.owner);
|
1153 |
+
await loading();
|
1154 |
|
1155 |
+
let filesToCheck = [
|
1156 |
+
{ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js', path: './message/case.js', name: 'case.js' },
|
1157 |
+
{ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js', path: './temp/media/links.js', name: 'links.js' },
|
1158 |
+
{ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/group.js', path: './message/group.js', name: 'group.js' },
|
1159 |
+
{ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/message.js', path: './message/message.js', name: 'message.js' }
|
1160 |
+
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1161 |
|
1162 |
+
try {
|
1163 |
+
let updateMessages = [];
|
1164 |
+
let newCases = [];
|
1165 |
|
1166 |
+
for (let file of filesToCheck) {
|
1167 |
+
let oldSize = fs.existsSync(file.path) ? fs.statSync(file.path).size : 0;
|
1168 |
|
1169 |
+
let response = await fetch(file.url);
|
1170 |
+
if (!response.ok) {
|
1171 |
+
updateMessages.push(`β Could not check *${file.name}*.`);
|
1172 |
+
continue;
|
1173 |
+
}
|
1174 |
|
1175 |
+
let newContent = await response.text();
|
1176 |
+
let newSize = Buffer.byteLength(newContent, 'utf8');
|
1177 |
+
let sizeDifference = ((newSize - oldSize) / 1024).toFixed(2);
|
1178 |
|
1179 |
+
if (file.name === "case.js") {
|
1180 |
+
let oldCases = (fs.existsSync(file.path) ? fs.readFileSync(file.path, 'utf8') : "").match(/case\s+'([^']+)'/g) || [];
|
1181 |
+
let updatedCases = newContent.match(/case\s+'([^']+)'/g) || [];
|
1182 |
|
1183 |
+
newCases = updatedCases.filter(c => !oldCases.includes(c)).map(c => c.replace("case '", "").replace("'", ""));
|
1184 |
+
}
|
1185 |
|
1186 |
+
updateMessages.push(
|
1187 |
+
sizeDifference > 0 ?
|
1188 |
+
`π *${file.name}* has an update available! (+${sizeDifference}KB)` :
|
1189 |
+
`β
*${file.name}* is up to date.`
|
1190 |
+
);
|
1191 |
+
}
|
1192 |
|
1193 |
+
let newCasesText = newCases.length ? `π *New Cases Detected:*\n${newCases.join("\n")}` : "β
No new cases detected.";
|
|
|
|
|
|
|
|
|
|
|
1194 |
|
1195 |
+
reply(`*π Update Check Results:*\n${updateMessages.join("\n")}\n\n${newCasesText}`);
|
1196 |
+
} catch (error) {
|
1197 |
+
console.error("Error checking updates:", error);
|
1198 |
+
conn.sendMessage(m.chat, { text: "β Error while checking updates. Try again later." });
|
1199 |
+
}
|
1200 |
+
break;
|
1201 |
+
}
|
1202 |
+
case 'update': {
|
1203 |
+
if (!isOwner) return reply(mess.only.owner);
|
1204 |
+
await loading();
|
|
|
|
|
1205 |
|
1206 |
+
let filesToUpdate = [
|
1207 |
+
{ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js', path: './message/case.js', name: 'case.js' },
|
1208 |
+
{ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js', path: './temp/media/links.js', name: 'links.js' },
|
1209 |
+
{ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/group.js', path: './message/group.js', name: 'group.js' },
|
1210 |
+
{ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/message.js', path: './message/message.js', name: 'message.js' }
|
1211 |
+
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1212 |
|
1213 |
+
try {
|
1214 |
+
let updateMessages = [];
|
1215 |
+
let newCases = [];
|
1216 |
|
1217 |
+
for (let file of filesToUpdate) {
|
1218 |
+
let oldContent = fs.existsSync(file.path) ? fs.readFileSync(file.path, 'utf8') : "";
|
1219 |
+
let oldSize = Buffer.byteLength(oldContent, 'utf8');
|
1220 |
|
1221 |
+
let response = await fetch(file.url);
|
1222 |
+
if (!response.ok) {
|
1223 |
+
updateMessages.push(`β Failed to update *${file.name}*.`);
|
1224 |
+
continue;
|
1225 |
+
}
|
1226 |
|
1227 |
+
let newContent = await response.text();
|
1228 |
+
fs.writeFileSync(file.path, newContent, 'utf8');
|
1229 |
|
1230 |
+
let newSize = Buffer.byteLength(newContent, 'utf8');
|
1231 |
+
let sizeDifference = ((newSize - oldSize) / 1024).toFixed(2);
|
1232 |
|
1233 |
+
if (file.name === "case.js") {
|
1234 |
+
let oldCases = oldContent.match(/case\s+'([^']+)'/g) || [];
|
1235 |
+
let updatedCases = newContent.match(/case\s+'([^']+)'/g) || [];
|
1236 |
|
1237 |
+
newCases = updatedCases.filter(c => !oldCases.includes(c)).map(c => c.replace("case '", "").replace("'", ""));
|
1238 |
+
}
|
|
|
|
|
1239 |
|
1240 |
+
updateMessages.push(
|
1241 |
+
sizeDifference > 0 ?
|
1242 |
+
`β
*${file.name}* updated! (+${sizeDifference}KB)` :
|
1243 |
+
`β
*${file.name}* is already up to date.`
|
1244 |
+
);
|
1245 |
+
}
|
1246 |
|
1247 |
+
let newCasesText = newCases.length ?
|
1248 |
+
`π *New Cases Added:*\n${newCases.join("\n")}` :
|
1249 |
+
"β
No new cases added.";
|
1250 |
|
1251 |
+
reply(`*π Update Results:*\n${updateMessages.join("\n")}\n\n${newCasesText}`);
|
1252 |
+
} catch (error) {
|
1253 |
+
console.error("Error updating files:", error);
|
1254 |
+
conn.sendMessage(m.chat, { text: "β Error while updating. Try again later." });
|
1255 |
+
}
|
1256 |
+
break;
|
1257 |
+
}
|
|
|
|
|
1258 |
case 'ping': {
|
1259 |
const startTime = performance.now();
|
1260 |
const initialMessage = await conn.sendMessage(m.chat, {
|
|
|
2090 |
}
|
2091 |
break;
|
2092 |
}
|
2093 |
+
case 'welcome': {
|
2094 |
+
if (!isGroup) return reply(mess.only.group)
|
2095 |
+
if (!isAdmins && !isOwner) return reply(mess.only.admin)
|
2096 |
+
if (!q) return reply("Enter the query 'on' or 'off'");
|
2097 |
+
await loading()
|
2098 |
+
if (q == 'on') {
|
2099 |
+
if (chat.welcome == true) return reply('Welcome is already active');
|
2100 |
+
db.data.chats[from].welcome = true;
|
2101 |
+
reply('successfully activated welcome in this group');
|
2102 |
+
} else if (q == 'off') {
|
2103 |
+
if (chat.welcome == false) return reply('welcome is already inactive');
|
2104 |
+
db.data.chats[from].welcome = false;
|
2105 |
+
reply('successfully deactivated welcome in this group');
|
2106 |
+
} else reply('Choose "on" or "off"');
|
2107 |
+
}
|
2108 |
+
break;
|
2109 |
case 'encrypt':
|
2110 |
case 'obfuscate':
|
2111 |
case 'hard-encrypt': {
|