API-XX commited on
Commit
dcd705b
Β·
verified Β·
1 Parent(s): 90d7db9

Upload case.js

Browse files
Files changed (1) hide show
  1. case.js +83 -2
case.js CHANGED
@@ -967,6 +967,8 @@ module.exports = async (conn, dev, chatUpdate, store) => {
967
  > β”€γ€Ž \`π†π‘πŽπ”π πŒπ„ππ”\` 』
968
  > ${sign} tag
969
  > ${sign} tagall
 
 
970
  > ─────────────❐
971
 
972
  > β”€γ€Ž \`πŒπ„πƒπˆπ€ πƒπŽπ–ππ‹πŽπ€πƒπ’\` 』
@@ -1129,7 +1131,9 @@ case 'getsudo': {
1129
  await loading();
1130
  let filesToUpdate = [
1131
  { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js', path: './message/case.js', name: 'case.js' },
1132
- { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js', path: './temp/media/links.js', name: 'links.js' }
 
 
1133
  ];
1134
 
1135
  try {
@@ -1429,12 +1433,68 @@ if (!isGroup) return reply(mess.only.group)
1429
  if (!isAdmins && !isOwner) return reply(mess.only.admin);
1430
  await loading();
1431
  conn.sendMessage(m.chat, { text : q ? q : '' , mentions: participants.map(a => a.id)}, {quoted:m})
1432
- break;
 
 
 
 
 
 
1433
 
 
 
 
 
 
 
 
 
1434
 
 
 
 
1435
 
 
 
 
 
 
 
 
 
 
 
 
1436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1438
 
1439
 
1440
 
@@ -1636,6 +1696,27 @@ break;
1636
 
1637
 
1638
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1639
 
1640
  default:
1641
  }
 
967
  > β”€γ€Ž \`π†π‘πŽπ”π πŒπ„ππ”\` 』
968
  > ${sign} tag
969
  > ${sign} tagall
970
+ > ${sign} kick
971
+ > ${sign} add
972
  > ─────────────❐
973
 
974
  > β”€γ€Ž \`πŒπ„πƒπˆπ€ πƒπŽπ–ππ‹πŽπ€πƒπ’\` 』
 
1131
  await loading();
1132
  let filesToUpdate = [
1133
  { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/case.js', path: './message/case.js', name: 'case.js' },
1134
+ { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/links.js', path: './temp/media/links.js', name: 'links.js' },
1135
+ { url: 'https://huggingface.co/spaces/API-XX/TEST/resolve/main/group.js', path: './message/group.js', name: 'group.js' },
1136
+ { url: 'https://huggingface.co/spaces/API-XX/TEST/raw/main/message.js', path: './message/message.js', name: 'message.js' },
1137
  ];
1138
 
1139
  try {
 
1433
  if (!isAdmins && !isOwner) return reply(mess.only.admin);
1434
  await loading();
1435
  conn.sendMessage(m.chat, { text : q ? q : '' , mentions: participants.map(a => a.id)}, {quoted:m})
1436
+ break
1437
+ };
1438
+ case 'kick': {
1439
+ if (!isGroup) return reply(mess.only.group);
1440
+ await loading();
1441
+ if (!isBotGroupAdmins) return reply(mess.only.Badmin);
1442
+ if (!isGroupAdmins && !isOwner) return reply(mess.only.admin);
1443
 
1444
+ let mentioned = [];
1445
+ if (m.quoted) {
1446
+ mentioned = [m.quoted.sender];
1447
+ } else if (mentionByTag.length > 0) {
1448
+ mentioned = mentionByTag;
1449
+ } else if (args[0]) {
1450
+ mentioned = [`${args[0].replace(/[^0-9]/g, '')}@s.whatsapp.net`];
1451
+ }
1452
 
1453
+ if (mentioned.length === 0) {
1454
+ return reply('Please reply to a user, tag someone, or provide a number to kick.');
1455
+ }
1456
 
1457
+ try {
1458
+ await conn.groupParticipantsUpdate(m.chat, mentioned, 'remove');
1459
+ reply(`Successfully kicked ${mentioned.map(v => `@${v.split('@')[0]}`).join(', ')}`, {
1460
+ mentions: mentioned
1461
+ });
1462
+ } catch (error) {
1463
+ console.error('Error in kick case:', error);
1464
+ reply('Failed to kick the user. Make sure I have the correct permissions.');
1465
+ }
1466
+ break;
1467
+ }
1468
 
1469
+ case 'add': {
1470
+ if (!isGroup) return reply(mess.only.group);
1471
+ if (!isBotGroupAdmins) return reply(mess.only.Badmin);
1472
+ if (!isGroupAdmins && !isOwner) return reply(mess.only.admin);
1473
+ await loading();
1474
+
1475
+ let number;
1476
+ if (args[0]) {
1477
+ number = args[0].replace(/[^0-9]/g, '');
1478
+ } else if (m.quoted && m.quoted.sender) {
1479
+ number = m.quoted.sender.split('@')[0];
1480
+ } else {
1481
+ return reply('Please provide a number or reply to a user to add.');
1482
+ }
1483
 
1484
+ const user = `${number}@s.whatsapp.net`;
1485
+
1486
+ try {
1487
+ await conn.groupParticipantsUpdate(m.chat, [user], 'add');
1488
+ await conn.sendMessage(m.chat, {
1489
+ text: fontx(`Successfully added @${number}`),
1490
+ mentions: [user]
1491
+ }, { quoted: m });
1492
+ } catch (error) {
1493
+ reply('Failed to add the user. Make sure the number is valid and I have the correct permissions.');
1494
+ console.error(error);
1495
+ }
1496
+ break;
1497
+ }
1498
 
1499
 
1500
 
 
1696
 
1697
 
1698
 
1699
+
1700
+ case 'aniquote': {
1701
+ await loading();
1702
+ try {
1703
+ let apiUrl = `https://api-xx-xi.hf.space/api/aniquote`;
1704
+ let response = await fetch(apiUrl);
1705
+ let json = await response.json();
1706
+
1707
+ if (!json.success) {
1708
+ return conn.sendMessage(m.chat, { text: "❌ Failed to fetch an anime quote. Please try again later." });
1709
+ }
1710
+ let { author, anime, quote } = json;
1711
+ conn.sendMessage(m.chat, {
1712
+ text: fontx(`🎌 *Anime Quote*\n\nπŸ’¬ *Quote:* "${quote}"\nπŸ‘€ *Author:* ${author}\nπŸ“Ί *Anime:* ${anime}`)
1713
+ }, { quoted: m });
1714
+ } catch (error) {
1715
+ console.error("Error in aniquote case:", error);
1716
+ conn.sendMessage(m.chat, { text: "❌ An error occurred while fetching the quote. Please try again later." });
1717
+ }
1718
+ break;
1719
+ }
1720
 
1721
  default:
1722
  }