levix-bot 4.1.0 → 4.2.0

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 +159 -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 +44 -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 +99 -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
@@ -8,13 +8,20 @@ const {
8
8
  listDebts: storeListDebts,
9
9
  } = require("../utils/storage.cjs");
10
10
  const logger = require("../utils/logger.cjs");
11
+ const { tr } = require("../utils/i18n.cjs");
11
12
  const normalizeJid = require("../utils/normalizeJid.esm.js").default;
12
13
 
13
14
  module.exports = {
14
15
  name: "debt",
15
16
  aliases: ["دين", "owes"],
16
- description: "Private debt tracking system",
17
- usage: "debt add <المبلغ> [الوصف]\ndebt del <id>\ndebt list",
17
+ description: {
18
+ en: "Private debt tracker.",
19
+ ar: "نظام خاص لتتبّع الديون.",
20
+ },
21
+ usage: {
22
+ en: "debt add <amount> [description]\ndebt del <id>\ndebt list",
23
+ ar: "debt add <المبلغ> [الوصف]\ndebt del <id>\ndebt list",
24
+ },
18
25
  chat: "private",
19
26
 
20
27
  async execute(sock, msg, args) {
@@ -45,13 +52,20 @@ module.exports = {
45
52
 
46
53
  default:
47
54
  await sock.sendMessage(remote, {
48
- text:
55
+ text: tr(
56
+ `📊 *Debt tracker (private chats only)*\n\n` +
57
+ `Commands:\n\n` +
58
+ `• \`!debt add <amount> [description]\` — add a debt\n` +
59
+ `• \`!debt list\` — list debts\n` +
60
+ `• \`!debt del <id>\` — delete a debt\n\n` +
61
+ `Example:\n\`!debt add 50 lunch\``,
49
62
  `📊 *نظام الديون (خاص فقط)*\n\n` +
50
- `الأوامر:\n\n` +
51
- `• \`!debt add <amount> [description]\` — إضافة دين\n` +
52
- `• \`!debt list\` — عرض الديون\n` +
53
- `• \`!debt del <id>\` — حذف دين\n\n` +
54
- `مثال:\n\`!debt add 50 غداء\``,
63
+ `الأوامر:\n\n` +
64
+ `• \`!debt add <amount> [description]\` — إضافة دين\n` +
65
+ `• \`!debt list\` — عرض الديون\n` +
66
+ `• \`!debt del <id>\` — حذف دين\n\n` +
67
+ `مثال:\n\`!debt add 50 غداء\``,
68
+ ),
55
69
  });
56
70
  }
57
71
  },
@@ -62,16 +76,19 @@ async function addDebt(sock, msg, args, creditorId, debtorId, chatKey) {
62
76
 
63
77
  if (args.length < 1) {
64
78
  return sock.sendMessage(remote, {
65
- text: "❌ الاستخدام: `!debt add <amount> [description]`",
79
+ text: tr(
80
+ "❌ Usage: `!debt add <amount> [description]`",
81
+ "❌ الاستخدام: `!debt add <amount> [description]`",
82
+ ),
66
83
  });
67
84
  }
68
85
 
69
86
  const amount = parseFloat(args[0]);
70
- const description = args.slice(1).join(" ") || "بدون وصف";
87
+ const description = args.slice(1).join(" ") || tr("No description", "بدون وصف");
71
88
 
72
89
  if (isNaN(amount) || amount <= 0) {
73
90
  return sock.sendMessage(remote, {
74
- text: "❌ المبلغ يجب أن يكون رقم موجب",
91
+ text: tr("❌ The amount must be a positive number", "❌ المبلغ يجب أن يكون رقم موجب"),
75
92
  });
76
93
  }
77
94
 
@@ -85,18 +102,25 @@ async function addDebt(sock, msg, args, creditorId, debtorId, chatKey) {
85
102
  });
86
103
 
87
104
  await sock.sendMessage(remote, {
88
- text:
105
+ text: tr(
106
+ `✅ *Debt added*\n\n` +
107
+ `Debtor: ${debtorId.split("@")[0]}\n` +
108
+ `Creditor: ${creditorId.split("@")[0]}\n` +
109
+ `Amount: ${amount}\n` +
110
+ `Description: ${description}\n` +
111
+ `Record: #${debt.id}`,
89
112
  `✅ *تم إضافة الدين*\n\n` +
90
- `المدين: ${debtorId.split("@")[0]}\n` +
91
- `الدائن: ${creditorId.split("@")[0]}\n` +
92
- `المبلغ: ${amount}\n` +
93
- `الوصف: ${description}\n` +
94
- `رقم السجل: #${debt.id}`,
113
+ `المدين: ${debtorId.split("@")[0]}\n` +
114
+ `الدائن: ${creditorId.split("@")[0]}\n` +
115
+ `المبلغ: ${amount}\n` +
116
+ `الوصف: ${description}\n` +
117
+ `رقم السجل: #${debt.id}`,
118
+ ),
95
119
  });
96
120
  } catch (err) {
97
121
  logger.error(err, "[Debt] Add error:");
98
122
  await sock.sendMessage(remote, {
99
- text: "❌ حدث خطأ أثناء تسجيل الدين",
123
+ text: tr("❌ Something went wrong while saving the debt", "❌ حدث خطأ أثناء تسجيل الدين"),
100
124
  });
101
125
  }
102
126
  }
@@ -108,26 +132,26 @@ async function listDebts(sock, msg, creditorId, debtorId, chatKey) {
108
132
  const debts = storeListDebts(chatKey, { settled: false });
109
133
 
110
134
  if (debts.length === 0) {
111
- return sock.sendMessage(remote, { text: "لا توجد ديون حالياً ✅" });
135
+ return sock.sendMessage(remote, { text: tr("No debts right now ✅", "لا توجد ديون حالياً ✅") });
112
136
  }
113
137
 
114
- let text = "📋 *قائمة الديون:*\n\n";
138
+ let text = tr("📋 *Debts:*\n\n", "📋 *قائمة الديون:*\n\n");
115
139
 
116
140
  debts.forEach((d) => {
117
- const date = new Date(d.created_at).toLocaleDateString("ar-EG");
141
+ const date = new Date(d.created_at).toLocaleDateString(tr("en-GB", "ar-EG"));
118
142
  text += `*#${d.id}*\n`;
119
- text += `المدين: ${d.debtor_id.split("@")[0]}\n`;
120
- text += `الدائن: ${d.creditor_id.split("@")[0]}\n`;
121
- text += `المبلغ: ${d.amount}\n`;
122
- text += `الوصف: ${d.description}\n`;
123
- text += `التاريخ: ${date}\n\n`;
143
+ text += `${tr("Debtor", "المدين")}: ${d.debtor_id.split("@")[0]}\n`;
144
+ text += `${tr("Creditor", "الدائن")}: ${d.creditor_id.split("@")[0]}\n`;
145
+ text += `${tr("Amount", "المبلغ")}: ${d.amount}\n`;
146
+ text += `${tr("Description", "الوصف")}: ${d.description}\n`;
147
+ text += `${tr("Date", "التاريخ")}: ${date}\n\n`;
124
148
  });
125
149
 
126
150
  await sock.sendMessage(remote, { text });
127
151
  } catch (err) {
128
152
  logger.error(err, "[Debt] List error:");
129
153
  await sock.sendMessage(remote, {
130
- text: "❌ حدث خطأ أثناء عرض الديون",
154
+ text: tr("❌ Something went wrong while listing debts", "❌ حدث خطأ أثناء عرض الديون"),
131
155
  });
132
156
  }
133
157
  }
@@ -137,14 +161,14 @@ async function deleteDebt(sock, msg, args, creditorId, debtorId, chatKey) {
137
161
 
138
162
  if (args.length < 1) {
139
163
  return sock.sendMessage(remote, {
140
- text: "❌ الاستخدام: `!debt del <id>`",
164
+ text: tr("❌ Usage: `!debt del <id>`", "❌ الاستخدام: `!debt del <id>`"),
141
165
  });
142
166
  }
143
167
 
144
168
  const id = parseInt(args[0]);
145
169
  if (isNaN(id)) {
146
170
  return sock.sendMessage(remote, {
147
- text: "❌ رقم السجل غير صحيح",
171
+ text: tr("❌ Invalid record number", "❌ رقم السجل غير صحيح"),
148
172
  });
149
173
  }
150
174
 
@@ -152,24 +176,26 @@ async function deleteDebt(sock, msg, args, creditorId, debtorId, chatKey) {
152
176
  const debt = storeGetDebt(id);
153
177
 
154
178
  if (!debt) {
155
- return sock.sendMessage(remote, { text: "❌ لم يتم العثور على الدين" });
179
+ return sock.sendMessage(remote, {
180
+ text: tr("❌ That debt wasn't found", "❌ لم يتم العثور على الدين"),
181
+ });
156
182
  }
157
183
 
158
184
  if (debt.group_id !== chatKey) {
159
185
  return sock.sendMessage(remote, {
160
- text: "❌ هذا الدين لا يخص هذه المحادثة",
186
+ text: tr("❌ That debt belongs to another chat", "❌ هذا الدين لا يخص هذه المحادثة"),
161
187
  });
162
188
  }
163
189
 
164
190
  storeDeleteDebt(id);
165
191
 
166
192
  await sock.sendMessage(remote, {
167
- text: `🗑️ تم حذف الدين رقم #${id} بنجاح`,
193
+ text: tr(`🗑️ Deleted debt #${id}`, `🗑️ تم حذف الدين رقم #${id} بنجاح`),
168
194
  });
169
195
  } catch (err) {
170
196
  logger.error(err, "[Debt] Del error:");
171
197
  await sock.sendMessage(remote, {
172
- text: "❌ حدث خطأ أثناء حذف الدين",
198
+ text: tr("❌ Something went wrong while deleting the debt", "❌ حدث خطأ أثناء حذف الدين"),
173
199
  });
174
200
  }
175
201
  }
@@ -1,10 +1,17 @@
1
1
  // file: /commands/deleteschedule.js
2
2
  const { deleteScheduledJob, getScheduledJobs } = require("../../scheduler.cjs");
3
+ const { tr } = require("../utils/i18n.cjs");
3
4
 
4
5
  module.exports = {
5
6
  name: "deleteschedule",
6
- description: "Deletes a scheduled job by its ID.",
7
- usage: "deleteschedule <id>",
7
+ description: {
8
+ en: "Deletes a scheduled message by its ID.",
9
+ ar: "يحذف رسالة مجدولة برقمها التعريفي (ID).",
10
+ },
11
+ usage: {
12
+ en: "deleteschedule <id>",
13
+ ar: "deleteschedule <id>",
14
+ },
8
15
  chat: "all",
9
16
  userAdminRequired: true,
10
17
 
@@ -13,7 +20,10 @@ module.exports = {
13
20
 
14
21
  if (!jobIdToDelete) {
15
22
  return await sock.sendMessage(msg.key.remoteJid, {
16
- text: "يرجى تحديد ID المهمة التي تريد حذفها. يمكنك الحصول على الـ ID باستخدام أمر `!listschedules`.",
23
+ text: tr(
24
+ "Give the ID of the scheduled message to delete. `!listschedules` shows the IDs.",
25
+ "يرجى تحديد ID المهمة التي تريد حذفها. يمكنك الحصول على الـ ID باستخدام أمر `!listschedules`.",
26
+ ),
17
27
  });
18
28
  }
19
29
 
@@ -22,7 +32,10 @@ module.exports = {
22
32
 
23
33
  if (!jobExists) {
24
34
  return await sock.sendMessage(msg.key.remoteJid, {
25
- text: `⚠️ لم يتم العثور على مهمة بهذا الـ ID: \`${jobIdToDelete}\``,
35
+ text: tr(
36
+ `⚠️ No scheduled message has the ID \`${jobIdToDelete}\``,
37
+ `⚠️ لم يتم العثور على مهمة بهذا الـ ID: \`${jobIdToDelete}\``,
38
+ ),
26
39
  });
27
40
  }
28
41
 
@@ -30,7 +43,10 @@ module.exports = {
30
43
  deleteScheduledJob(jobIdToDelete);
31
44
 
32
45
  await sock.sendMessage(msg.key.remoteJid, {
33
- text: `✅ تم حذف المهمة المجدولة بالـ ID: \`${jobIdToDelete}\` بنجاح.`,
46
+ text: tr(
47
+ `✅ Deleted the scheduled message \`${jobIdToDelete}\`.`,
48
+ `✅ تم حذف المهمة المجدولة بالـ ID: \`${jobIdToDelete}\` بنجاح.`,
49
+ ),
34
50
  });
35
51
  },
36
52
  };
@@ -8,27 +8,47 @@ const {
8
8
  isExplicitEn,
9
9
  oppositeNumeralLang,
10
10
  } = require("../utils/numerals.cjs");
11
+ const { tr } = require("../utils/i18n.cjs");
11
12
 
12
13
  function mixedDigitsNotice(prefix) {
13
- return `⚠️ الأرقام مختلطة (عربي وإنجليزي). حدد الاتجاه:\n\`${prefix}digit ar ...\` أو \`${prefix}digit en ...\`.\nDigits are mixed Arabic and English. Specify \`${prefix}digit ar\` or \`${prefix}digit en\`.`;
14
+ return tr(
15
+ `⚠️ The digits are mixed (Arabic and English). Say which way:\n\`${prefix}digit ar ...\` or \`${prefix}digit en ...\`.`,
16
+ `⚠️ الأرقام مختلطة (عربي وإنجليزي). حدد الاتجاه:\n\`${prefix}digit ar ...\` أو \`${prefix}digit en ...\`.`,
17
+ );
14
18
  }
15
19
 
16
20
  function helpText(prefix) {
17
- return `🔢 *تحويل الأرقام / Digit converter*
21
+ return tr(
22
+ `🔢 *Digit converter*
18
23
 
19
- • \`${prefix}digit 12345\` ➔ ١٢٣٤٥ (يُكتشف تلقائياً / auto-detected)
24
+ • \`${prefix}digit 12345\` ➔ ١٢٣٤٥ (auto-detected)
25
+ • \`${prefix}digit ١٢٣٤٥\` ➔ 12345
26
+ • \`${prefix}digit ar 12345\` ➔ ١٢٣٤٥
27
+ • \`${prefix}digit en ١٢٣٤٥\` ➔ 12345
28
+ _Or reply to a message with digits in it using \`${prefix}digit\` — it converts the other way._
29
+ _When Arabic and English digits are mixed, say which way: \`${prefix}digit ar\` or \`${prefix}digit en\`._`,
30
+ `🔢 *تحويل الأرقام*
31
+
32
+ • \`${prefix}digit 12345\` ➔ ١٢٣٤٥ (يُكتشف تلقائياً)
20
33
  • \`${prefix}digit ١٢٣٤٥\` ➔ 12345
21
34
  • \`${prefix}digit ar 12345\` ➔ ١٢٣٤٥
22
35
  • \`${prefix}digit en ١٢٣٤٥\` ➔ 12345
23
36
  _أو رد على رسالة فيها أرقام بـ \`${prefix}digit\` — يحوّل للاتجاه المعاكس._
24
- _إذا اختلطت الأرقام العربية والإنجليزية يجب تحديد الاتجاه: \`${prefix}digit ar\` أو \`${prefix}digit en\`._`;
37
+ _إذا اختلطت الأرقام العربية والإنجليزية يجب تحديد الاتجاه: \`${prefix}digit ar\` أو \`${prefix}digit en\`._`,
38
+ );
25
39
  }
26
40
 
27
41
  module.exports = {
28
42
  name: "digit",
29
43
  aliases: ["digits", "num", "numbers", "numeral", "ارقام", "رقم"],
30
- description: "Convert numbers between Arabic and English digits",
31
- usage: "digit [en|ar] [number/text] (or reply to a message)",
44
+ description: {
45
+ en: "Converts numbers between Arabic-Indic (٠١٢) and English (012) digits.",
46
+ ar: "يحوّل الأرقام بين الأرقام العربية (٠١٢) والإنجليزية (012).",
47
+ },
48
+ usage: {
49
+ en: "digit [en|ar] [number/text] (or reply to a message)",
50
+ ar: "digit [en|ar] [رقم/نص] (أو رد على رسالة)",
51
+ },
32
52
  chat: "all",
33
53
 
34
54
  async execute(sock, msg, args) {
@@ -62,7 +82,10 @@ module.exports = {
62
82
  await sock.sendMessage(
63
83
  chatId,
64
84
  {
65
- text: `❌ اكتب رقماً بعد الأمر، أو رد على رسالة.\nType a number after the command, or reply to a message.\nمثال: \`${prefix}digit 12345\` أو \`${prefix}digit ar 12345\``,
85
+ text: tr(
86
+ `❌ Type a number after the command, or reply to a message.\nExample: \`${prefix}digit 12345\` or \`${prefix}digit ar 12345\``,
87
+ `❌ اكتب رقماً بعد الأمر، أو رد على رسالة.\nمثال: \`${prefix}digit 12345\` أو \`${prefix}digit ar 12345\``,
88
+ ),
66
89
  },
67
90
  { quoted: msg },
68
91
  );
@@ -84,7 +107,10 @@ module.exports = {
84
107
  await sock.sendMessage(
85
108
  chatId,
86
109
  {
87
- text: `❌ لا توجد أرقام للتحويل.\nNo digits found to convert.\nاستخدم:\n• \`${prefix}digit 12345\`\n• \`${prefix}digit ar\` / \`${prefix}digit en\` مع النص أو بالرد على رسالة.`,
110
+ text: tr(
111
+ `❌ No digits to convert.\nUse:\n• \`${prefix}digit 12345\`\n• \`${prefix}digit ar\` / \`${prefix}digit en\` with text, or as a reply to a message.`,
112
+ `❌ لا توجد أرقام للتحويل.\nاستخدم:\n• \`${prefix}digit 12345\`\n• \`${prefix}digit ar\` / \`${prefix}digit en\` مع النص أو بالرد على رسالة.`,
113
+ ),
88
114
  },
89
115
  { quoted: msg },
90
116
  );