API-XX commited on
Commit
0057ead
·
verified ·
1 Parent(s): 88cdcbf

Upload case.js

Browse files
Files changed (1) hide show
  1. case.js +954 -743
case.js CHANGED
@@ -19,7 +19,7 @@ const speed = require("performance-now");
19
  const ms = require("parse-ms");
20
  const os = require('os');
21
  let platform = os.platform();
22
- let arch = os.arch();
23
  const {
24
  join,
25
  dirname
@@ -182,11 +182,11 @@ module.exports = async (conn, dev, chatUpdate, store) => {
182
  m.message.stickerMessage?.url ||
183
  m.message.documentMessage?.caption ||
184
  m.message.documentMessage?.url ||
185
- m.message.audioMessage?.url ||
186
  m.message.buttonsResponseMessage?.selectedButtonId ||
187
  m.message.templateButtonReplyMessage?.selectedId ||
188
  m.message.listResponseMessage?.singleSelectReply?.selectedRowId ||
189
- m.message.contactMessage?.displayName ||
190
  m.message.locationMessage?.degreesLatitude ||
191
  m.message.pollCreationMessage?.name ||
192
  '';
@@ -412,7 +412,7 @@ module.exports = async (conn, dev, chatUpdate, store) => {
412
  var ucapanWaktu = '𝙾𝚁𝙴𝚆𝙰𓃵'
413
  }
414
  conn.sendPresenceUpdate('unavailable', from);
415
-
416
  const isImage = (type === 'imageMessage')
417
  const isVideo = (type === 'videoMessage')
418
  const isSticker = (type == 'stickerMessage')
@@ -922,7 +922,7 @@ module.exports = async (conn, dev, chatUpdate, store) => {
922
  }
923
  try {
924
  switch (command) {
925
- case 'menu':
926
  case 'bluex': {
927
  await loading();
928
  const randomImage = images[Math.floor(Math.random() * images.length)];
@@ -971,11 +971,18 @@ module.exports = async (conn, dev, chatUpdate, store) => {
971
  > ${sign} add
972
  > ${sign} mute
973
  > ${sign} unmute
 
974
  > ${sign} tagme
975
  > ${sign} kickall
 
 
976
  > ${sign} setppgc
977
  > ${sign} delppgc
978
  > ${sign} getppgc
 
 
 
 
979
  > ─────────────❐
980
 
981
  > ─『 \`𝐌𝐄𝐃𝐈𝐀 𝐃𝐎𝐖𝐍𝐋𝐎𝐀𝐃𝐒\` 』
@@ -1052,218 +1059,252 @@ module.exports = async (conn, dev, chatUpdate, store) => {
1052
  await sleep(2000)
1053
  sendvn(dmusic)
1054
  break;
1055
- }
1056
- case 'mode': {
1057
- await loading();
1058
- let modeStatus = settings.publik ? "Public" : "Private";
1059
- reply(`📢 The bot is currently in *${modeStatus}* mode.`);
1060
- break;
1061
- }
1062
 
1063
- case 'public': {
1064
- if (!isOwner) return reply(mess.only.owner);
1065
- if (settings.publik) return reply("✅ The bot is already in *public* mode.");
1066
 
1067
- settings.publik = true;
1068
- reply("✅ The bot is now in *public* mode.");
1069
- break;
1070
- }
1071
 
1072
- case 'self': {
1073
- if (!isOwner) return reply(mess.only.owner);
1074
- if (!settings.publik) return reply("🔒 The bot is already in *private* mode.");
1075
 
1076
- settings.publik = false;
1077
- reply("🔒 The bot is now in *private* mode.");
1078
- break;
1079
- }
1080
- case 'setsudo': {
1081
- if (!isOwner) return reply(mess.only.owner);
1082
-
1083
- let newOwner;
1084
- if (m.quoted) {
1085
- newOwner = m.quoted.sender;
1086
- } else if (mentionByTag.length) {
1087
- newOwner = mentionByTag[0];
1088
- } else if (q) {
1089
- newOwner = q.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
1090
- } else {
1091
- return reply("Please tag, reply, or provide a number to add as an owner.");
1092
- }
1093
 
1094
- let ownerFile = './database/owner.json';
1095
- let owners = fs.existsSync(ownerFile) ? JSON.parse(fs.readFileSync(ownerFile, 'utf8')) : [];
 
 
 
 
 
 
 
 
1096
 
1097
- if (owners.includes(newOwner)) return reply("This number is already an owner.");
 
1098
 
1099
- owners.push(newOwner);
1100
- fs.writeFileSync(ownerFile, JSON.stringify(owners, null, 2));
1101
 
1102
- conn.sendMessage(m.chat, {
1103
- text: fontx(`✅ Successfully added @${newOwner.replace('@s.whatsapp.net', '')} as an owner.`),
1104
- mentions: [newOwner]
1105
- });
1106
- break;
1107
- }
1108
 
1109
- case 'delsudo': {
1110
- if (!isOwner) return reply(mess.only.owner);
1111
-
1112
- let removeOwner;
1113
- if (m.quoted) {
1114
- removeOwner = m.quoted.sender;
1115
- } else if (mentionByTag.length) {
1116
- removeOwner = mentionByTag[0];
1117
- } else if (q) {
1118
- removeOwner = q.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
1119
- } else {
1120
- return reply("Please tag, reply, or provide a number to remove from owners.");
1121
- }
1122
 
1123
- let ownerFile = './database/owner.json';
1124
- let owners = fs.existsSync(ownerFile) ? JSON.parse(fs.readFileSync(ownerFile, 'utf8')) : [];
1125
 
1126
- if (!owners.includes(removeOwner)) return reply("This number is not an owner.");
 
 
 
 
 
 
 
 
 
1127
 
1128
- owners = owners.filter(owner => owner !== removeOwner);
1129
- fs.writeFileSync(ownerFile, JSON.stringify(owners, null, 2));
1130
 
1131
- conn.sendMessage(m.chat, {
1132
- text: fontx(`✅ Successfully removed @${removeOwner.replace('@s.whatsapp.net', '')} from owners.`),
1133
- mentions: [removeOwner]
1134
- });
1135
- break;
1136
- }
1137
 
1138
- case 'getsudo': {
1139
- if (!isOwner) return reply(mess.only.owner);
1140
- try {
1141
- let owners = JSON.parse(fs.readFileSync('./database/owner.json', 'utf8'));
1142
 
1143
- if (owners.length === 0) return reply('*No owners found.*');
 
 
 
 
 
1144
 
1145
- let ownerList = owners.map((owner, index) => `${index + 1}. @${owner.replace('@s.whatsapp.net', '')}`).join("\n");
 
 
 
1146
 
1147
- conn.sendMessage(m.chat, {
1148
- text: fontx(`👑 *Sudo List:*\n\n${ownerList}`),
1149
- mentions: owners
1150
- });
1151
- } catch (error) {
1152
- console.error('Error reading owner file:', error);
1153
- reply('Failed to retrieve owner list.');
1154
- }
1155
- break;
1156
- }
1157
- case 'checkupdate': {
1158
- if (!isOwner) return reply(mess.only.owner);
1159
- await loading();
1160
-
1161
- let filesToCheck = [
1162
- { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js', path: './message/case.js', name: 'case.js' },
1163
- { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js', path: './temp/media/links.js', name: 'links.js' },
1164
- { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/group.js', path: './message/group.js', name: 'group.js' },
1165
- { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/message.js', path: './message/message.js', name: 'message.js' },
1166
- ];
1167
 
1168
- try {
1169
- let updateMessages = [];
1170
 
1171
- for (let file of filesToCheck) {
1172
- let oldSize = fs.existsSync(file.path) ? fs.statSync(file.path).size : 0;
 
 
 
 
 
 
 
 
 
 
 
1173
 
1174
- let response = await fetch(file.url);
1175
- if (!response.ok) {
1176
- updateMessages.push(`❌ Could not check *${file.name}*.`);
1177
- continue;
1178
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1179
 
1180
- let newContent = await response.text();
1181
- let newSize = Buffer.byteLength(newContent, 'utf8');
1182
- let sizeDifference = ((newSize - oldSize) / 1024).toFixed(2);
1183
 
1184
- if (file.name === "case.js") {
1185
- let oldCases = (fs.existsSync(file.path) ? fs.readFileSync(file.path, 'utf8') : "").match(/case\s+'([^']+)'/g) || [];
1186
- let newCases = newContent.match(/case\s+'([^']+)'/g) || [];
1187
 
1188
- let addedCases = newCases.filter(c => !oldCases.includes(c)).map(c => c.replace("case '", "").replace("'", ""));
1189
- let newCasesText = addedCases.length ? `🆕 New cases found: ${addedCases.join(", ")}` : "✅ No new cases added.";
1190
-
1191
- updateMessages.push(newCasesText);
1192
- }
1193
 
1194
- updateMessages.push(
1195
- sizeDifference > 0
1196
- ? `🆕 *${file.name}* has an update available! (+${sizeDifference}KB)`
1197
- : `✅ *${file.name}* is up to date.`
1198
- );
1199
- }
1200
 
1201
- reply(`*Update Check Results*\n${updateMessages.join("\n")}`);
1202
- } catch (error) {
1203
- console.error("Error checking updates:", error);
1204
- conn.sendMessage(m.chat, { text: "❌ An error occurred while checking updates. Please try again later." });
1205
- }
1206
- break;
1207
- }
1208
- case 'update': {
1209
- if (!isOwner) return reply(mess.only.owner);
1210
- await loading();
1211
 
1212
- let filesToUpdate = [
1213
- { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js', path: './message/case.js', name: 'case.js' },
1214
- { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js', path: './temp/media/links.js', name: 'links.js' },
1215
- { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/group.js', path: './message/group.js', name: 'group.js' },
1216
- { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/message.js', path: './message/message.js', name: 'message.js' },
1217
- ];
1218
 
1219
- try {
1220
- let updateMessages = [];
1221
- let newCases = [];
1222
 
1223
- for (let file of filesToUpdate) {
1224
- let oldContent = fs.existsSync(file.path) ? fs.readFileSync(file.path, 'utf8') : "";
1225
- let oldSize = Buffer.byteLength(oldContent, 'utf8');
 
 
 
1226
 
1227
- let response = await fetch(file.url);
1228
- if (!response.ok) {
1229
- updateMessages.push(`❌ Failed to update *${file.name}*.`);
1230
- continue;
1231
- }
 
 
 
 
 
 
 
1232
 
1233
- let newContent = await response.text();
1234
- fs.writeFileSync(file.path, newContent, 'utf8');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1235
 
1236
- let newSize = Buffer.byteLength(newContent, 'utf8');
1237
- let sizeDifference = ((newSize - oldSize) / 1024).toFixed(2);
 
1238
 
1239
- if (file.name === "case.js") {
1240
- let oldCases = oldContent.match(/case\s+'([^']+)'/g) || [];
1241
- let updatedCases = newContent.match(/case\s+'([^']+)'/g) || [];
1242
 
1243
- newCases = updatedCases
1244
- .filter(c => !oldCases.includes(c))
1245
- .map(c => c.replace("case '", "").replace("'", ""));
1246
- }
 
1247
 
1248
- updateMessages.push(
1249
- sizeDifference > 0
1250
- ? `✅ *${file.name}* updated! (+${sizeDifference}KB)`
1251
- : `✅ *${file.name}* is already up to date.`
1252
- );
1253
- }
1254
 
1255
- let newCasesText = newCases.length
1256
- ? `🆕 *New Cases Added:* ${newCases.join(", ")}`
1257
- : "✅ No new cases added.";
1258
 
1259
- reply(`*🔄 Update Results:*\n${updateMessages.join("\n")}\n\n${newCasesText}`);
1260
- } catch (error) {
1261
- console.error("Error updating files:", error);
1262
- conn.sendMessage(m.chat, { text: "❌ An error occurred while updating. Please try again later." });
1263
- }
1264
- break;
1265
- }
1266
- case 'ping': {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1267
  const startTime = performance.now();
1268
  const initialMessage = await conn.sendMessage(m.chat, {
1269
  text: fontx(`*⚡𝙲𝙰𝙻𝙲𝚄𝙻𝙰𝚃𝙸𝙽𝙶 𝚂𝙿𝙴𝙴𝙳⚡*\n🔃\n> ${botName}`)
@@ -1298,12 +1339,13 @@ case 'checkupdate': {
1298
  }, {});
1299
 
1300
  break;
1301
- }
1302
- case 'runtime': case 'uptime': {
 
1303
  reply(`${themeemoji} \`RUNTIME\` ${themeemoji}\n*${runtime(process.uptime())}*`)
1304
  }
1305
- break;
1306
- case 'setprefix': {
1307
  if (!isOwner) return reply(mess.only.owner);
1308
 
1309
  if (!text) return reply("Please provide a new prefix.\n\nExample: `.setprefix !`");
@@ -1321,7 +1363,7 @@ case 'checkupdate': {
1321
 
1322
  break;
1323
  }
1324
- case 'getprefix': {
1325
  await loading();
1326
 
1327
  try {
@@ -1335,13 +1377,13 @@ case 'checkupdate': {
1335
  }
1336
  break;
1337
  }
1338
- case 'delete':
1339
  case 'del':
1340
  case 'd': {
1341
- if (!isOwner) return;
1342
- if (!m.quoted) return;
1343
- try {
1344
- await conn.sendMessage(m.chat, {
1345
  delete: {
1346
  remoteJid: m.chat,
1347
  fromMe: false,
@@ -1350,10 +1392,10 @@ case 'checkupdate': {
1350
  }
1351
  });
1352
 
1353
- await conn.sendMessage(m.chat, {
1354
- delete: {
1355
  remoteJid: m.chat,
1356
- fromMe: true,
1357
  id: m.id
1358
  }
1359
  });
@@ -1362,7 +1404,7 @@ case 'checkupdate': {
1362
  }
1363
  }
1364
  break;
1365
- case 'clearchat':
1366
  case 'clear': {
1367
  if (!isOwner) return reply(mess.only.owner);
1368
 
@@ -1375,53 +1417,53 @@ case 'clearchat':
1375
  },
1376
  m.chat
1377
  );
1378
- await sleep(1500)
1379
  reply(mess.success);
1380
  }
1381
  break;
1382
- case 'block': {
1383
- if (!isOwner) return reply(mess.only.owner);
1384
- await loading();
1385
- let users;
1386
-
1387
- if (isGroup) {
1388
- if (m.quoted && m.quoted.sender) {
1389
- users = m.quoted.sender;
1390
- } else if (text) {
1391
- users = text.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
1392
- }
1393
- } else {
1394
- users = m.chat;
1395
- }
1396
 
1397
- if (users && users.replace(/[^0-9]/g, '').length >= 7) {
1398
- await conn.updateBlockStatus(users, "block");
1399
- reply(mess.success);
1400
- } else {
1401
- reply("Please reply to a message or provide a valid number to block.");
1402
- }
1403
- break;
1404
- }
 
 
 
 
 
 
 
 
 
 
1405
 
1406
- case 'unblock': {
1407
- if (!isOwner) return reply(mess.only.owner);
1408
- await loading();
1409
- let users;
1410
 
1411
- if (isGroup) {
1412
- users = m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
1413
- } else {
1414
- users = m.chat;
1415
- }
1416
 
1417
- if (users && users.replace(/[^0-9]/g, '').length >= 7) {
1418
- await conn.updateBlockStatus(users, "unblock");
1419
- reply(mess.success);
1420
- } else {
1421
- reply("Please reply to a message or provide a valid number to unblock.");
1422
- }
1423
- break;
1424
- }
1425
  case 'setppbot':
1426
  case 'setpp': {
1427
  if (!isOwner) return reply(mess.only.owner)
@@ -1460,12 +1502,12 @@ case 'unblock': {
1460
  }
1461
  }
1462
  break
1463
- case 'setbio':
1464
  case 'setbotbio': {
1465
  if (!isOwner) return reply(mess.only.owner);
1466
  if (!q) return reply(`*Example: ${prefix + command} Text*`);
1467
  try {
1468
- await conn.updateProfileStatus(q);
1469
  reply(`*Bio Has Been Changed To \`${q}\`*`);
1470
  } catch (error) {
1471
  console.error(error);
@@ -1473,17 +1515,17 @@ case 'setbio':
1473
  }
1474
  break;
1475
  }
1476
- case 'restart':
1477
  if (!isOwner) return reply(mess.only.owner)
1478
  await loading()
1479
  reply(`*restarting...*`)
1480
  await sleep(3000)
1481
  process.exit()
1482
  break;
1483
- case 'setname':
1484
- case 'setbotname': {
1485
- if (!isOwner) return reply(mess.only.owner);
1486
- if (!text) return reply(`*Example: ${prefix + command} blue demon*`);
1487
 
1488
  try {
1489
  await conn.updateProfileName(text);
@@ -1494,7 +1536,7 @@ case 'setbio':
1494
  }
1495
  break;
1496
  }
1497
- case 'owner':
1498
  case 'creator':
1499
  case 'dev': {
1500
  let who = m.mentionedJid && m.mentionedJid[0] ? m.mentionedJid[0] : m.fromMe ? conn.user.jid : m.sender;
@@ -1523,97 +1565,107 @@ case 'owner':
1523
  quoted: m
1524
  })
1525
  break;
1526
- case 'hidetag': case 'tag': {
1527
- if (!isGroup) return reply(mess.only.group)
1528
- if (!isAdmins && !isOwner) return reply(mess.only.admin);
1529
- await loading();
1530
- conn.sendMessage(m.chat, { text : q ? q : '' , mentions: participants.map(a => a.id)}, {quoted:m})
1531
- break
1532
- };
1533
- case 'kick': {
1534
- if (!isGroup) return reply(mess.only.group);
1535
- await loading();
1536
- if (!isBotGroupAdmins) return reply(mess.only.Badmin);
1537
- if (!isGroupAdmins && !isOwner) return reply(mess.only.admin);
1538
-
1539
- let mentioned = [];
1540
- if (m.quoted) {
1541
- mentioned = [m.quoted.sender];
1542
- } else if (mentionByTag.length > 0) {
1543
- mentioned = mentionByTag;
1544
- } else if (args[0]) {
1545
- mentioned = [`${args[0].replace(/[^0-9]/g, '')}@s.whatsapp.net`];
1546
- }
 
 
 
 
 
 
1547
 
1548
- if (mentioned.length === 0) {
1549
- return reply('Please reply to a user, tag someone, or provide a number to kick.');
1550
- }
1551
 
1552
- try {
1553
- await conn.groupParticipantsUpdate(m.chat, mentioned, 'remove');
1554
- reply(`Successfully kicked ${mentioned.map(v => `@${v.split('@')[0]}`).join(', ')}`, {
1555
- mentions: mentioned
1556
- });
1557
- } catch (error) {
1558
- console.error('Error in kick case:', error);
1559
- reply('Failed to kick the user. Make sure I have the correct permissions.');
1560
- }
1561
- break;
1562
- }
1563
 
1564
- case 'add': {
1565
- if (!isGroup) return reply(mess.only.group);
1566
- if (!isBotGroupAdmins) return reply(mess.only.Badmin);
1567
- if (!isGroupAdmins && !isOwner) return reply(mess.only.admin);
1568
- await loading();
1569
-
1570
- let number;
1571
- if (args[0]) {
1572
- number = args[0].replace(/[^0-9]/g, '');
1573
- } else if (m.quoted && m.quoted.sender) {
1574
- number = m.quoted.sender.split('@')[0];
1575
- } else {
1576
- return reply('Please provide a number or reply to a user to add.');
1577
- }
1578
 
1579
- const user = `${number}@s.whatsapp.net`;
 
 
 
 
 
 
 
1580
 
1581
- try {
1582
- await conn.groupParticipantsUpdate(m.chat, [user], 'add');
1583
- await conn.sendMessage(m.chat, {
1584
- text: fontx(`Successfully added @${number}`),
1585
- mentions: [user]
1586
- }, { quoted: m });
1587
- } catch (error) {
1588
- reply('Failed to add the user. Make sure the number is valid and I have the correct permissions.');
1589
- console.error(error);
1590
- }
1591
- break;
1592
- }
1593
- case 'tinyurl': {
1594
- if (!q) return reply(`Please provide a valid URL.\n\nExample: *${prefix + command} https://example.com*`);
1595
 
1596
- await loading();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1597
 
1598
- try {
1599
- let apiUrl = `https://api-xx-xi.hf.space/api/tinyurl?url=${encodeURIComponent(q)}`;
1600
- let response = await fetch(apiUrl);
1601
- let json = await response.json();
1602
 
1603
- if (!json.success || !json.short_url) {
1604
- return reply("❌ Failed to shorten the URL. Please try again.");
1605
- }
 
1606
 
1607
- conn.sendMessage(m.chat, {
1608
- text: fontx(`🔗 *Shortened URL:*\n\n📏 *Long:* `)+ q + fontx(`\n✂️ *Short:* `) + json.short_url,
1609
- }, { quoted: m });
1610
 
1611
- } catch (error) {
1612
- console.error("Error in tinyurl case:", error);
1613
- reply("❌ An error occurred while shortening the URL. Please try again later.");
1614
- }
1615
- break;
1616
- }
 
 
 
 
 
 
1617
  case 'areact': {
1618
  if (!isOwner) return reply(mess.only.owner);
1619
  if (!args[0]) return reply(`Example: ${prefix + command} on/off`);
@@ -1628,7 +1680,7 @@ case 'tinyurl': {
1628
  }
1629
  break;
1630
  }
1631
- case 'blueai': {
1632
  if (!q) {
1633
  return reply(`*Please provide a query.*\n\n*Example:* ${prefix + command} Hello, which model are you?`);
1634
  }
@@ -1647,7 +1699,8 @@ case 'blueai': {
1647
  const aiResponse = res.data;
1648
  await conn.sendMessage(from, {
1649
  image: {
1650
- url: './temp/blueimages/thumb.jpg', },
 
1651
  caption: fontx(`*BLUE AI Response:*\n${aiResponse}\n> ${caption}`),
1652
  }, {
1653
  quoted: m
@@ -1672,7 +1725,7 @@ case 'blueai': {
1672
  if (res.status !== 200 || !res.data) {
1673
  return reply("Failed to process your request. Please try again later.");
1674
  }
1675
- const aiResponse = res.data;
1676
  await conn.sendMessage(from, {
1677
  image: {
1678
  url: './temp/blueimages/gemini.jpg'
@@ -1696,14 +1749,14 @@ case 'blueai': {
1696
  await loading();
1697
 
1698
  try {
1699
- const apiUrl = `https://bk9.fun/ai/gemini?q=${encodeURIComponent(q)}`;
1700
  const response = await fetch(apiUrl);
1701
  const res = await response.json();
1702
  if (!res.status || !res.BK9) {
1703
  return reply("Failed to process your request. Please try again later.");
1704
  }
1705
 
1706
- const aiResponse = res.BK9;
1707
 
1708
  await conn.sendMessage(from, {
1709
  image: {
@@ -1719,7 +1772,7 @@ case 'blueai': {
1719
  }
1720
  break;
1721
  }
1722
- case 'mute': {
1723
  if (!m.isGroup) return reply(mess.only.group);
1724
  if (!isOwner && !isAdmins) return reply(mess.only.admin);
1725
  if (!isBotAdmins) return reply(mess.only.Badmin);
@@ -1733,7 +1786,7 @@ case 'blueai': {
1733
  }
1734
  break;
1735
  }
1736
- case 'unmute': {
1737
  if (!m.isGroup) return reply(mess.only.group);
1738
  if (!isOwner && !isAdmins) return reply(mess.only.admin);
1739
  if (!isBotAdmins) return reply(mess.only.Badmin);
@@ -1822,280 +1875,206 @@ case 'blueai': {
1822
  await conn.removeProfilePicture(from)
1823
  }
1824
  break
 
 
 
 
 
 
1825
 
 
1826
 
 
 
 
 
 
1827
 
 
 
 
 
 
1828
 
 
 
 
 
 
 
 
 
1829
 
 
1830
 
1831
 
 
 
 
 
 
1832
 
1833
 
 
 
 
 
 
 
 
 
1834
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1835
 
1836
 
1837
 
1838
 
 
 
1839
 
 
1840
 
 
 
1841
 
 
 
 
 
 
 
 
 
1842
 
 
 
 
 
 
 
 
 
 
 
 
1843
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1844
 
 
 
 
 
 
 
 
 
 
1845
 
 
1846
 
 
 
1847
 
1848
-
1849
-
1850
-
1851
-
1852
-
1853
-
1854
-
1855
-
1856
-
1857
-
1858
-
1859
-
1860
-
1861
-
1862
-
1863
-
1864
-
1865
-
1866
-
1867
-
1868
-
1869
-
1870
-
1871
-
1872
-
1873
-
1874
-
1875
-
1876
-
1877
-
1878
-
1879
-
1880
-
1881
-
1882
-
1883
-
1884
-
1885
-
1886
-
1887
-
1888
-
1889
-
1890
-
1891
-
1892
-
1893
-
1894
-
1895
-
1896
-
1897
-
1898
-
1899
-
1900
-
1901
-
1902
-
1903
-
1904
-
1905
-
1906
-
1907
-
1908
-
1909
-
1910
-
1911
-
1912
-
1913
-
1914
-
1915
-
1916
-
1917
-
1918
-
1919
-
1920
-
1921
-
1922
-
1923
-
1924
-
1925
-
1926
-
1927
-
1928
-
1929
-
1930
-
1931
-
1932
-
1933
-
1934
-
1935
-
1936
-
1937
-
1938
-
1939
-
1940
-
1941
-
1942
-
1943
-
1944
-
1945
-
1946
-
1947
-
1948
-
1949
-
1950
-
1951
-
1952
-
1953
-
1954
-
1955
-
1956
-
1957
-
1958
-
1959
-
1960
-
1961
-
1962
-
1963
-
1964
-
1965
-
1966
-
1967
-
1968
-
1969
-
1970
-
1971
-
1972
-
1973
-
1974
-
1975
-
1976
-
1977
-
1978
-
1979
-
1980
-
1981
-
1982
-
1983
-
1984
-
1985
-
1986
-
1987
-
1988
-
1989
-
1990
-
1991
-
1992
-
1993
-
1994
-
1995
-
1996
-
1997
-
1998
-
1999
-
2000
-
2001
-
2002
-
2003
-
2004
-
2005
-
2006
-
2007
- case 'text2img': {
2008
- if (!q) return reply(`Please provide a prompt.\n\nExample: *${prefix + command} a big dog and a tiny cat*`);
2009
-
2010
- await loading();
2011
-
2012
- try {
2013
- let imageUrl = `https://api-xx-xi.hf.space/api/text2img?prompt=${encodeURIComponent(q)}`;
2014
-
2015
- await conn.sendMessage(m.chat, {
2016
- image: { url: imageUrl },
2017
- caption: fontx(`🖼️ *Generated Image*\n\n📜 *Prompt:* ${q}\n> ${caption}`),
2018
- }, { quoted: m });
2019
-
2020
- } catch (error) {
2021
- console.error("Error in text2img case:", error);
2022
- reply("❌ An error occurred while generating the image. Please try again later.");
2023
- }
2024
- break;
2025
- }
2026
- case 'tts':
2027
- case 'say': {
2028
- if (!q) {
2029
- return reply(`\`Please provide text to convert to speech.\`\n\n*Example:*\n${prefix + command} hello`);
2030
- }
2031
-
2032
  try {
2033
- await loading();
2034
- const apiUrl = `https://bk9.fun/tools/tts?q=${encodeURIComponent(q)}&lang=en`;
2035
- const response = await fetch(apiUrl);
2036
- if (!response.ok) {
2037
- return reply("Failed to process your request. Please try again later.");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2038
  }
2039
- await conn.sendMessage(from, {
2040
- audio: {
2041
- url: apiUrl
2042
- },
2043
- mimetype: "audio/mp4",
2044
- fileName: `tts_${Date.now()}.mp3`,
2045
- ptt: true, // Send as a voice note
2046
- }, {
2047
- quoted: m
2048
- });
2049
 
2050
  } catch (error) {
2051
- console.error("Error in TTS case:", error);
2052
- reply("An error occurred while processing your request. Please try again later.");
2053
  }
2054
- break;
2055
  }
2056
- case "vv":
2057
- case "readviewonce": {
2058
- if (!isOwner) return reply(mess.only.owner);
2059
-
2060
- if (!quoted) return reply("reply to a view-once message!");
2061
-
2062
- let msg = quoted;
2063
- let msgType = Object.keys(msg)[0];
2064
-
2065
- if (!msg[msgType]?.viewOnce) return reply("this isn't a view-once message!");
2066
- await loading();
2067
- try {
2068
- let media = await downloadMediaMessage(
2069
- msg[msgType],
2070
- msgType === "imageMessage" ? "image" :
2071
- msgType === "videoMessage" ? "video" :
2072
- "audio"
2073
- );
2074
-
2075
- if (!media) return reply("Failed to retrieve the media.");
2076
-
2077
- let originalCaption = msg[msgType]?.caption || "No caption";
2078
- let formattedCaption = originalCaption.split("\n").map(line => `> ${line}`).join("\n");
2079
-
2080
- let finalCaption = `> ${caption}`;
2081
-
2082
- if (/video/.test(msgType)) {
2083
- await conn.sendMessage(chat, { video: media, caption: finalCaption }, { quoted: mess });
2084
- } else if (/image/.test(msgType)) {
2085
- await conn.sendMessage(chat, { image: media, caption: finalCaption }, { quoted: mess });
2086
- } else if (/audio/.test(msgType)) {
2087
- await conn.sendMessage(chat, { audio: media, mimetype: "audio/mpeg", ptt: true }, { quoted: mess });
2088
- }
2089
-
2090
- } catch (error) {
2091
- console.error("❌ Error retrieving View Once message:", error);
2092
- return reply("Failed to retrieve the View Once message.");
2093
- }
2094
- }
2095
- break;
2096
- case 'qr': {
2097
  if (!q) return reply("Please provide text or a link to generate a QR code.");
2098
- await loading();
2099
  const apiUrl = `https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=${encodeURIComponent(q)}`;
2100
 
2101
  await conn.sendMessage(m.chat, {
@@ -2114,7 +2093,7 @@ break;
2114
  case 'sc': {
2115
  try {
2116
  await loading();
2117
- await loading();
2118
  const zipUrl = 'https://github.com/BLUEXDEMONl/BLUEXDEMON-V5/archive/refs/heads/master.zip';
2119
 
2120
  const response = await fetch(zipUrl);
@@ -2124,7 +2103,7 @@ await loading();
2124
  }
2125
 
2126
  const zipBuffer = await response.buffer();
2127
- await conn.sendMessage(m.chat, {
2128
  document: zipBuffer,
2129
  mimetype: 'application/zip',
2130
  fileName: 'BLUE-DEMON-V5.zip',
@@ -2207,7 +2186,7 @@ await loading();
2207
  }
2208
  break;
2209
  }
2210
- case 'getdevice':
2211
  case 'device':
2212
  case 'phone': {
2213
  if (!m.quoted) return reply(`Please reply to a chat message with *${prefix + command}* to get device information.`);
@@ -2225,7 +2204,7 @@ case 'getdevice':
2225
  }
2226
  break;
2227
  }
2228
- case 'html': {
2229
  if (!q) return reply("Please provide a valid link to fetch.");
2230
 
2231
  const isValidUrl = (url) => {
@@ -2263,7 +2242,7 @@ case 'getdevice':
2263
  }
2264
  break;
2265
  }
2266
- case 'get': {
2267
  if (!q) return reply("Please provide a valid link to fetch.");
2268
  const isValidUrl = (url) => {
2269
  try {
@@ -2359,34 +2338,36 @@ case 'getdevice':
2359
  }
2360
  break;
2361
  }
2362
- case 'gross': {
2363
- const grossEmojis = [
2364
- '🤢', '🤮', '😖', '😫', '🤢🤢', '🤮🤮', '😵‍💫', '🤧', '🤢🤮', '😷',
2365
- '🤢🤢🤮', '🤮🤮🤮', '🤢🤢🤢', '🤮🤢🤮', '😵', '🤒', '🤕', '🤢🤮🤢', '🤮😫🤢', '🤮🤢😵'
2366
- ];
2367
-
2368
- const grossMsg = await conn.sendMessage(m.chat, {
2369
- text: fontx(grossEmojis[0])
2370
- }, { quoted: m });
2371
-
2372
- const updateMessage = async (index = 1) => {
2373
- if (index < grossEmojis.length) {
2374
- await conn.relayMessage(m.chat, {
2375
- protocolMessage: {
2376
- key: grossMsg.key,
2377
- type: 14,
2378
- editedMessage: {
2379
- conversation: fontx(grossEmojis[index])
2380
- }
2381
- }
2382
- }, {});
2383
- setTimeout(() => updateMessage(index + 1), 1000);
2384
- }
2385
- };
2386
 
2387
- setTimeout(() => updateMessage(), 1000);
2388
- break;
2389
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2390
  case 'love': {
2391
  const heartEmojis = [
2392
  '♥️', '❣️', '💘', '💝', '💖', '💗', '💓', '💞', '💕', '❤️‍🔥',
@@ -2412,22 +2393,22 @@ case 'gross': {
2412
  setTimeout(() => updateMessage(index + 1), 1000);
2413
  }
2414
  };
2415
- setTimeout(() => updateMessage(), 1000);
2416
  break;
2417
  }
2418
  case 'confuse':
2419
  case 'conf': {
2420
- const confusedEmojis = [
2421
  '😕', '🤔', '😵', '😵‍💫', '🤷', '🤷‍♂️', '🤷‍♀️', '😮‍💨', '😐', '🤨',
2422
  '🙃', '😬', '😯', '😖', '😑', '😳', '🤪', '🤯'
2423
  ];
2424
 
2425
- const confuseMsg = await conn.sendMessage(m.chat, {
2426
  text: confusedEmojis[0]
2427
  }, {
2428
  quoted: m
2429
  });
2430
- const updateMessage = async (index = 1) => {
2431
  if (index < confusedEmojis.length) {
2432
  await conn.relayMessage(m.chat, {
2433
  protocolMessage: {
@@ -2438,21 +2419,21 @@ case 'gross': {
2438
  }
2439
  }
2440
  }, {});
2441
- setTimeout(() => updateMessage(index + 1), 1000);
2442
  }
2443
  };
2444
- setTimeout(() => updateMessage(), 1000);
2445
  break;
2446
  }
2447
  case 'angry':
2448
  case 'gtf': {
2449
- const angryEmojis = [
2450
  '😡', '😠', '🤬', '👿', '💢', '🔥', '😾', '😤', '🤯', '💥',
2451
  '😾', '👺', '👊', '🗯️', '😒', '👎', '🥵', '🧨', '👹', '💣',
2452
  '😠', '👊', '💥', '😡', '🤬', '🔥', '🖕🏽'
2453
  ];
2454
 
2455
- const angryMsg = await conn.sendMessage(m.chat, {
2456
  text: angryEmojis[0]
2457
  }, {
2458
  quoted: m
@@ -2474,155 +2455,385 @@ case 'gross': {
2474
  setTimeout(() => updateMessage(), 1000);
2475
  break;
2476
  }
2477
- case 'flirt': {
2478
- await loading();
2479
- try {
2480
- let response = await fetch('https://api-xx-xi.hf.space/api/flirt');
2481
- let json = await response.json();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2482
 
2483
- if (!json.success) {
2484
- return reply(fontx("Failed to fetch a flirt line. Please try again later."));
2485
- }
2486
 
2487
- let { flirt } = json;
2488
 
2489
- conn.sendMessage(m.chat, {
2490
- text: fontx(`💘 *Flirty Line:*\n\n❝ ${flirt} ❞\n> ${caption}`)
2491
- });
2492
- } catch (error) {
2493
- console.error("Error in flirt case:", error);
2494
- reply(fontx("An error occurred while fetching the flirt line. Please try again later."));
2495
- }
2496
- break;
2497
- }
2498
- case 'joke': {
2499
- await loading();
2500
- try {
2501
- let response = await fetch('https://api-xx-xi.hf.space/api/joke');
2502
- let json = await response.json();
2503
 
2504
- if (!json.success) {
2505
- return reply(fontx("Failed to fetch a joke. Please try again later."));
2506
- }
2507
 
2508
- let { joke } = json;
2509
 
2510
- conn.sendMessage(m.chat, {
2511
- text: fontx(`😂 *Here's a joke for you!*\n\n❝ ${joke} ❞\n> ${caption}`)
2512
- });
2513
- } catch (error) {
2514
- console.error("Error in joke case:", error);
2515
- reply(fontx("An error occurred while fetching the joke. Please try again later."));
2516
- }
2517
- break;
2518
- }
2519
- case 'truth': {
2520
- await loading();
2521
- try {
2522
- let response = await fetch('https://api-xx-xi.hf.space/api/truth');
2523
- let json = await response.json();
2524
 
2525
- if (!json.success) {
2526
- return reply(fontx("Failed to fetch a truth question. Please try again later."));
2527
- }
2528
 
2529
- let { truth } = json;
2530
 
2531
- conn.sendMessage(m.chat, {
2532
- text: fontx(`🔍 *Truth Question*\n\n❝ ${truth} ❞\n> ${caption}`)
2533
- });
2534
- } catch (error) {
2535
- console.error("Error in truth case:", error);
2536
- reply(fontx("An error occurred while fetching the truth question. Please try again later."));
2537
- }
2538
- break;
2539
- }
2540
 
2541
- case 'dare': {
2542
- await loading();
2543
- try {
2544
- let response = await fetch('https://api-xx-xi.hf.space/api/dare');
2545
- let json = await response.json();
2546
 
2547
- if (!json.success) {
2548
- return reply(fontx("Failed to fetch a dare challenge. Please try again later."));
2549
- }
2550
 
2551
- let { dare } = json;
2552
 
2553
- conn.sendMessage(m.chat, {
2554
- text: fontx(`🔥 *Dare Challenge*\n\n❝ ${dare} ❞\n> ${caption}`)
2555
- });
2556
- } catch (error) {
2557
- console.error("Error in dare case:", error);
2558
- reply(fontx("An error occurred while fetching the dare challenge. Please try again later."));
2559
- }
2560
- break;
2561
- }
2562
- case 'rizz': case 'pickupline': {
2563
- await loading();
2564
- try {
2565
- let response = await fetch('https://api-xx-xi.hf.space/api/rizz');
2566
- let json = await response.json();
2567
 
2568
- if (!json.success) {
2569
- return reply(fontx("Failed to fetch a rizz line. Please try again later."));
2570
- }
2571
 
2572
- let { rizz } = json;
2573
 
2574
- conn.sendMessage(m.chat, {
2575
- text: fontx(`😏 *Rizz Line*\n\n❝ ${rizz} ❞\n> ${caption}`)
2576
- });
2577
- } catch (error) {
2578
- console.error("Error in rizz case:", error);
2579
- reply(fontx("An error occurred while fetching the rizz line. Please try again later."));
2580
- }
2581
- break;
2582
- }
2583
 
2584
- case 'quote': {
2585
- await loading();
2586
- try {
2587
- let response = await fetch('https://api-xx-xi.hf.space/api/quote');
2588
- let json = await response.json();
2589
 
2590
- if (!json.success) {
2591
- return reply(fontx("Failed to fetch a quote. Please try again later."));
2592
- }
2593
 
2594
- let { Author, quote } = json;
2595
 
2596
- conn.sendMessage(m.chat, {
2597
- text: fontx(`📜 *Quote of the Day*\n\n❝ ${quote} ❞\n\n— *${Author}*\n> ${caption}`)
2598
- });
2599
- } catch (error) {
2600
- console.error("Error in quote case:", error);
2601
- reply(fontx("An error occurred while fetching the quote. Please try again later."));
2602
- }
2603
- break;
2604
- }
2605
- case 'aniquote': case'animequote': {
2606
- await loading();
2607
- try {
2608
- let apiUrl = `https://api-xx-xi.hf.space/api/aniquote`;
2609
- let response = await fetch(apiUrl);
2610
- let json = await response.json();
2611
 
2612
- if (!json.success) {
2613
- return conn.sendMessage(m.chat, { text: "❌ Failed to fetch an anime quote. Please try again later." });
2614
- }
2615
- let { author, anime, quote } = json;
2616
- conn.sendMessage(m.chat, {
2617
- text: fontx(`🎌 *Anime Quote*\n\n💬 *Quote:* "${quote}"\n👤 *Author:* ${author}\n📺 *Anime:* ${anime}\n> ${caption}`)
2618
- }, { quoted: m });
2619
- } catch (error) {
2620
- console.error("Error in aniquote case:", error);
2621
- conn.sendMessage(m.chat, { text: "❌ An error occurred while fetching the quote. Please try again later." });
2622
- }
2623
- break;
2624
- }
2625
-
2626
  default:
2627
  }
2628
  if (!isGroup && user && isPremium && new Date - user.pc < 86400000) {} else if (!isGroup && user && isPremium && !itsMe) {
 
19
  const ms = require("parse-ms");
20
  const os = require('os');
21
  let platform = os.platform();
22
+ let arch = os.arch();
23
  const {
24
  join,
25
  dirname
 
182
  m.message.stickerMessage?.url ||
183
  m.message.documentMessage?.caption ||
184
  m.message.documentMessage?.url ||
185
+ m.message.audioMessage?.url ||
186
  m.message.buttonsResponseMessage?.selectedButtonId ||
187
  m.message.templateButtonReplyMessage?.selectedId ||
188
  m.message.listResponseMessage?.singleSelectReply?.selectedRowId ||
189
+ m.message.contactMessage?.displayName ||
190
  m.message.locationMessage?.degreesLatitude ||
191
  m.message.pollCreationMessage?.name ||
192
  '';
 
412
  var ucapanWaktu = '𝙾𝚁𝙴𝚆𝙰𓃵'
413
  }
414
  conn.sendPresenceUpdate('unavailable', from);
415
+
416
  const isImage = (type === 'imageMessage')
417
  const isVideo = (type === 'videoMessage')
418
  const isSticker = (type == 'stickerMessage')
 
922
  }
923
  try {
924
  switch (command) {
925
+ case 'menu':
926
  case 'bluex': {
927
  await loading();
928
  const randomImage = images[Math.floor(Math.random() * images.length)];
 
971
  > ${sign} add
972
  > ${sign} mute
973
  > ${sign} unmute
974
+ > ${sign} invite
975
  > ${sign} tagme
976
  > ${sign} kickall
977
+ > ${sign} gcinfo
978
+ > ${sign} revoke
979
  > ${sign} setppgc
980
  > ${sign} delppgc
981
  > ${sign} getppgc
982
+ > ${sign} antilink
983
+ > ${sign} antivirtex
984
+ > ${sign} promote
985
+ > ${sign} demote
986
  > ─────────────❐
987
 
988
  > ─『 \`𝐌𝐄𝐃𝐈𝐀 𝐃𝐎𝐖𝐍𝐋𝐎𝐀𝐃𝐒\` 』
 
1059
  await sleep(2000)
1060
  sendvn(dmusic)
1061
  break;
1062
+ }
1063
+ case 'mode': {
1064
+ await loading();
1065
+ let modeStatus = settings.publik ? "Public" : "Private";
1066
+ reply(`📢 The bot is currently in *${modeStatus}* mode.`);
1067
+ break;
1068
+ }
1069
 
1070
+ case 'public': {
1071
+ if (!isOwner) return reply(mess.only.owner);
1072
+ if (settings.publik) return reply("✅ The bot is already in *public* mode.");
1073
 
1074
+ settings.publik = true;
1075
+ reply("✅ The bot is now in *public* mode.");
1076
+ break;
1077
+ }
1078
 
1079
+ case 'self': {
1080
+ if (!isOwner) return reply(mess.only.owner);
1081
+ if (!settings.publik) return reply("🔒 The bot is already in *private* mode.");
1082
 
1083
+ settings.publik = false;
1084
+ reply("🔒 The bot is now in *private* mode.");
1085
+ break;
1086
+ }
1087
+ case 'setsudo': {
1088
+ if (!isOwner) return reply(mess.only.owner);
 
 
 
 
 
 
 
 
 
 
 
1089
 
1090
+ let newOwner;
1091
+ if (m.quoted) {
1092
+ newOwner = m.quoted.sender;
1093
+ } else if (mentionByTag.length) {
1094
+ newOwner = mentionByTag[0];
1095
+ } else if (q) {
1096
+ newOwner = q.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
1097
+ } else {
1098
+ return reply("Please tag, reply, or provide a number to add as an owner.");
1099
+ }
1100
 
1101
+ let ownerFile = './database/owner.json';
1102
+ let owners = fs.existsSync(ownerFile) ? JSON.parse(fs.readFileSync(ownerFile, 'utf8')) : [];
1103
 
1104
+ if (owners.includes(newOwner)) return reply("This number is already an owner.");
 
1105
 
1106
+ owners.push(newOwner);
1107
+ fs.writeFileSync(ownerFile, JSON.stringify(owners, null, 2));
 
 
 
 
1108
 
1109
+ conn.sendMessage(m.chat, {
1110
+ text: fontx(`✅ Successfully added @${newOwner.replace('@s.whatsapp.net', '')} as an owner.`),
1111
+ mentions: [newOwner]
1112
+ });
1113
+ break;
1114
+ }
 
 
 
 
 
 
 
1115
 
1116
+ case 'delsudo': {
1117
+ if (!isOwner) return reply(mess.only.owner);
1118
 
1119
+ let removeOwner;
1120
+ if (m.quoted) {
1121
+ removeOwner = m.quoted.sender;
1122
+ } else if (mentionByTag.length) {
1123
+ removeOwner = mentionByTag[0];
1124
+ } else if (q) {
1125
+ removeOwner = q.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
1126
+ } else {
1127
+ return reply("Please tag, reply, or provide a number to remove from owners.");
1128
+ }
1129
 
1130
+ let ownerFile = './database/owner.json';
1131
+ let owners = fs.existsSync(ownerFile) ? JSON.parse(fs.readFileSync(ownerFile, 'utf8')) : [];
1132
 
1133
+ if (!owners.includes(removeOwner)) return reply("This number is not an owner.");
 
 
 
 
 
1134
 
1135
+ owners = owners.filter(owner => owner !== removeOwner);
1136
+ fs.writeFileSync(ownerFile, JSON.stringify(owners, null, 2));
 
 
1137
 
1138
+ conn.sendMessage(m.chat, {
1139
+ text: fontx(`✅ Successfully removed @${removeOwner.replace('@s.whatsapp.net', '')} from owners.`),
1140
+ mentions: [removeOwner]
1141
+ });
1142
+ break;
1143
+ }
1144
 
1145
+ case 'getsudo': {
1146
+ if (!isOwner) return reply(mess.only.owner);
1147
+ try {
1148
+ let owners = JSON.parse(fs.readFileSync('./database/owner.json', 'utf8'));
1149
 
1150
+ if (owners.length === 0) return reply('*No owners found.*');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1151
 
1152
+ let ownerList = owners.map((owner, index) => `${index + 1}. @${owner.replace('@s.whatsapp.net', '')}`).join("\n");
 
1153
 
1154
+ conn.sendMessage(m.chat, {
1155
+ text: fontx(`👑 *Sudo List:*\n\n${ownerList}`),
1156
+ mentions: owners
1157
+ });
1158
+ } catch (error) {
1159
+ console.error('Error reading owner file:', error);
1160
+ reply('Failed to retrieve owner list.');
1161
+ }
1162
+ break;
1163
+ }
1164
+ case 'checkupdate': {
1165
+ if (!isOwner) return reply(mess.only.owner);
1166
+ await loading();
1167
 
1168
+ let filesToCheck = [{
1169
+ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js',
1170
+ path: './message/case.js',
1171
+ name: 'case.js'
1172
+ },
1173
+ {
1174
+ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js',
1175
+ path: './temp/media/links.js',
1176
+ name: 'links.js'
1177
+ },
1178
+ {
1179
+ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/group.js',
1180
+ path: './message/group.js',
1181
+ name: 'group.js'
1182
+ },
1183
+ {
1184
+ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/message.js',
1185
+ path: './message/message.js',
1186
+ name: 'message.js'
1187
+ },
1188
+ ];
1189
 
1190
+ try {
1191
+ let updateMessages = [];
 
1192
 
1193
+ for (let file of filesToCheck) {
1194
+ let oldSize = fs.existsSync(file.path) ? fs.statSync(file.path).size : 0;
 
1195
 
1196
+ let response = await fetch(file.url);
1197
+ if (!response.ok) {
1198
+ updateMessages.push(`❌ Could not check *${file.name}*.`);
1199
+ continue;
1200
+ }
1201
 
1202
+ let newContent = await response.text();
1203
+ let newSize = Buffer.byteLength(newContent, 'utf8');
1204
+ let sizeDifference = ((newSize - oldSize) / 1024).toFixed(2);
 
 
 
1205
 
1206
+ if (file.name === "case.js") {
1207
+ let oldCases = (fs.existsSync(file.path) ? fs.readFileSync(file.path, 'utf8') : "").match(/case\s+'([^']+)'/g) || [];
1208
+ let newCases = newContent.match(/case\s+'([^']+)'/g) || [];
 
 
 
 
 
 
 
1209
 
1210
+ let addedCases = newCases.filter(c => !oldCases.includes(c)).map(c => c.replace("case '", "").replace("'", ""));
1211
+ let newCasesText = addedCases.length ? `🆕 New cases found: ${addedCases.join("\n ")}` : "✅ No new cases added.";
 
 
 
 
1212
 
1213
+ updateMessages.push(newCasesText);
1214
+ }
 
1215
 
1216
+ updateMessages.push(
1217
+ sizeDifference > 0 ?
1218
+ `🆕 *${file.name}* has an update available! (+${sizeDifference}KB)` :
1219
+ `✅ *${file.name}* is up to date.`
1220
+ );
1221
+ }
1222
 
1223
+ reply(`*Update Check Results*\n${updateMessages.join("\n")}`);
1224
+ } catch (error) {
1225
+ console.error("Error checking updates:", error);
1226
+ conn.sendMessage(m.chat, {
1227
+ text: "❌ An error occurred while checking updates. Please try again later."
1228
+ });
1229
+ }
1230
+ break;
1231
+ }
1232
+ case 'update': {
1233
+ if (!isOwner) return reply(mess.only.owner);
1234
+ await loading();
1235
 
1236
+ let filesToUpdate = [{
1237
+ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js',
1238
+ path: './message/case.js',
1239
+ name: 'case.js'
1240
+ },
1241
+ {
1242
+ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js',
1243
+ path: './temp/media/links.js',
1244
+ name: 'links.js'
1245
+ },
1246
+ {
1247
+ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/group.js',
1248
+ path: './message/group.js',
1249
+ name: 'group.js'
1250
+ },
1251
+ {
1252
+ url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/message.js',
1253
+ path: './message/message.js',
1254
+ name: 'message.js'
1255
+ },
1256
+ ];
1257
 
1258
+ try {
1259
+ let updateMessages = [];
1260
+ let newCases = [];
1261
 
1262
+ for (let file of filesToUpdate) {
1263
+ let oldContent = fs.existsSync(file.path) ? fs.readFileSync(file.path, 'utf8') : "";
1264
+ let oldSize = Buffer.byteLength(oldContent, 'utf8');
1265
 
1266
+ let response = await fetch(file.url);
1267
+ if (!response.ok) {
1268
+ updateMessages.push(`❌ Failed to update *${file.name}*.`);
1269
+ continue;
1270
+ }
1271
 
1272
+ let newContent = await response.text();
1273
+ fs.writeFileSync(file.path, newContent, 'utf8');
 
 
 
 
1274
 
1275
+ let newSize = Buffer.byteLength(newContent, 'utf8');
1276
+ let sizeDifference = ((newSize - oldSize) / 1024).toFixed(2);
 
1277
 
1278
+ if (file.name === "case.js") {
1279
+ let oldCases = oldContent.match(/case\s+'([^']+)'/g) || [];
1280
+ let updatedCases = newContent.match(/case\s+'([^']+)'/g) || [];
1281
+
1282
+ newCases = updatedCases
1283
+ .filter(c => !oldCases.includes(c))
1284
+ .map(c => c.replace("case '", "").replace("'", ""));
1285
+ }
1286
+
1287
+ updateMessages.push(
1288
+ sizeDifference > 0 ?
1289
+ `✅ *${file.name}* updated! (+${sizeDifference}KB)` :
1290
+ `✅ *${file.name}* is already up to date.`
1291
+ );
1292
+ }
1293
+
1294
+ let newCasesText = newCases.length ?
1295
+ `🆕 *New Cases Added:* ${newCases.join(", ")}` :
1296
+ "✅ No new cases added.";
1297
+
1298
+ reply(`*🔄 Update Results:*\n${updateMessages.join("\n")}\n\n${newCasesText}`);
1299
+ } catch (error) {
1300
+ console.error("Error updating files:", error);
1301
+ conn.sendMessage(m.chat, {
1302
+ text: "❌ An error occurred while updating. Please try again later."
1303
+ });
1304
+ }
1305
+ break;
1306
+ }
1307
+ case 'ping': {
1308
  const startTime = performance.now();
1309
  const initialMessage = await conn.sendMessage(m.chat, {
1310
  text: fontx(`*⚡𝙲𝙰𝙻𝙲𝚄𝙻𝙰𝚃𝙸𝙽𝙶 𝚂𝙿𝙴𝙴𝙳⚡*\n🔃\n> ${botName}`)
 
1339
  }, {});
1340
 
1341
  break;
1342
+ }
1343
+ case 'runtime':
1344
+ case 'uptime': {
1345
  reply(`${themeemoji} \`RUNTIME\` ${themeemoji}\n*${runtime(process.uptime())}*`)
1346
  }
1347
+ break;
1348
+ case 'setprefix': {
1349
  if (!isOwner) return reply(mess.only.owner);
1350
 
1351
  if (!text) return reply("Please provide a new prefix.\n\nExample: `.setprefix !`");
 
1363
 
1364
  break;
1365
  }
1366
+ case 'getprefix': {
1367
  await loading();
1368
 
1369
  try {
 
1377
  }
1378
  break;
1379
  }
1380
+ case 'delete':
1381
  case 'del':
1382
  case 'd': {
1383
+ if (!isOwner) return;
1384
+ if (!m.quoted) return;
1385
+ try {
1386
+ await conn.sendMessage(m.chat, {
1387
  delete: {
1388
  remoteJid: m.chat,
1389
  fromMe: false,
 
1392
  }
1393
  });
1394
 
1395
+ await conn.sendMessage(m.chat, {
1396
+ delete: {
1397
  remoteJid: m.chat,
1398
+ fromMe: true,
1399
  id: m.id
1400
  }
1401
  });
 
1404
  }
1405
  }
1406
  break;
1407
+ case 'clearchat':
1408
  case 'clear': {
1409
  if (!isOwner) return reply(mess.only.owner);
1410
 
 
1417
  },
1418
  m.chat
1419
  );
1420
+ await sleep(1500)
1421
  reply(mess.success);
1422
  }
1423
  break;
1424
+ case 'block': {
1425
+ if (!isOwner) return reply(mess.only.owner);
1426
+ await loading();
1427
+ let users;
 
 
 
 
 
 
 
 
 
 
1428
 
1429
+ if (isGroup) {
1430
+ if (m.quoted && m.quoted.sender) {
1431
+ users = m.quoted.sender;
1432
+ } else if (text) {
1433
+ users = text.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
1434
+ }
1435
+ } else {
1436
+ users = m.chat;
1437
+ }
1438
+
1439
+ if (users && users.replace(/[^0-9]/g, '').length >= 7) {
1440
+ await conn.updateBlockStatus(users, "block");
1441
+ reply(mess.success);
1442
+ } else {
1443
+ reply("Please reply to a message or provide a valid number to block.");
1444
+ }
1445
+ break;
1446
+ }
1447
 
1448
+ case 'unblock': {
1449
+ if (!isOwner) return reply(mess.only.owner);
1450
+ await loading();
1451
+ let users;
1452
 
1453
+ if (isGroup) {
1454
+ users = m.quoted ? m.quoted.sender : text.replace(/[^0-9]/g, '') + '@s.whatsapp.net';
1455
+ } else {
1456
+ users = m.chat;
1457
+ }
1458
 
1459
+ if (users && users.replace(/[^0-9]/g, '').length >= 7) {
1460
+ await conn.updateBlockStatus(users, "unblock");
1461
+ reply(mess.success);
1462
+ } else {
1463
+ reply("Please reply to a message or provide a valid number to unblock.");
1464
+ }
1465
+ break;
1466
+ }
1467
  case 'setppbot':
1468
  case 'setpp': {
1469
  if (!isOwner) return reply(mess.only.owner)
 
1502
  }
1503
  }
1504
  break
1505
+ case 'setbio':
1506
  case 'setbotbio': {
1507
  if (!isOwner) return reply(mess.only.owner);
1508
  if (!q) return reply(`*Example: ${prefix + command} Text*`);
1509
  try {
1510
+ await conn.updateProfileStatus(q);
1511
  reply(`*Bio Has Been Changed To \`${q}\`*`);
1512
  } catch (error) {
1513
  console.error(error);
 
1515
  }
1516
  break;
1517
  }
1518
+ case 'restart':
1519
  if (!isOwner) return reply(mess.only.owner)
1520
  await loading()
1521
  reply(`*restarting...*`)
1522
  await sleep(3000)
1523
  process.exit()
1524
  break;
1525
+ case 'setname':
1526
+ case 'setbotname': {
1527
+ if (!isOwner) return reply(mess.only.owner);
1528
+ if (!text) return reply(`*Example: ${prefix + command} blue demon*`);
1529
 
1530
  try {
1531
  await conn.updateProfileName(text);
 
1536
  }
1537
  break;
1538
  }
1539
+ case 'owner':
1540
  case 'creator':
1541
  case 'dev': {
1542
  let who = m.mentionedJid && m.mentionedJid[0] ? m.mentionedJid[0] : m.fromMe ? conn.user.jid : m.sender;
 
1565
  quoted: m
1566
  })
1567
  break;
1568
+ case 'hidetag':
1569
+ case 'tag': {
1570
+ if (!isGroup) return reply(mess.only.group)
1571
+ if (!isAdmins && !isOwner) return reply(mess.only.admin);
1572
+ await loading();
1573
+ conn.sendMessage(m.chat, {
1574
+ text: q ? q : '',
1575
+ mentions: participants.map(a => a.id)
1576
+ }, {
1577
+ quoted: m
1578
+ })
1579
+ break
1580
+ };
1581
+ case 'kick': {
1582
+ if (!isGroup) return reply(mess.only.group);
1583
+ await loading();
1584
+ if (!isBotGroupAdmins) return reply(mess.only.Badmin);
1585
+ if (!isGroupAdmins && !isOwner) return reply(mess.only.admin);
1586
+
1587
+ let mentioned = [];
1588
+ if (m.quoted) {
1589
+ mentioned = [m.quoted.sender];
1590
+ } else if (mentionByTag.length > 0) {
1591
+ mentioned = mentionByTag;
1592
+ } else if (args[0]) {
1593
+ mentioned = [`${args[0].replace(/[^0-9]/g, '')}@s.whatsapp.net`];
1594
+ }
1595
 
1596
+ if (mentioned.length === 0) {
1597
+ return reply('Please reply to a user, tag someone, or provide a number to kick.');
1598
+ }
1599
 
1600
+ try {
1601
+ await conn.groupParticipantsUpdate(m.chat, mentioned, 'remove');
1602
+ reply(`Successfully kicked ${mentioned.map(v => `@${v.split('@')[0]}`).join(', ')}`, {
1603
+ mentions: mentioned
1604
+ });
1605
+ } catch (error) {
1606
+ console.error('Error in kick case:', error);
1607
+ reply('Failed to kick the user. Make sure I have the correct permissions.');
1608
+ }
1609
+ break;
1610
+ }
1611
 
1612
+ case 'add': {
1613
+ if (!isGroup) return reply(mess.only.group);
1614
+ if (!isBotGroupAdmins) return reply(mess.only.Badmin);
1615
+ if (!isGroupAdmins && !isOwner) return reply(mess.only.admin);
1616
+ await loading();
 
 
 
 
 
 
 
 
 
1617
 
1618
+ let number;
1619
+ if (args[0]) {
1620
+ number = args[0].replace(/[^0-9]/g, '');
1621
+ } else if (m.quoted && m.quoted.sender) {
1622
+ number = m.quoted.sender.split('@')[0];
1623
+ } else {
1624
+ return reply('Please provide a number or reply to a user to add.');
1625
+ }
1626
 
1627
+ const user = `${number}@s.whatsapp.net`;
 
 
 
 
 
 
 
 
 
 
 
 
 
1628
 
1629
+ try {
1630
+ await conn.groupParticipantsUpdate(m.chat, [user], 'add');
1631
+ await conn.sendMessage(m.chat, {
1632
+ text: fontx(`Successfully added @${number}\n> ${caption}`),
1633
+ mentions: [user]
1634
+ }, {
1635
+ quoted: m
1636
+ });
1637
+ } catch (error) {
1638
+ reply('Failed to add the user. Make sure the number is valid and I have the correct permissions.');
1639
+ console.error(error);
1640
+ }
1641
+ break;
1642
+ }
1643
+ case 'tinyurl': {
1644
+ if (!q) return reply(`Please provide a valid URL.\n\nExample: *${prefix + command} https://example.com*`);
1645
 
1646
+ await loading();
 
 
 
1647
 
1648
+ try {
1649
+ let apiUrl = `https://api-xx-xi.hf.space/api/tinyurl?url=${encodeURIComponent(q)}`;
1650
+ let response = await fetch(apiUrl);
1651
+ let json = await response.json();
1652
 
1653
+ if (!json.success || !json.short_url) {
1654
+ return reply("❌ Failed to shorten the URL. Please try again.");
1655
+ }
1656
 
1657
+ conn.sendMessage(m.chat, {
1658
+ text: fontx(`🔗 *Shortened URL:*\n\n📏 *Long:* `) + q + fontx(`\n✂️ *Short:* `) + json.short_url,
1659
+ }, {
1660
+ quoted: m
1661
+ });
1662
+
1663
+ } catch (error) {
1664
+ console.error("Error in tinyurl case:", error);
1665
+ reply("❌ An error occurred while shortening the URL. Please try again later.");
1666
+ }
1667
+ break;
1668
+ }
1669
  case 'areact': {
1670
  if (!isOwner) return reply(mess.only.owner);
1671
  if (!args[0]) return reply(`Example: ${prefix + command} on/off`);
 
1680
  }
1681
  break;
1682
  }
1683
+ case 'blueai': {
1684
  if (!q) {
1685
  return reply(`*Please provide a query.*\n\n*Example:* ${prefix + command} Hello, which model are you?`);
1686
  }
 
1699
  const aiResponse = res.data;
1700
  await conn.sendMessage(from, {
1701
  image: {
1702
+ url: './temp/blueimages/thumb.jpg',
1703
+ },
1704
  caption: fontx(`*BLUE AI Response:*\n${aiResponse}\n> ${caption}`),
1705
  }, {
1706
  quoted: m
 
1725
  if (res.status !== 200 || !res.data) {
1726
  return reply("Failed to process your request. Please try again later.");
1727
  }
1728
+ const aiResponse = res.data;
1729
  await conn.sendMessage(from, {
1730
  image: {
1731
  url: './temp/blueimages/gemini.jpg'
 
1749
  await loading();
1750
 
1751
  try {
1752
+ const apiUrl = `https://bk9.fun/ai/gemini?q=${encodeURIComponent(q)}`;
1753
  const response = await fetch(apiUrl);
1754
  const res = await response.json();
1755
  if (!res.status || !res.BK9) {
1756
  return reply("Failed to process your request. Please try again later.");
1757
  }
1758
 
1759
+ const aiResponse = res.BK9;
1760
 
1761
  await conn.sendMessage(from, {
1762
  image: {
 
1772
  }
1773
  break;
1774
  }
1775
+ case 'mute': {
1776
  if (!m.isGroup) return reply(mess.only.group);
1777
  if (!isOwner && !isAdmins) return reply(mess.only.admin);
1778
  if (!isBotAdmins) return reply(mess.only.Badmin);
 
1786
  }
1787
  break;
1788
  }
1789
+ case 'unmute': {
1790
  if (!m.isGroup) return reply(mess.only.group);
1791
  if (!isOwner && !isAdmins) return reply(mess.only.admin);
1792
  if (!isBotAdmins) return reply(mess.only.Badmin);
 
1875
  await conn.removeProfilePicture(from)
1876
  }
1877
  break
1878
+ case 'invite': {
1879
+ if (!isGroup) return reply(mess.only.group);
1880
+ if (!isBotGroupAdmins) return reply(mess.only.Badmin);
1881
+ if (!text) return reply(`\`No WhatsApp number detected.\`\n*Example: ${prefix + command} 255734980103*`);
1882
+ if (text.includes('+')) return reply(`\`Input the WhatsApp number without *+*\``);
1883
+ if (isNaN(text)) return reply(`Please enter only numbers, including your country code, without spaces.`);
1884
 
1885
+ let group = m.chat;
1886
 
1887
+ try {
1888
+ let link = 'https://chat.whatsapp.com/' + await conn.groupInviteCode(group);
1889
+ await conn.sendMessage(`${text}@s.whatsapp.net`, {
1890
+ text: ` *𝙂𝙍𝙊𝙐𝙋 𝙄𝙉𝙑𝙄𝙏𝘼𝙏𝙄𝙊𝙉 𝙇𝙄𝙉𝙆*\n*\`𝚈𝙾𝚄 𝙰𝚁𝙴 𝙸𝙽𝚅𝙸𝚃𝙴𝙳 𝚃𝙾 𝙹𝙾𝙸𝙽: ${groupMetadata.subject}\`*\n*𝙻𝙸𝙽𝙺:* ${link}\n> ${caption}`
1891
+ });
1892
 
1893
+ reply("*Group invitation link successfully sent.*");
1894
+ } catch (error) {
1895
+ console.error("Error in invite case:", error);
1896
+ reply("Failed to send the invite link. Please check the number and try again.");
1897
+ }
1898
 
1899
+ break;
1900
+ }
1901
+ case 'gcinfo': {
1902
+ if (!isGroup) return reply(mess.only.group)
1903
+ await loading()
1904
+ let _meta = await conn.groupMetadata(from)
1905
+ console.log(_meta)
1906
+ let _img = await conn.profilePictureUrl(_meta.id, 'image')
1907
 
1908
+ let caption = `*G R O U P I N F O*
1909
 
1910
 
1911
+ Anti Link : *${isAntiLink ? 'ACTIVE✅' : 'UNACTIVE❌'}*
1912
+ Anti Virtex : *${isAntiVirtex ? 'ACTIVE✅' : 'UNACTIVE❌'}*
1913
+ Anti Delete : *${isAntidelete ? 'ACTIVE✅' : 'UNACTIVE❌'}*
1914
+ Anti ViewOnce : *${isAntiViewOnce ? 'ACTIVE✅' : 'UNACTIVE❌'}*
1915
+ Anti Toxic : *${isAntiToxic ? 'ACTIVE✅' : 'UNACTIVE❌'}*
1916
 
1917
 
1918
+ ⭓ *Name :* ${_meta.subject}
1919
+ ⭓ *Group ID :* ${_meta.id}
1920
+ ⭓ *Created on :* ${moment(_meta.creation * 1000).format('ll')}
1921
+ ⭓ *GC owner:* ${_meta.subjectOwner}
1922
+ ⭓ *Admins length:* ${_meta.participants.filter(x => x.admin === 'admin').length}
1923
+ ⭓ *participants length:* ${_meta.participants.filter(x => x.admin === null).length}
1924
+ ⭓ *Desc :*
1925
+ ${_meta.desc}`
1926
 
1927
+ await conn.sendMessage(from, {
1928
+ caption,
1929
+ image: await getBuffer(_img)
1930
+ }, {
1931
+ quoted: fcall
1932
+ })
1933
+ }
1934
+ break;
1935
+ case 'revoke':
1936
+ case 'resetgclink': {
1937
+ if (!isGroup) return reply(mess.only.group)
1938
+ if (!isOwner && !isGroupAdmins) return reply(mess.only.admin)
1939
+ if (!isBotGroupAdmins) return reply(mess.only.Badmin)
1940
+ conn.groupRevokeInvite(from)
1941
+ }
1942
+ break
1943
+ case 'antilink': {
1944
+ if (!isGroup) return reply(mess.only.group)
1945
+ if (!isGroupAdmins && !isOwner) return reply(mess.only.admin)
1946
+ await loading()
1947
+ if ((args[0]) === 'on' || (args[0]) === 'enable' || (args[0]) === '1') {
1948
+ if (isAntiLink) return reply('the feature is already active.')
1949
+ db.data.chats[from].antilink = true
1950
+ let ih = `the antilink feature has been activated.`
1951
+ reply(ih)
1952
+ } else if ((args[0]) === 'off' || (args[0]) === 'disable' || (args[0]) === '0') {
1953
+ if (!isAntiLink) return reply('the antilink feature is already off.')
1954
+ db.data.chats[from].antilink = false
1955
+ let ih = `the antilink feature has been deactivated.`
1956
+ reply(ih)
1957
+ } else if (!q) {
1958
+ reply(`*anti link mode*\n ${prefix + command} on/off`)
1959
+ }
1960
+ }
1961
+ break;
1962
 
1963
 
1964
 
1965
 
1966
+ case 'text2img': {
1967
+ if (!q) return reply(`Please provide a prompt.\n\nExample: *${prefix + command} a big dog and a tiny cat*`);
1968
 
1969
+ await loading();
1970
 
1971
+ try {
1972
+ let imageUrl = `https://api-xx-xi.hf.space/api/text2img?prompt=${encodeURIComponent(q)}`;
1973
 
1974
+ await conn.sendMessage(m.chat, {
1975
+ image: {
1976
+ url: imageUrl
1977
+ },
1978
+ caption: fontx(`🖼️ *Generated Image*\n\n📜 *Prompt:* ${q}\n> ${caption}`),
1979
+ }, {
1980
+ quoted: m
1981
+ });
1982
 
1983
+ } catch (error) {
1984
+ console.error("Error in text2img case:", error);
1985
+ reply("❌ An error occurred while generating the image. Please try again later.");
1986
+ }
1987
+ break;
1988
+ }
1989
+ case 'tts':
1990
+ case 'say': {
1991
+ if (!q) {
1992
+ return reply(`\`Please provide text to convert to speech.\`\n\n*Example:*\n${prefix + command} hello`);
1993
+ }
1994
 
1995
+ try {
1996
+ await loading();
1997
+ const apiUrl = `https://bk9.fun/tools/tts?q=${encodeURIComponent(q)}&lang=en`;
1998
+ const response = await fetch(apiUrl);
1999
+ if (!response.ok) {
2000
+ return reply("Failed to process your request. Please try again later.");
2001
+ }
2002
+ await conn.sendMessage(from, {
2003
+ audio: {
2004
+ url: apiUrl
2005
+ },
2006
+ mimetype: "audio/mp4",
2007
+ fileName: `tts_${Date.now()}.mp3`,
2008
+ ptt: true, // Send as a voice note
2009
+ }, {
2010
+ quoted: m
2011
+ });
2012
 
2013
+ } catch (error) {
2014
+ console.error("Error in TTS case:", error);
2015
+ reply("An error occurred while processing your request. Please try again later.");
2016
+ }
2017
+ break;
2018
+ }
2019
+ case "vv":
2020
+ case "readviewonce": {
2021
+ if (!isOwner) return reply(mess.only.owner);
2022
 
2023
+ if (!quoted) return reply("reply to a view-once message!");
2024
 
2025
+ let msg = quoted;
2026
+ let msgType = Object.keys(msg)[0];
2027
 
2028
+ if (!msg[msgType]?.viewOnce) return reply("this isn't a view-once message!");
2029
+ await loading();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2030
  try {
2031
+ let media = await downloadMediaMessage(
2032
+ msg[msgType],
2033
+ msgType === "imageMessage" ? "image" :
2034
+ msgType === "videoMessage" ? "video" :
2035
+ "audio"
2036
+ );
2037
+
2038
+ if (!media) return reply("Failed to retrieve the media.");
2039
+
2040
+ let originalCaption = msg[msgType]?.caption || "No caption";
2041
+ let formattedCaption = originalCaption.split("\n").map(line => `> ${line}`).join("\n");
2042
+
2043
+ let finalCaption = `> ${caption}`;
2044
+
2045
+ if (/video/.test(msgType)) {
2046
+ await conn.sendMessage(chat, {
2047
+ video: media,
2048
+ caption: finalCaption
2049
+ }, {
2050
+ quoted: mess
2051
+ });
2052
+ } else if (/image/.test(msgType)) {
2053
+ await conn.sendMessage(chat, {
2054
+ image: media,
2055
+ caption: finalCaption
2056
+ }, {
2057
+ quoted: mess
2058
+ });
2059
+ } else if (/audio/.test(msgType)) {
2060
+ await conn.sendMessage(chat, {
2061
+ audio: media,
2062
+ mimetype: "audio/mpeg",
2063
+ ptt: true
2064
+ }, {
2065
+ quoted: mess
2066
+ });
2067
  }
 
 
 
 
 
 
 
 
 
 
2068
 
2069
  } catch (error) {
2070
+ console.error("Error retrieving View Once message:", error);
2071
+ return reply("Failed to retrieve the View Once message.");
2072
  }
 
2073
  }
2074
+ break;
2075
+ case 'qr': {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2076
  if (!q) return reply("Please provide text or a link to generate a QR code.");
2077
+ await loading();
2078
  const apiUrl = `https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=${encodeURIComponent(q)}`;
2079
 
2080
  await conn.sendMessage(m.chat, {
 
2093
  case 'sc': {
2094
  try {
2095
  await loading();
2096
+ await loading();
2097
  const zipUrl = 'https://github.com/BLUEXDEMONl/BLUEXDEMON-V5/archive/refs/heads/master.zip';
2098
 
2099
  const response = await fetch(zipUrl);
 
2103
  }
2104
 
2105
  const zipBuffer = await response.buffer();
2106
+ await conn.sendMessage(m.chat, {
2107
  document: zipBuffer,
2108
  mimetype: 'application/zip',
2109
  fileName: 'BLUE-DEMON-V5.zip',
 
2186
  }
2187
  break;
2188
  }
2189
+ case 'getdevice':
2190
  case 'device':
2191
  case 'phone': {
2192
  if (!m.quoted) return reply(`Please reply to a chat message with *${prefix + command}* to get device information.`);
 
2204
  }
2205
  break;
2206
  }
2207
+ case 'html': {
2208
  if (!q) return reply("Please provide a valid link to fetch.");
2209
 
2210
  const isValidUrl = (url) => {
 
2242
  }
2243
  break;
2244
  }
2245
+ case 'get': {
2246
  if (!q) return reply("Please provide a valid link to fetch.");
2247
  const isValidUrl = (url) => {
2248
  try {
 
2338
  }
2339
  break;
2340
  }
2341
+ case 'gross': {
2342
+ const grossEmojis = [
2343
+ '🤢', '🤮', '😖', '😫', '🤢🤢', '🤮🤮', '😵‍💫', '🤧', '🤢🤮', '😷',
2344
+ '🤢🤢🤮', '🤮🤮🤮', '🤢🤢🤢', '🤮🤢🤮', '😵', '🤒', '🤕', '🤢🤮🤢', '🤮😫🤢', '🤮🤢😵'
2345
+ ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2346
 
2347
+ const grossMsg = await conn.sendMessage(m.chat, {
2348
+ text: fontx(grossEmojis[0])
2349
+ }, {
2350
+ quoted: m
2351
+ });
2352
+
2353
+ const updateMessage = async (index = 1) => {
2354
+ if (index < grossEmojis.length) {
2355
+ await conn.relayMessage(m.chat, {
2356
+ protocolMessage: {
2357
+ key: grossMsg.key,
2358
+ type: 14,
2359
+ editedMessage: {
2360
+ conversation: fontx(grossEmojis[index])
2361
+ }
2362
+ }
2363
+ }, {});
2364
+ setTimeout(() => updateMessage(index + 1), 1000);
2365
+ }
2366
+ };
2367
+
2368
+ setTimeout(() => updateMessage(), 1000);
2369
+ break;
2370
+ }
2371
  case 'love': {
2372
  const heartEmojis = [
2373
  '♥️', '❣️', '💘', '💝', '💖', '💗', '💓', '💞', '💕', '❤️‍🔥',
 
2393
  setTimeout(() => updateMessage(index + 1), 1000);
2394
  }
2395
  };
2396
+ setTimeout(() => updateMessage(), 1000);
2397
  break;
2398
  }
2399
  case 'confuse':
2400
  case 'conf': {
2401
+ const confusedEmojis = [
2402
  '😕', '🤔', '😵', '😵‍💫', '🤷', '🤷‍♂️', '🤷‍♀️', '😮‍💨', '😐', '🤨',
2403
  '🙃', '😬', '😯', '😖', '😑', '😳', '🤪', '🤯'
2404
  ];
2405
 
2406
+ const confuseMsg = await conn.sendMessage(m.chat, {
2407
  text: confusedEmojis[0]
2408
  }, {
2409
  quoted: m
2410
  });
2411
+ const updateMessage = async (index = 1) => {
2412
  if (index < confusedEmojis.length) {
2413
  await conn.relayMessage(m.chat, {
2414
  protocolMessage: {
 
2419
  }
2420
  }
2421
  }, {});
2422
+ setTimeout(() => updateMessage(index + 1), 1000);
2423
  }
2424
  };
2425
+ setTimeout(() => updateMessage(), 1000);
2426
  break;
2427
  }
2428
  case 'angry':
2429
  case 'gtf': {
2430
+ const angryEmojis = [
2431
  '😡', '😠', '🤬', '👿', '💢', '🔥', '😾', '😤', '🤯', '💥',
2432
  '😾', '👺', '👊', '🗯️', '😒', '👎', '🥵', '🧨', '👹', '💣',
2433
  '😠', '👊', '💥', '😡', '🤬', '🔥', '🖕🏽'
2434
  ];
2435
 
2436
+ const angryMsg = await conn.sendMessage(m.chat, {
2437
  text: angryEmojis[0]
2438
  }, {
2439
  quoted: m
 
2455
  setTimeout(() => updateMessage(), 1000);
2456
  break;
2457
  }
2458
+ case 'flirt': {
2459
+ await loading();
2460
+ try {
2461
+ let response = await fetch('https://api-xx-xi.hf.space/api/flirt');
2462
+ let json = await response.json();
2463
+
2464
+ if (!json.success) {
2465
+ return reply(fontx("Failed to fetch a flirt line. Please try again later."));
2466
+ }
2467
+
2468
+ let {
2469
+ flirt
2470
+ } = json;
2471
+
2472
+ conn.sendMessage(m.chat, {
2473
+ text: fontx(`💘 *Flirty Line:*\n\n❝ ${flirt} ❞\n> ${caption}`)
2474
+ });
2475
+ } catch (error) {
2476
+ console.error("Error in flirt case:", error);
2477
+ reply(fontx("An error occurred while fetching the flirt line. Please try again later."));
2478
+ }
2479
+ break;
2480
+ }
2481
+ case 'joke': {
2482
+ await loading();
2483
+ try {
2484
+ let response = await fetch('https://api-xx-xi.hf.space/api/joke');
2485
+ let json = await response.json();
2486
+
2487
+ if (!json.success) {
2488
+ return reply(fontx("Failed to fetch a joke. Please try again later."));
2489
+ }
2490
+
2491
+ let {
2492
+ joke
2493
+ } = json;
2494
+
2495
+ conn.sendMessage(m.chat, {
2496
+ text: fontx(`😂 *Here's a joke for you!*\n\n❝ ${joke} ❞\n> ${caption}`)
2497
+ });
2498
+ } catch (error) {
2499
+ console.error("Error in joke case:", error);
2500
+ reply(fontx("An error occurred while fetching the joke. Please try again later."));
2501
+ }
2502
+ break;
2503
+ }
2504
+ case 'truth': {
2505
+ await loading();
2506
+ try {
2507
+ let response = await fetch('https://api-xx-xi.hf.space/api/truth');
2508
+ let json = await response.json();
2509
+
2510
+ if (!json.success) {
2511
+ return reply(fontx("Failed to fetch a truth question. Please try again later."));
2512
+ }
2513
+
2514
+ let {
2515
+ truth
2516
+ } = json;
2517
+
2518
+ conn.sendMessage(m.chat, {
2519
+ text: fontx(`🔍 *Truth Question*\n\n❝ ${truth} ❞\n> ${caption}`)
2520
+ });
2521
+ } catch (error) {
2522
+ console.error("Error in truth case:", error);
2523
+ reply(fontx("An error occurred while fetching the truth question. Please try again later."));
2524
+ }
2525
+ break;
2526
+ }
2527
+
2528
+ case 'dare': {
2529
+ await loading();
2530
+ try {
2531
+ let response = await fetch('https://api-xx-xi.hf.space/api/dare');
2532
+ let json = await response.json();
2533
+
2534
+ if (!json.success) {
2535
+ return reply(fontx("Failed to fetch a dare challenge. Please try again later."));
2536
+ }
2537
+
2538
+ let {
2539
+ dare
2540
+ } = json;
2541
+
2542
+ conn.sendMessage(m.chat, {
2543
+ text: fontx(`🔥 *Dare Challenge*\n\n❝ ${dare} ❞\n> ${caption}`)
2544
+ });
2545
+ } catch (error) {
2546
+ console.error("Error in dare case:", error);
2547
+ reply(fontx("An error occurred while fetching the dare challenge. Please try again later."));
2548
+ }
2549
+ break;
2550
+ }
2551
+ case 'rizz':
2552
+ case 'pickupline': {
2553
+ await loading();
2554
+ try {
2555
+ let response = await fetch('https://api-xx-xi.hf.space/api/rizz');
2556
+ let json = await response.json();
2557
+
2558
+ if (!json.success) {
2559
+ return reply(fontx("Failed to fetch a rizz line. Please try again later."));
2560
+ }
2561
+
2562
+ let {
2563
+ rizz
2564
+ } = json;
2565
+
2566
+ conn.sendMessage(m.chat, {
2567
+ text: fontx(`😏 *Rizz Line*\n\n❝ ${rizz} ❞\n> ${caption}`)
2568
+ });
2569
+ } catch (error) {
2570
+ console.error("Error in rizz case:", error);
2571
+ reply(fontx("An error occurred while fetching the rizz line. Please try again later."));
2572
+ }
2573
+ break;
2574
+ }
2575
+
2576
+ case 'quote': {
2577
+ await loading();
2578
+ try {
2579
+ let response = await fetch('https://api-xx-xi.hf.space/api/quote');
2580
+ let json = await response.json();
2581
+
2582
+ if (!json.success) {
2583
+ return reply(fontx("Failed to fetch a quote. Please try again later."));
2584
+ }
2585
+
2586
+ let {
2587
+ Author,
2588
+ quote
2589
+ } = json;
2590
+
2591
+ conn.sendMessage(m.chat, {
2592
+ text: fontx(`📜 *Quote of the Day*\n\n❝ ${quote} ❞\n\n— *${Author}*\n> ${caption}`)
2593
+ });
2594
+ } catch (error) {
2595
+ console.error("Error in quote case:", error);
2596
+ reply(fontx("An error occurred while fetching the quote. Please try again later."));
2597
+ }
2598
+ break;
2599
+ }
2600
+ case 'aniquote':
2601
+ case 'animequote': {
2602
+ await loading();
2603
+ try {
2604
+ let apiUrl = `https://api-xx-xi.hf.space/api/aniquote`;
2605
+ let response = await fetch(apiUrl);
2606
+ let json = await response.json();
2607
+
2608
+ if (!json.success) {
2609
+ return conn.sendMessage(m.chat, {
2610
+ text: "❌ Failed to fetch an anime quote. Please try again later."
2611
+ });
2612
+ }
2613
+ let {
2614
+ author,
2615
+ anime,
2616
+ quote
2617
+ } = json;
2618
+ conn.sendMessage(m.chat, {
2619
+ text: fontx(`🎌 *Anime Quote*\n\n💬 *Quote:* "${quote}"\n👤 *Author:* ${author}\n📺 *Anime:* ${anime}\n> ${caption}`)
2620
+ }, {
2621
+ quoted: m
2622
+ });
2623
+ } catch (error) {
2624
+ console.error("Error in aniquote case:", error);
2625
+ conn.sendMessage(m.chat, {
2626
+ text: "❌ An error occurred while fetching the quote. Please try again later."
2627
+ });
2628
+ }
2629
+ break;
2630
+ }
2631
+ case 'antivirtex': {
2632
+ if (!isGroup) return reply(mess.only.group);
2633
+ if (!isGroupAdmins) return reply(mess.only.admin);
2634
+ if (!isBotGroupAdmins) return reply(mess.only.Badmin);
2635
+ await loading()
2636
+ const mode = args[0]?.toLowerCase();
2637
+ if (["on", "enable", "1"].includes(mode)) {
2638
+ if (isAntiVirtex) return reply("antivirtex is already enabled!");
2639
+ db.data.chats[from].antivirtex = true;
2640
+ reply("successfully enabled antivirtex!");
2641
+ } else if (["off", "disable", "0"].includes(mode)) {
2642
+ if (!isAntiVirtex) return reply("Antivirtex Is Already Disabled!");
2643
+ db.data.chats[from].antivirtex = false;
2644
+ reply("successfully disabled antivirtex!");
2645
+ } else {
2646
+ reply(`*anti virtex mode*\nUsage: ${prefix + command} on/off`);
2647
+ }
2648
+ break;
2649
+ }
2650
+ case 'promote':
2651
+ if (!isGroup && !isGroupAdmins) return reply(mess.only.group)
2652
+ if (!isBotGroupAdmins) return reply(mess.only.Badmin)
2653
+ await loading()
2654
+ let xxp = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : q.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
2655
+ await conn.groupParticipantsUpdate(m.chat, [xxp], 'promote')
2656
+ reply(mess.success)
2657
+ break
2658
+ case 'demote':
2659
+ if (!isGroup && !isGroupAdmins) return reply(mess.only.group)
2660
+ if (!isBotGroupAdmins) return reply(mess.only.Badmin)
2661
+ await loading()
2662
+ let xxp = m.mentionedJid[0] ? m.mentionedJid[0] : m.quoted ? m.quoted.sender : q.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
2663
+ await conn.groupParticipantsUpdate(m.chat, [xxp], 'demote')
2664
+ reply(mess.success)
2665
+ break
2666
+
2667
+
2668
+
2669
+
2670
+
2671
+
2672
+
2673
+
2674
+
2675
+
2676
+
2677
+
2678
+
2679
+
2680
+
2681
+
2682
+
2683
+
2684
+
2685
+
2686
+
2687
+
2688
+
2689
+
2690
+
2691
+
2692
+
2693
+
2694
+
2695
+
2696
+
2697
+
2698
+
2699
+
2700
+
2701
+
2702
+
2703
+
2704
+
2705
+
2706
+
2707
+
2708
+
2709
+
2710
+
2711
+
2712
+
2713
+
2714
+
2715
+
2716
+
2717
+
2718
+
2719
+
2720
+
2721
+
2722
+
2723
+
2724
+
2725
+
2726
+
2727
+
2728
+
2729
+
2730
+
2731
+
2732
+
2733
+
2734
+
2735
+
2736
+
2737
+
2738
+
2739
+
2740
+
2741
+
2742
+
2743
+
2744
+
2745
+
2746
+
2747
+
2748
+
2749
+
2750
+
2751
+
2752
+
2753
+
2754
+
2755
+
2756
+
2757
+
2758
+
2759
+
2760
+
2761
+
2762
+
2763
+
2764
+
2765
+
2766
+
2767
+
2768
+
2769
+
2770
+
2771
+
2772
+
2773
+
2774
+
2775
+
2776
+
2777
+
2778
+
2779
+
2780
+
2781
+
2782
+
2783
+
2784
+
2785
+
2786
+
2787
+
2788
+
2789
+
2790
+
2791
+
2792
+
2793
+
2794
+
2795
+
2796
+
2797
+
2798
+
2799
+
2800
+
2801
+
2802
+
2803
+
2804
+
2805
+
2806
+
2807
+
2808
+
2809
+
2810
+
2811
+
2812
+
2813
+
2814
+
2815
+
2816
 
 
 
 
2817
 
 
2818
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2819
 
 
 
 
2820
 
 
2821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2822
 
 
 
 
2823
 
 
2824
 
 
 
 
 
 
 
 
 
 
2825
 
 
 
 
 
 
2826
 
 
 
 
2827
 
 
2828
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2829
 
 
 
 
2830
 
 
2831
 
 
 
 
 
 
 
 
 
 
2832
 
 
 
 
 
 
2833
 
 
 
 
2834
 
 
2835
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2836
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2837
  default:
2838
  }
2839
  if (!isGroup && user && isPremium && new Date - user.pc < 86400000) {} else if (!isGroup && user && isPremium && !itsMe) {