levix-bot 4.1.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/package.json +1 -1
  2. package/public/dashboard/assets/{index-DngAcp-o.js → index-4AuqfnH5.js} +80 -80
  3. package/public/dashboard/index.html +1 -1
  4. package/scheduler.cjs +6 -1
  5. package/src/commands/autoschedule.cjs +40 -10
  6. package/src/commands/blacklist.cjs +35 -10
  7. package/src/commands/block.cjs +18 -5
  8. package/src/commands/calc.cjs +90 -24
  9. package/src/commands/debt.cjs +59 -33
  10. package/src/commands/deleteschedule.cjs +21 -5
  11. package/src/commands/digit.cjs +34 -8
  12. package/src/commands/gemini.cjs +217 -87
  13. package/src/commands/group/add.cjs +46 -13
  14. package/src/commands/group/all.cjs +15 -5
  15. package/src/commands/group/antiSpam.cjs +11 -4
  16. package/src/commands/group/antilink.cjs +36 -18
  17. package/src/commands/group/approveall.cjs +22 -7
  18. package/src/commands/group/clearwarns.cjs +18 -5
  19. package/src/commands/group/deletenote.cjs +18 -5
  20. package/src/commands/group/demote.cjs +25 -7
  21. package/src/commands/group/kick.cjs +28 -12
  22. package/src/commands/group/media.cjs +31 -12
  23. package/src/commands/group/members.cjs +21 -6
  24. package/src/commands/group/note.cjs +14 -4
  25. package/src/commands/group/promote.cjs +22 -6
  26. package/src/commands/group/removeall.cjs +13 -3
  27. package/src/commands/group/rules.cjs +20 -5
  28. package/src/commands/group/save.cjs +20 -5
  29. package/src/commands/group/setname.cjs +19 -6
  30. package/src/commands/group/setpp.cjs +21 -6
  31. package/src/commands/group/setrules.cjs +17 -5
  32. package/src/commands/group/setwarn.cjs +23 -7
  33. package/src/commands/group/tagadmins.cjs +16 -6
  34. package/src/commands/group/warn.cjs +35 -15
  35. package/src/commands/group/warns.cjs +33 -13
  36. package/src/commands/group/welcome.cjs +34 -16
  37. package/src/commands/group.cjs +96 -70
  38. package/src/commands/help.cjs +270 -135
  39. package/src/commands/lang.cjs +46 -13
  40. package/src/commands/listschedules.cjs +28 -11
  41. package/src/commands/loop.cjs +43 -9
  42. package/src/commands/memory.cjs +90 -30
  43. package/src/commands/mod.cjs +69 -27
  44. package/src/commands/notes.cjs +15 -5
  45. package/src/commands/perm.cjs +52 -20
  46. package/src/commands/ping.cjs +15 -3
  47. package/src/commands/poll.cjs +40 -9
  48. package/src/commands/prayer.cjs +28 -12
  49. package/src/commands/qr.cjs +20 -5
  50. package/src/commands/rand.cjs +54 -12
  51. package/src/commands/restart.cjs +13 -3
  52. package/src/commands/schedule.cjs +32 -9
  53. package/src/commands/score.cjs +26 -10
  54. package/src/commands/setprefix.cjs +27 -5
  55. package/src/commands/shortlink.cjs +36 -10
  56. package/src/commands/shutdown.cjs +13 -3
  57. package/src/commands/status.cjs +32 -11
  58. package/src/commands/sticker.cjs +34 -7
  59. package/src/commands/stt.cjs +163 -108
  60. package/src/commands/todo.cjs +31 -9
  61. package/src/commands/tts.cjs +25 -7
  62. package/src/commands/unblock.cjs +17 -4
  63. package/src/commands/weather.cjs +55 -17
  64. package/src/config/settings.cjs +1 -1
  65. package/src/handlers/command.handler.js +50 -10
  66. package/src/handlers/group.handler.js +5 -1
  67. package/src/handlers/message.handler.js +9 -0
  68. package/src/middleware/antispam.middleware.js +9 -2
  69. package/src/services/aiAgent.cjs +40 -39
  70. package/src/services/aiProviders.cjs +46 -19
  71. package/src/services/aiRouter.cjs +2 -1
  72. package/src/services/aiTools.cjs +2 -1
  73. package/src/utils/commandDocs.cjs +58 -0
  74. package/src/utils/geminiMedia.cjs +168 -0
  75. package/src/utils/i18n.cjs +113 -0
  76. package/src/utils/markdownParser.cjs +4 -2
  77. package/src/utils/memory.cjs +2 -1
  78. package/src/utils/permissionLevel.cjs +34 -6
  79. package/src/utils/providerUrl.cjs +29 -2
  80. package/src/utils/sendBotMessage.cjs +7 -3
  81. package/src/utils/sendBotMessage.esm.js +13 -3
  82. package/src/utils/statusMessage.cjs +11 -4
@@ -1,11 +1,18 @@
1
1
  // file: /commands/add.js (Upgraded with Invite Fallback)
2
2
  const logger = require("../../utils/logger.cjs");
3
+ const { tr } = require("../../utils/i18n.cjs");
3
4
  const normalizeJid = require("../../utils/normalizeJid.esm.js").default;
4
5
 
5
6
  module.exports = {
6
7
  name: "add",
7
- description: "Adds a member to the group or sends an invite if privacy settings block it.",
8
- usage: "add [admin] <رقم الموبايل>",
8
+ description: {
9
+ en: "Adds a member to the group, or sends an invite if their privacy settings block it.",
10
+ ar: "يضيف عضوًا إلى المجموعة، أو يرسل له دعوة إذا منعت إعدادات الخصوصية إضافته.",
11
+ },
12
+ usage: {
13
+ en: "add [admin] <phone number>",
14
+ ar: "add [admin] <رقم الهاتف>",
15
+ },
9
16
  chat: "group",
10
17
  userAdminRequired: true,
11
18
  botAdminRequired: true,
@@ -53,12 +60,18 @@ module.exports = {
53
60
  const cleanNumber = numberArg.replace(/\D/g, "");
54
61
  if (!cleanNumber)
55
62
  return await sock.sendMessage(groupId, {
56
- text: "يرجى تقديم رقم هاتف صالح، أو عمل منشن، أو إرسال جهة اتصال.",
63
+ text: tr(
64
+ "Give a valid phone number, a mention, or a contact card.",
65
+ "يرجى تقديم رقم هاتف صالح، أو عمل منشن، أو إرسال جهة اتصال.",
66
+ ),
57
67
  });
58
68
  targetJid = `${cleanNumber}@s.whatsapp.net`;
59
69
  } else {
60
70
  return await sock.sendMessage(groupId, {
61
- text: "لإضافة عضو، قم بعمل منشن له، أو أرسل رقمه، أو أرسل جهة الاتصال الخاصة به.",
71
+ text: tr(
72
+ "To add someone, mention them, send their number, or send their contact card.",
73
+ "لإضافة عضو، قم بعمل منشن له، أو أرسل رقمه، أو أرسل جهة الاتصال الخاصة به.",
74
+ ),
62
75
  });
63
76
  }
64
77
  // --- End of Target Identification Logic ---
@@ -69,23 +82,32 @@ module.exports = {
69
82
  );
70
83
  if (isAlreadyMember) {
71
84
  return await sock.sendMessage(groupId, {
72
- text: `⚠️ العضو @${targetJid.split("@")[0]} موجود بالفعل في الجروب.`,
85
+ text: tr(
86
+ `⚠️ @${targetJid.split("@")[0]} is already in the group.`,
87
+ `⚠️ العضو @${targetJid.split("@")[0]} موجود بالفعل في الجروب.`,
88
+ ),
73
89
  mentions: [targetJid],
74
90
  });
75
91
  }
76
92
 
77
93
  await sock.sendMessage(groupId, {
78
- text: `جاري محاولة إضافة @${targetJid.split("@")[0]}...`,
94
+ text: tr(
95
+ `Trying to add @${targetJid.split("@")[0]}...`,
96
+ `جاري محاولة إضافة @${targetJid.split("@")[0]}...`,
97
+ ),
79
98
  mentions: [targetJid],
80
99
  });
81
100
  const response = await sock.groupParticipantsUpdate(groupId, [targetJid], "add");
82
101
  const status = response[0].status;
83
102
 
84
103
  if (status === "200") {
85
- let successMsg = `✅ تم إضافة @${targetJid.split("@")[0]} بنجاح.`;
104
+ let successMsg = tr(
105
+ `✅ Added @${targetJid.split("@")[0]}.`,
106
+ `✅ تم إضافة @${targetJid.split("@")[0]} بنجاح.`,
107
+ );
86
108
  if (shouldPromote) {
87
109
  await sock.groupParticipantsUpdate(groupId, [targetJid], "promote");
88
- successMsg += `\n👑 وتمت ترقيته إلى مشرف.`;
110
+ successMsg += tr(`\n👑 And made them an admin.`, `\n👑 وتمت ترقيته إلى مشرف.`);
89
111
  }
90
112
  await sock.sendMessage(groupId, {
91
113
  text: successMsg,
@@ -93,9 +115,14 @@ module.exports = {
93
115
  });
94
116
  } else if (status === "403") {
95
117
  await sock.sendMessage(groupId, {
96
- text: `⚠️ لا يمكن إضافة @${
97
- targetJid.split("@")[0]
98
- } مباشرة بسبب إعدادات الخصوصية لديه.\n\nهل تود إرسال رابط دعوة له في الخاص؟\nأرسل \`yes\` للتأكيد.`,
118
+ text: tr(
119
+ `⚠️ @${
120
+ targetJid.split("@")[0]
121
+ } can't be added directly because of their privacy settings.\n\nSend them an invite link in private?\nSend \`yes\` to confirm.`,
122
+ `⚠️ لا يمكن إضافة @${
123
+ targetJid.split("@")[0]
124
+ } مباشرة بسبب إعدادات الخصوصية لديه.\n\nهل تود إرسال رابط دعوة له في الخاص؟\nأرسل \`yes\` للتأكيد.`,
125
+ ),
99
126
  mentions: [targetJid],
100
127
  });
101
128
 
@@ -114,13 +141,19 @@ module.exports = {
114
141
  }, 30000);
115
142
  } else {
116
143
  await sock.sendMessage(groupId, {
117
- text: `⚠️ لم أتمكن من إضافة الرقم. (كود الحالة: ${status})`,
144
+ text: tr(
145
+ `⚠️ I couldn't add that number. (status code: ${status})`,
146
+ `⚠️ لم أتمكن من إضافة الرقم. (كود الحالة: ${status})`,
147
+ ),
118
148
  });
119
149
  }
120
150
  } catch (error) {
121
151
  logger.error({ err: error, command: "add" }, "Error in !add command");
122
152
  await sock.sendMessage(groupId, {
123
- text: "حدث خطأ. تأكد من أنني مشرف وأن الرقم صحيح.",
153
+ text: tr(
154
+ "Something went wrong. Make sure I'm an admin and the number is right.",
155
+ "حدث خطأ. تأكد من أنني مشرف وأن الرقم صحيح.",
156
+ ),
124
157
  });
125
158
  }
126
159
  },
@@ -1,10 +1,17 @@
1
1
  // file: /commands/all.js
2
2
  const logger = require("../../utils/logger.cjs");
3
+ const { tr } = require("../../utils/i18n.cjs");
3
4
 
4
5
  module.exports = {
5
6
  name: "all",
6
- description: "Mentions all members of the group.",
7
- usage: "all [رسالة التنبيه]",
7
+ description: {
8
+ en: "Mentions every member of the group.",
9
+ ar: "يذكر (منشن) جميع أعضاء المجموعة.",
10
+ },
11
+ usage: {
12
+ en: "all [message]",
13
+ ar: "all [رسالة التنبيه]",
14
+ },
8
15
  chat: "group",
9
16
 
10
17
  async execute(sock, msg, args) {
@@ -21,9 +28,9 @@ module.exports = {
21
28
 
22
29
  // 7. Prepare the message text and the mentions array
23
30
  // You can customize the message text here
24
- let text = "📢 | تنبيه للجميع";
31
+ let text = tr("📢 | Attention everyone", "📢 | تنبيه للجميع");
25
32
  if (args && args.length > 0) {
26
- text = `*📢 | تنبيه للجميع:*\n${args.join(" ")}`;
33
+ text = tr(`*📢 | Attention everyone:*\n`, `*📢 | تنبيه للجميع:*\n`) + args.join(" ");
27
34
  }
28
35
 
29
36
  // 8. Send the message with mentions
@@ -36,7 +43,10 @@ module.exports = {
36
43
  logger.error(error, "[Error] in !all command:");
37
44
  // Send a reply in case of an error
38
45
  await sock.sendMessage(msg.key.remoteJid, {
39
- text: "حدث خطأ أثناء محاولة عمل منشن للجميع.",
46
+ text: tr(
47
+ "Something went wrong while mentioning everyone.",
48
+ "حدث خطأ أثناء محاولة عمل منشن للجميع.",
49
+ ),
40
50
  });
41
51
  }
42
52
  },
@@ -1,6 +1,7 @@
1
1
  // commands/antiSpam.js
2
2
  const logger = require("../../utils/logger.cjs");
3
3
  const { isAdminInGroupSync } = require("../../utils/permissions.cjs");
4
+ const { tr } = require("../../utils/i18n.cjs");
4
5
 
5
6
  // إعدادات يمكن تعديلها
6
7
  const SPAM_MESSAGE_COUNT = 3; // عدد الرسائل المتطابقة لتعتبر سبام
@@ -66,7 +67,10 @@ async function handleAntiSpam(sock, msg) {
66
67
  antiSpamCache.delete(cacheKey);
67
68
 
68
69
  await sock.sendMessage(groupId, {
69
- text: `🚫 تم طرد المستخدم @${senderId.split("@")[0]} تلقائيًا بسبب الإزعاج.`,
70
+ text: tr(
71
+ `🚫 @${senderId.split("@")[0]} was removed automatically for spamming.`,
72
+ `🚫 تم طرد المستخدم @${senderId.split("@")[0]} تلقائيًا بسبب الإزعاج.`,
73
+ ),
70
74
  mentions: [senderId],
71
75
  });
72
76
  await sock.groupParticipantsUpdate(groupId, [senderId], "remove");
@@ -75,9 +79,12 @@ async function handleAntiSpam(sock, msg) {
75
79
  `[AntiSpam] Warning ${senderId} in ${groupId}. Warn count: ${userData.warnCount}`,
76
80
  );
77
81
  await sock.sendMessage(groupId, {
78
- text: `⚠️ تحذير للمستخدم @${
79
- senderId.split("@")[0]
80
- } بسبب تكرار الرسائل.\nالتحذير رقم: ${userData.warnCount}`,
82
+ text: tr(
83
+ `⚠️ Warning for @${senderId.split("@")[0]}: repeated messages.\nWarning number: ${userData.warnCount}`,
84
+ `⚠️ تحذير للمستخدم @${
85
+ senderId.split("@")[0]
86
+ } بسبب تكرار الرسائل.\nالتحذير رقم: ${userData.warnCount}`,
87
+ ),
81
88
  mentions: [senderId],
82
89
  });
83
90
  }
@@ -4,13 +4,19 @@ const logger = require("../../utils/logger.cjs");
4
4
  const { isOwnerJidSync, isAdminInGroupSync } = require("../../utils/permissions.cjs");
5
5
  const { visibleText } = require("../../utils/messageContent.cjs");
6
6
  const { resolveGroupMetadata } = require("../../utils/groupMetadataCache.cjs");
7
+ const { tr } = require("../../utils/i18n.cjs");
7
8
 
8
9
  // --- The Main Command Logic ---
9
10
  const command = {
10
11
  name: "antilink",
11
- description: "Advanced control for the anti-link feature.",
12
- usage:
13
- "antilink [status]\nantilink <on|off>\nantilink mode <ALL|WHITELIST|BLACKLIST>\nantilink <allow|disallow> <دومين>",
12
+ description: {
13
+ en: "Advanced control of the anti-link protection.",
14
+ ar: "تحكم متقدم في ميزة منع الروابط.",
15
+ },
16
+ usage: {
17
+ en: "antilink [status]\nantilink <on|off>\nantilink mode <ALL|WHITELIST|BLACKLIST>\nantilink <allow|disallow> <domain>",
18
+ ar: "antilink [status]\nantilink <on|off>\nantilink mode <ALL|WHITELIST|BLACKLIST>\nantilink <allow|disallow> <النطاق>",
19
+ },
14
20
  chat: "group",
15
21
  userAdminRequired: true,
16
22
 
@@ -35,25 +41,28 @@ const command = {
35
41
  case "on":
36
42
  antilinkConfig.enabled = true;
37
43
  await sock.sendMessage(groupId, {
38
- text: "✅ تم تفعيل نظام منع الروابط.",
44
+ text: tr("✅ Anti-link is on.", "✅ تم تفعيل نظام منع الروابط."),
39
45
  });
40
46
  break;
41
47
  case "off":
42
48
  antilinkConfig.enabled = false;
43
49
  await sock.sendMessage(groupId, {
44
- text: "☑️ تم تعطيل نظام منع الروابط.",
50
+ text: tr("☑️ Anti-link is off.", "☑️ تم تعطيل نظام منع الروابط."),
45
51
  });
46
52
  break;
47
53
  case "mode": {
48
54
  const mode = args[1] ? args[1].toUpperCase() : "";
49
55
  if (!["ALL", "WHITELIST", "BLACKLIST"].includes(mode)) {
50
56
  return await sock.sendMessage(groupId, {
51
- text: "الوضع غير صالح. الأوضاع المتاحة: `ALL`, `WHITELIST`, `BLACKLIST`",
57
+ text: tr(
58
+ "Invalid mode. Available: `ALL`, `WHITELIST`, `BLACKLIST`",
59
+ "الوضع غير صالح. الأوضاع المتاحة: `ALL`, `WHITELIST`, `BLACKLIST`",
60
+ ),
52
61
  });
53
62
  }
54
63
  antilinkConfig.mode = mode;
55
64
  await sock.sendMessage(groupId, {
56
- text: `✅ تم تغيير وضع منع الروابط إلى: ${mode}`,
65
+ text: tr(`✅ Anti-link mode is now: ${mode}`, `✅ تم تغيير وضع منع الروابط إلى: ${mode}`),
57
66
  });
58
67
  break;
59
68
  }
@@ -61,13 +70,16 @@ const command = {
61
70
  const domainToAllow = args[1] ? args[1].toLowerCase() : "";
62
71
  if (!domainToAllow)
63
72
  return await sock.sendMessage(groupId, {
64
- text: "يرجى تحديد دومين للسماح به.",
73
+ text: tr("Say which domain to allow.", "يرجى تحديد دومين للسماح به."),
65
74
  });
66
75
  if (!antilinkConfig.allowed_domains.includes(domainToAllow)) {
67
76
  antilinkConfig.allowed_domains.push(domainToAllow);
68
77
  }
69
78
  await sock.sendMessage(groupId, {
70
- text: `✅ تم إضافة '${domainToAllow}' إلى قائمة الدومينات المسموح بها.`,
79
+ text: tr(
80
+ `✅ '${domainToAllow}' is now allowed.`,
81
+ `✅ تم إضافة '${domainToAllow}' إلى قائمة الدومينات المسموح بها.`,
82
+ ),
71
83
  });
72
84
  break;
73
85
  }
@@ -75,24 +87,27 @@ const command = {
75
87
  const domainToDisallow = args[1] ? args[1].toLowerCase() : "";
76
88
  if (!domainToDisallow)
77
89
  return await sock.sendMessage(groupId, {
78
- text: "يرجى تحديد دومين لإزالته.",
90
+ text: tr("Say which domain to remove.", "يرجى تحديد دومين لإزالته."),
79
91
  });
80
92
  antilinkConfig.allowed_domains = antilinkConfig.allowed_domains.filter(
81
93
  (d) => d !== domainToDisallow,
82
94
  );
83
95
  await sock.sendMessage(groupId, {
84
- text: `☑️ تم إزالة '${domainToDisallow}' من قائمة الدومينات المسموح بها.`,
96
+ text: tr(
97
+ `☑️ '${domainToDisallow}' is no longer allowed.`,
98
+ `☑️ تم إزالة '${domainToDisallow}' من قائمة الدومينات المسموح بها.`,
99
+ ),
85
100
  });
86
101
  break;
87
102
  }
88
103
  default: {
89
104
  // Display current status
90
- let statusReply = `*حالة نظام منع الروابط:*\n\n`;
91
- statusReply += `الحالة: ${antilinkConfig.enabled ? "مفعل ✅" : "معطل ☑️"}\n`;
92
- statusReply += `الوضع: ${antilinkConfig.mode}\n`;
93
- statusReply += `الدومينات المسموح بها: ${
94
- antilinkConfig.allowed_domains.join(", ") || "لا يوجد"
95
- }\n`;
105
+ const state = antilinkConfig.enabled ? tr("on ✅", "مفعل ✅") : tr("off ☑️", "معطل ☑️");
106
+ const allowed = antilinkConfig.allowed_domains.join(", ") || tr("none", "لا يوجد");
107
+ const statusReply = tr(
108
+ `*Anti-link:*\n\nState: ${state}\nMode: ${antilinkConfig.mode}\nAllowed domains: ${allowed}\n`,
109
+ `*حالة نظام منع الروابط:*\n\nالحالة: ${state}\nالوضع: ${antilinkConfig.mode}\nالدومينات المسموح بها: ${allowed}\n`,
110
+ );
96
111
  await sock.sendMessage(groupId, { text: statusReply });
97
112
  }
98
113
  }
@@ -163,7 +178,10 @@ async function handleAntiLink(sock, msg, _legacyConfig, _normalizeJid) {
163
178
  logger.info(`[Anti-Link] Deleting link from ${senderId} in ${groupId}. Domain: ${domain}`);
164
179
  await sock.sendMessage(groupId, { delete: msg.key });
165
180
  await sock.sendMessage(groupId, {
166
- text: `ممنوع إرسال الروابط هنا يا @${senderId.split("@")[0]}!`,
181
+ text: tr(
182
+ `No links here, @${senderId.split("@")[0]}!`,
183
+ `ممنوع إرسال الروابط هنا يا @${senderId.split("@")[0]}!`,
184
+ ),
167
185
  mentions: [senderId],
168
186
  });
169
187
  return true;
@@ -1,11 +1,18 @@
1
1
  // file: /commands/group/approveall.js
2
2
  const { getGroupSettings, saveGroupSettings } = require("../../utils/storage.cjs"); // Note the path is ../../
3
3
  const logger = require("../../utils/logger.cjs");
4
+ const { tr } = require("../../utils/i18n.cjs");
4
5
 
5
6
  module.exports = {
6
7
  name: "approveall",
7
- description: "Manages the auto-approve feature for join requests.",
8
- usage: "approveall <on|off>",
8
+ description: {
9
+ en: "Manages automatic approval of join requests.",
10
+ ar: "يدير الموافقة التلقائية على طلبات الانضمام.",
11
+ },
12
+ usage: {
13
+ en: "approveall <on|off>",
14
+ ar: "approveall <on|off>",
15
+ },
9
16
  chat: "group",
10
17
  userAdminRequired: true,
11
18
  botAdminRequired: true, // The bot must be an admin to approve requests
@@ -24,23 +31,31 @@ module.exports = {
24
31
  settings.join_requests.auto_approve_enabled = true;
25
32
  saveGroupSettings(groupId, settings);
26
33
  return await sock.sendMessage(groupId, {
27
- text: "✅ تم تفعيل نظام الموافقة التلقائية على طلبات الانضمام.",
34
+ text: tr(
35
+ "✅ Join requests are now approved automatically.",
36
+ "✅ تم تفعيل نظام الموافقة التلقائية على طلبات الانضمام.",
37
+ ),
28
38
  });
29
39
  } else if (option === "off") {
30
40
  settings.join_requests.auto_approve_enabled = false;
31
41
  saveGroupSettings(groupId, settings);
32
42
  return await sock.sendMessage(groupId, {
33
- text: "☑️ تم تعطيل نظام الموافقة التلقائية.",
43
+ text: tr("☑️ Automatic approval is off.", "☑️ تم تعطيل نظام الموافقة التلقائية."),
34
44
  });
35
45
  } else {
36
- const status = settings.join_requests.auto_approve_enabled ? "مفعل ✅" : "معطل ☑️";
46
+ const status = settings.join_requests.auto_approve_enabled
47
+ ? tr("on ✅", "مفعل ✅")
48
+ : tr("off ☑️", "معطل ☑️");
37
49
  return await sock.sendMessage(groupId, {
38
- text: `حالة الموافقة التلقائية: ${status}.\nاستخدم 'on' أو 'off' للتغيير.`,
50
+ text: tr(
51
+ `Automatic approval: ${status}.\nUse 'on' or 'off' to change it.`,
52
+ `حالة الموافقة التلقائية: ${status}.\nاستخدم 'on' أو 'off' للتغيير.`,
53
+ ),
39
54
  });
40
55
  }
41
56
  } catch (error) {
42
57
  logger.error({ err: error, command: "approveall" }, "Error in !group approveall command");
43
- await sock.sendMessage(groupId, { text: "حدث خطأ." });
58
+ await sock.sendMessage(groupId, { text: tr("Something went wrong.", "حدث خطأ.") });
44
59
  }
45
60
  },
46
61
  };
@@ -1,11 +1,18 @@
1
1
  // file: /commands/clearwarns.js
2
2
  const { clearUserWarnings } = require("../../utils/storage.cjs");
3
3
  const logger = require("../../utils/logger.cjs");
4
+ const { tr } = require("../../utils/i18n.cjs");
4
5
 
5
6
  module.exports = {
6
7
  name: "clearwarns",
7
- description: "Clears all warnings for a specific user.",
8
- usage: "clearwarns @عضو",
8
+ description: {
9
+ en: "Clears all of a member's warnings.",
10
+ ar: "يمسح كل تحذيرات عضو معيّن.",
11
+ },
12
+ usage: {
13
+ en: "clearwarns @member",
14
+ ar: "clearwarns @عضو",
15
+ },
9
16
  chat: "group",
10
17
  userAdminRequired: true,
11
18
 
@@ -16,14 +23,20 @@ module.exports = {
16
23
 
17
24
  if (!mentionedJid) {
18
25
  return await sock.sendMessage(groupId, {
19
- text: "يجب عمل منشن للعضو الذي تريد مسح تحذيراته.",
26
+ text: tr(
27
+ "Mention the member whose warnings you want to clear.",
28
+ "يجب عمل منشن للعضو الذي تريد مسح تحذيراته.",
29
+ ),
20
30
  });
21
31
  }
22
32
 
23
33
  // Call the new function from storage.js to delete the record from the database
24
34
  clearUserWarnings(groupId, mentionedJid);
25
35
 
26
- const replyText = `✅ تم مسح جميع تحذيرات العضو @${mentionedJid.split("@")[0]} بنجاح.`;
36
+ const replyText = tr(
37
+ `✅ Cleared every warning for @${mentionedJid.split("@")[0]}.`,
38
+ `✅ تم مسح جميع تحذيرات العضو @${mentionedJid.split("@")[0]} بنجاح.`,
39
+ );
27
40
  await sock.sendMessage(groupId, {
28
41
  text: replyText,
29
42
  mentions: [mentionedJid],
@@ -31,7 +44,7 @@ module.exports = {
31
44
  } catch (error) {
32
45
  logger.error({ err: error }, "Error in !clearwarns command");
33
46
  await sock.sendMessage(msg.key.remoteJid, {
34
- text: "حدث خطأ أثناء مسح التحذيرات.",
47
+ text: tr("Something went wrong while clearing the warnings.", "حدث خطأ أثناء مسح التحذيرات."),
35
48
  });
36
49
  }
37
50
  },
@@ -1,10 +1,17 @@
1
1
  // file: /commands/deletenote.js
2
2
  const { deleteNote } = require("../../utils/storage.cjs");
3
+ const { tr } = require("../../utils/i18n.cjs");
3
4
 
4
5
  module.exports = {
5
6
  name: "deletenote",
6
- description: "Deletes a saved note.",
7
- usage: "deletenote #الكلمة-المفتاحية",
7
+ description: {
8
+ en: "Deletes a saved note.",
9
+ ar: "يحذف ملاحظة محفوظة.",
10
+ },
11
+ usage: {
12
+ en: "deletenote #keyword",
13
+ ar: "deletenote #الكلمة-المفتاحية",
14
+ },
8
15
  chat: "all",
9
16
  userAdminRequired: true,
10
17
 
@@ -14,7 +21,10 @@ module.exports = {
14
21
 
15
22
  if (!keywordArg || !keywordArg.startsWith("#")) {
16
23
  return await sock.sendMessage(groupId, {
17
- text: "صيغة غير صحيحة. استخدم: `!deletenote #keyword`",
24
+ text: tr(
25
+ "Wrong format. Use: `!deletenote #keyword`",
26
+ "صيغة غير صحيحة. استخدم: `!deletenote #keyword`",
27
+ ),
18
28
  });
19
29
  }
20
30
 
@@ -22,11 +32,14 @@ module.exports = {
22
32
 
23
33
  if (deleteNote(groupId, keyword)) {
24
34
  await sock.sendMessage(groupId, {
25
- text: `☑️ تم حذف الملاحظة \`#${keyword}\` بنجاح.`,
35
+ text: tr(`☑️ Deleted the note \`#${keyword}\`.`, `☑️ تم حذف الملاحظة \`#${keyword}\` بنجاح.`),
26
36
  });
27
37
  } else {
28
38
  await sock.sendMessage(groupId, {
29
- text: `⚠️ لم يتم العثور على ملاحظة بالكلمة المفتاحية: \`${keywordArg}\``,
39
+ text: tr(
40
+ `⚠️ No note has the keyword \`${keywordArg}\``,
41
+ `⚠️ لم يتم العثور على ملاحظة بالكلمة المفتاحية: \`${keywordArg}\``,
42
+ ),
30
43
  });
31
44
  }
32
45
  },
@@ -1,10 +1,17 @@
1
1
  // file: /commands/demote.js
2
2
  const logger = require("../../utils/logger.cjs");
3
+ const { tr } = require("../../utils/i18n.cjs");
3
4
 
4
5
  module.exports = {
5
6
  name: "demote",
6
- description: "Demotes an admin to a regular member.",
7
- usage: "demote @عضو",
7
+ description: {
8
+ en: "Demotes an admin to a regular member.",
9
+ ar: "يحوّل مشرفًا إلى عضو عادي.",
10
+ },
11
+ usage: {
12
+ en: "demote @member",
13
+ ar: "demote @عضو",
14
+ },
8
15
  chat: "group",
9
16
  userAdminRequired: true,
10
17
  botAdminRequired: true,
@@ -19,7 +26,10 @@ module.exports = {
19
26
 
20
27
  if (!targetJid) {
21
28
  return await sock.sendMessage(groupId, {
22
- text: "يجب عمل منشن للمشرف أو الرد على رسالته لعزله.",
29
+ text: tr(
30
+ "Mention the admin, or reply to their message, to demote them.",
31
+ "يجب عمل منشن للمشرف أو الرد على رسالته لعزله.",
32
+ ),
23
33
  });
24
34
  }
25
35
 
@@ -27,7 +37,10 @@ module.exports = {
27
37
  const targetUser = groupMetadata.participants.find((p) => p.id === targetJid);
28
38
  if (!targetUser || !targetUser.admin) {
29
39
  return await sock.sendMessage(groupId, {
30
- text: `⚠️ العضو @${targetJid.split("@")[0]} ليس مشرفًا أصلاً.`,
40
+ text: tr(
41
+ `⚠️ @${targetJid.split("@")[0]} isn't an admin.`,
42
+ `⚠️ العضو @${targetJid.split("@")[0]} ليس مشرفًا أصلاً.`,
43
+ ),
31
44
  mentions: [targetJid],
32
45
  });
33
46
  }
@@ -35,7 +48,7 @@ module.exports = {
35
48
  // Safety check: Cannot demote the group creator
36
49
  if (targetUser.admin === "superadmin") {
37
50
  return await sock.sendMessage(groupId, {
38
- text: "لا يمكن عزل منشئ الجروب.",
51
+ text: tr("The group's creator can't be demoted.", "لا يمكن عزل منشئ الجروب."),
39
52
  });
40
53
  }
41
54
 
@@ -46,12 +59,17 @@ module.exports = {
46
59
  "demote", // The action is 'demote'
47
60
  );
48
61
  await sock.sendMessage(groupId, {
49
- text: `👤 تم عزل @${targetJid.split("@")[0]} من الإشراف.`,
62
+ text: tr(
63
+ `👤 @${targetJid.split("@")[0]} is no longer an admin.`,
64
+ `👤 تم عزل @${targetJid.split("@")[0]} من الإشراف.`,
65
+ ),
50
66
  mentions: [targetJid],
51
67
  });
52
68
  } catch (error) {
53
69
  logger.error({ err: error, command: "demote" }, "Error in !demote command");
54
- await sock.sendMessage(groupId, { text: "حدث خطأ أثناء محاولة العزل." });
70
+ await sock.sendMessage(groupId, {
71
+ text: tr("Something went wrong while demoting.", "حدث خطأ أثناء محاولة العزل."),
72
+ });
55
73
  }
56
74
  },
57
75
  };
@@ -5,11 +5,18 @@ const {
5
5
  isAdminInGroupSync,
6
6
  sameUserSync,
7
7
  } = require("../../utils/permissions.cjs");
8
+ const { tr } = require("../../utils/i18n.cjs");
8
9
 
9
10
  module.exports = {
10
11
  name: "kick",
11
- description: "Removes a member from the group.",
12
- usage: "kick @عضو [السبب]",
12
+ description: {
13
+ en: "Removes a member from the group.",
14
+ ar: "يطرد عضوًا من المجموعة.",
15
+ },
16
+ usage: {
17
+ en: "kick @member [reason]",
18
+ ar: "kick @عضو [السبب]",
19
+ },
13
20
  chat: "group",
14
21
  userAdminRequired: true,
15
22
  botAdminRequired: true,
@@ -28,41 +35,47 @@ module.exports = {
28
35
  targetJid = msg.message.extendedTextMessage.contextInfo.participant;
29
36
  } else {
30
37
  return await sock.sendMessage(groupId, {
31
- text: "يجب عمل منشن للعضو أو الرد على رسالته لطرده.",
38
+ text: tr(
39
+ "Mention the member, or reply to their message, to kick them.",
40
+ "يجب عمل منشن للعضو أو الرد على رسالته لطرده.",
41
+ ),
32
42
  });
33
43
  }
34
44
 
35
45
  // --- Safety Checks ---
36
46
  // Can't kick the bot itself
37
47
  if ([sock.user?.id, sock.user?.lid].filter(Boolean).some((id) => sameUserSync(id, targetJid))) {
38
- return await sock.sendMessage(groupId, { text: "لا يمكنني طرد نفسي." });
48
+ return await sock.sendMessage(groupId, { text: tr("I can't kick myself.", "لا يمكنني طرد نفسي.") });
39
49
  }
40
50
 
41
51
  // Bot owners/admins are privileged across chats and cannot be removed by
42
52
  // a group-only admin through an alternate LID/PN representation.
43
53
  if (hasBotPrivilegesSync(targetJid)) {
44
54
  return await sock.sendMessage(groupId, {
45
- text: "لا يمكن طرد مالك أو مشرف البوت.",
55
+ text: tr("The bot's owner or admins can't be kicked.", "لا يمكن طرد مالك أو مشرف البوت."),
46
56
  });
47
57
  }
48
58
 
49
59
  // Check if the target is also an admin
50
60
  if (isAdminInGroupSync(groupMetadata, targetJid)) {
51
61
  return await sock.sendMessage(groupId, {
52
- text: "لا يمكن للمشرف طرد مشرف آخر.",
62
+ text: tr("An admin can't kick another admin.", "لا يمكن للمشرف طرد مشرف آخر."),
53
63
  });
54
64
  }
55
65
 
56
66
  // --- Execution ---
57
67
  try {
58
- const reason = args.slice(1).join(" ") || "بدون سبب";
68
+ const reason = args.slice(1).join(" ") || tr("No reason given", "بدون سبب");
59
69
  const senderName = msg.pushName;
70
+ const member = `@${targetJid.split("@")[0]}`;
60
71
 
61
- const kickMessage =
72
+ const kickMessage = tr(
73
+ `*By:* ${senderName}\n*Action:* kick\n*Member:* ${member}\n*Reason:* ${reason}`,
62
74
  `*تم بواسطة:* ${senderName}\n` +
63
- `*الإجراء:* طرد\n` +
64
- `*العضو:* @${targetJid.split("@")[0]}\n` +
65
- `*السبب:* ${reason}`;
75
+ `*الإجراء:* طرد\n` +
76
+ `*العضو:* ${member}\n` +
77
+ `*السبب:* ${reason}`,
78
+ );
66
79
 
67
80
  // Announce the kick before performing it
68
81
  await sock.sendMessage(groupId, {
@@ -75,7 +88,10 @@ module.exports = {
75
88
  } catch (error) {
76
89
  logger.error({ err: error, command: "kick" }, "Error in !kick command");
77
90
  await sock.sendMessage(groupId, {
78
- text: "حدث خطأ أثناء محاولة طرد العضو. قد تكون صلاحياتي غير كافية.",
91
+ text: tr(
92
+ "Something went wrong while kicking the member. I may not have enough permissions.",
93
+ "حدث خطأ أثناء محاولة طرد العضو. قد تكون صلاحياتي غير كافية.",
94
+ ),
79
95
  });
80
96
  }
81
97
  },