levix-bot 4.3.0 → 4.4.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 (75) hide show
  1. package/README.md +1 -0
  2. package/package.json +1 -1
  3. package/public/dashboard/assets/index-5P8GnKLg.css +2 -0
  4. package/public/dashboard/assets/index-DXzno3X6.js +515 -0
  5. package/public/dashboard/index.html +2 -2
  6. package/public/dashboard.css +32 -0
  7. package/src/bootstrap/panel.js +16 -4
  8. package/src/commands/autoschedule.cjs +1 -1
  9. package/src/commands/blacklist.cjs +1 -1
  10. package/src/commands/calc.cjs +9 -9
  11. package/src/commands/gemini.cjs +26 -26
  12. package/src/commands/group/add.cjs +2 -2
  13. package/src/commands/group/demote.cjs +2 -2
  14. package/src/commands/group/members.cjs +2 -2
  15. package/src/commands/group/rules.cjs +1 -1
  16. package/src/commands/group/setname.cjs +3 -3
  17. package/src/commands/group/setpp.cjs +3 -3
  18. package/src/commands/group/setrules.cjs +1 -1
  19. package/src/commands/group/tagadmins.cjs +1 -1
  20. package/src/commands/group.cjs +1 -1
  21. package/src/commands/lang.cjs +3 -3
  22. package/src/commands/listschedules.cjs +1 -1
  23. package/src/commands/loop.cjs +3 -3
  24. package/src/commands/memory.cjs +18 -18
  25. package/src/commands/notes.cjs +1 -1
  26. package/src/commands/pack.cjs +159 -0
  27. package/src/commands/packs.cjs +47 -0
  28. package/src/commands/perm.cjs +2 -2
  29. package/src/commands/poll.cjs +3 -3
  30. package/src/commands/rand.cjs +2 -2
  31. package/src/commands/restart.cjs +4 -4
  32. package/src/commands/schedule.cjs +1 -1
  33. package/src/commands/send.cjs +3 -20
  34. package/src/commands/status.cjs +2 -2
  35. package/src/commands/sticker.cjs +77 -232
  36. package/src/commands/stickers.cjs +100 -0
  37. package/src/commands/stopbot.cjs +5 -5
  38. package/src/commands/stt.cjs +1 -1
  39. package/src/commands/toimage.cjs +88 -0
  40. package/src/commands/tts.cjs +2 -2
  41. package/src/config/defaults.cjs +5 -0
  42. package/src/config/settings.cjs +10 -0
  43. package/src/core/events.js +15 -1
  44. package/src/core/session.js +7 -0
  45. package/src/db/db.cjs +381 -0
  46. package/src/db/store.cjs +729 -21
  47. package/src/handlers/command.handler.js +5 -1
  48. package/src/panel/password-reset.cjs +1 -1
  49. package/src/routes/dashboard.api.esm.js +43 -10
  50. package/src/routes/stickers.api.esm.js +570 -0
  51. package/src/services/aiAgent.cjs +2 -2
  52. package/src/services/aiProviders.cjs +1 -1
  53. package/src/services/aiTools.cjs +27 -27
  54. package/src/stickers/errors.cjs +239 -0
  55. package/src/stickers/ffmpeg.cjs +133 -0
  56. package/src/stickers/jobs.cjs +183 -0
  57. package/src/stickers/library.cjs +712 -0
  58. package/src/stickers/limits.cjs +60 -0
  59. package/src/stickers/media.cjs +748 -0
  60. package/src/stickers/options.cjs +128 -0
  61. package/src/stickers/owner.cjs +103 -0
  62. package/src/stickers/studio.cjs +473 -0
  63. package/src/stickers/uploads.cjs +263 -0
  64. package/src/stickers/webp.cjs +231 -0
  65. package/src/stickers/zip.cjs +107 -0
  66. package/src/utils/memory.cjs +7 -7
  67. package/src/utils/messageContent.cjs +30 -4
  68. package/src/utils/recurrence.cjs +189 -30
  69. package/src/utils/stickerBot.cjs +84 -0
  70. package/src/utils/storage.cjs +3 -0
  71. package/src/utils/storage.esm.js +3 -0
  72. package/views/login.ejs +39 -3
  73. package/views/setup.ejs +21 -0
  74. package/public/dashboard/assets/index-BCXZoPGP.js +0 -446
  75. package/public/dashboard/assets/index-LvfJ8ybs.css +0 -2
@@ -42,11 +42,11 @@ function extractScope(args) {
42
42
  function scopeName(scope) {
43
43
  return scope === "global"
44
44
  ? tr("the global memory", "الذاكرة العامة")
45
- : tr("this chat's memory", "ذاكرة الشات");
45
+ : tr("this chat's memory", "ذاكرة المحادثة");
46
46
  }
47
47
 
48
48
  function formatEntries(entries, { limit = 30 } = {}) {
49
- if (!entries.length) return tr("_(empty)_", "_(فاضية)_");
49
+ if (!entries.length) return tr("_(empty)_", "_(فارغة)_");
50
50
  const shown = entries.slice(-limit);
51
51
  const lines = shown.map((entry, index) => {
52
52
  const number = entries.length - shown.length + index + 1;
@@ -58,7 +58,7 @@ function formatEntries(entries, { limit = 30 } = {}) {
58
58
  const skipped = entries.length - shown.length;
59
59
  return (
60
60
  (skipped > 0
61
- ? tr(`_(+${skipped} older ones not shown)_\n\n`, `_(+${skipped} أقدم مش معروضين)_\n\n`)
61
+ ? tr(`_(+${skipped} older ones not shown)_\n\n`, `_(+${skipped} معلومات أقدم لم تُعرض)_\n\n`)
62
62
  : "") + lines.join("\n")
63
63
  );
64
64
  }
@@ -95,7 +95,7 @@ module.exports = {
95
95
  reply(
96
96
  tr(
97
97
  "🚫 That's for admins and the owner only. Anyone can add to this chat's memory.",
98
- "🚫 ده للمشرفين والمالك بس. تقدر تضيف معلومة لذاكرة الشات عادي.",
98
+ "🚫 هذا الإجراء للمشرفين والمالك فقط. يمكنك إضافة معلومات إلى ذاكرة هذه المحادثة.",
99
99
  ),
100
100
  );
101
101
 
@@ -107,7 +107,7 @@ module.exports = {
107
107
  return reply(
108
108
  tr(
109
109
  "Write the fact after the command.\nExample: `!memory add the meeting is every Tuesday at 9`",
110
- "اكتب المعلومة بعد الأمر.\nمثال: `!memory add الاجتماع كل تلات الساعة ٩`",
110
+ "اكتب المعلومة بعد الأمر.\nمثال: `!memory add الاجتماع كل ثلاثاء الساعة ٩`",
111
111
  ),
112
112
  );
113
113
  }
@@ -122,7 +122,7 @@ module.exports = {
122
122
  });
123
123
 
124
124
  return reply(
125
- tr(`🧠 Saved to *${scopeName(scope)}*.\n`, `🧠 اتحفظت في *${scopeName(scope)}*.\n`) +
125
+ tr(`🧠 Saved to *${scopeName(scope)}*.\n`, `🧠 حُفظت في *${scopeName(scope)}*.\n`) +
126
126
  `\`${entry.id}\` — ${content.length > 80 ? content.slice(0, 80) + "…" : content}`,
127
127
  );
128
128
  }
@@ -131,19 +131,19 @@ module.exports = {
131
131
  if (["search", "find", "بحث", "دور"].includes(action)) {
132
132
  const query = rest.join(" ").trim();
133
133
  if (!query) {
134
- return reply(tr("Write the word you're looking for.", "اكتب الكلمة اللي بتدور عليها."));
134
+ return reply(tr("Write the word you're looking for.", "اكتب الكلمة التي تبحث عنها."));
135
135
  }
136
136
  const chatHits = memory.searchMemory(query, { scope: "chat", chatId });
137
137
  const globalHits = memory.searchMemory(query, { scope: "global" });
138
138
 
139
139
  if (!chatHits.length && !globalHits.length) {
140
140
  return reply(
141
- tr(`🔍 Nothing is saved about "${query}".`, `🔍 مفيش حاجة متسجلة عن "${query}".`),
141
+ tr(`🔍 Nothing is saved about "${query}".`, `🔍 لا توجد معلومات محفوظة عن "${query}".`),
142
142
  );
143
143
  }
144
144
  return reply(
145
- tr(`🔍 *Results for* "${query}"\n\n`, `🔍 *نتايج البحث عن* "${query}"\n\n`) +
146
- tr(`*This chat (${chatHits.length}):*\n`, `*ذاكرة الشات (${chatHits.length}):*\n`) +
145
+ tr(`🔍 *Results for* "${query}"\n\n`, `🔍 *نتائج البحث عن* "${query}"\n\n`) +
146
+ tr(`*This chat (${chatHits.length}):*\n`, `*ذاكرة المحادثة (${chatHits.length}):*\n`) +
147
147
  `${formatEntries(chatHits, { limit: 10 })}\n\n` +
148
148
  tr(`*Global (${globalHits.length}):*\n`, `*الذاكرة العامة (${globalHits.length}):*\n`) +
149
149
  formatEntries(globalHits, { limit: 10 }),
@@ -158,7 +158,7 @@ module.exports = {
158
158
  return reply(
159
159
  tr(
160
160
  "Say what to forget: its number from `!memory`, or part of its text.\nExample: `!memory forget 3`",
161
- "حدد اللي عايز تمسحه: رقمه من `!memory` أو جزء من نصه.\n" +
161
+ "حدّد ما تريد حذفه: رقمه من `!memory` أو جزء من نصه.\n" +
162
162
  "مثال: `!memory forget 3`",
163
163
  ),
164
164
  );
@@ -168,11 +168,11 @@ module.exports = {
168
168
  removed
169
169
  ? tr(
170
170
  `🗑️ Forgotten: ${removed.content.slice(0, 120)}`,
171
- `🗑️ اتمسحت: ${removed.content.slice(0, 120)}`,
171
+ `🗑️ حُذفت: ${removed.content.slice(0, 120)}`,
172
172
  )
173
173
  : tr(
174
174
  `Nothing in ${scopeName(scope)} matches "${ref}".`,
175
- `مالقيتش حاجة تطابق "${ref}" في ${scopeName(scope)}.`,
175
+ `لم أجد ما يطابق "${ref}" في ${scopeName(scope)}.`,
176
176
  ),
177
177
  );
178
178
  }
@@ -185,9 +185,9 @@ module.exports = {
185
185
  count
186
186
  ? tr(
187
187
  `🧹 Cleared *${count}* facts from ${scopeName(scope)}.`,
188
- `🧹 اتمسحت *${count}* معلومة من ${scopeName(scope)}.`,
188
+ `🧹 حُذفت *${count}* معلومة من ${scopeName(scope)}.`,
189
189
  )
190
- : tr("The memory was already empty.", "الذاكرة كانت فاضية أصلاً."),
190
+ : tr("The memory was already empty.", "الذاكرة فارغة بالفعل."),
191
191
  );
192
192
  }
193
193
 
@@ -199,7 +199,7 @@ module.exports = {
199
199
  return reply(
200
200
  tr(
201
201
  "There is no memory file yet — start with `!memory add ...`.",
202
- "مفيش ملف ذاكرة لسه — ابدأ بـ `!memory add ...`.",
202
+ "لا يوجد ملف ذاكرة بعد — ابدأ بـ `!memory add ...`.",
203
203
  ),
204
204
  );
205
205
  }
@@ -228,10 +228,10 @@ module.exports = {
228
228
  `${formatEntries(entries)}\n\n` +
229
229
  `_Chat: ${stats.chatCount} · Global: ${stats.globalCount}_\n` +
230
230
  "`!memory add <fact>` · `!memory add global <fact>` · `!memory forget <number>` · `!memory file`",
231
- `🧠 *${target === "global" ? "الذاكرة العامة" : "ذاكرة المحادثة دي"}* ` +
231
+ `🧠 *${target === "global" ? "الذاكرة العامة" : "ذاكرة هذه المحادثة"}* ` +
232
232
  `(${entries.length} معلومة)\n\n` +
233
233
  `${formatEntries(entries)}\n\n` +
234
- `_الشات: ${stats.chatCount} · العام: ${stats.globalCount}_\n` +
234
+ `_المحادثة: ${stats.chatCount} · العام: ${stats.globalCount}_\n` +
235
235
  "`!memory add <معلومة>` · `!memory add global <معلومة>` · `!memory forget <رقم>` · `!memory file`",
236
236
  ),
237
237
  );
@@ -22,7 +22,7 @@ module.exports = {
22
22
 
23
23
  if (keywords.length === 0) {
24
24
  return await sock.sendMessage(groupId, {
25
- text: tr("This group has no saved notes.", "لا توجد ملاحظات محفوظة في هذا الجروب."),
25
+ text: tr("This group has no saved notes.", "لا توجد ملاحظات محفوظة في هذه المجموعة."),
26
26
  });
27
27
  }
28
28
 
@@ -0,0 +1,159 @@
1
+ const { tr } = require("../utils/i18n.cjs");
2
+ const { createStatus } = require("../utils/statusMessage.cjs");
3
+ const {
4
+ targetOf,
5
+ downloadTarget,
6
+ commandHint,
7
+ countLabel,
8
+ errorText,
9
+ } = require("../utils/stickerBot.cjs");
10
+ const { StickerError } = require("../stickers/errors.cjs");
11
+ const { BOT_VIDEO_MAX_SECONDS, PACK_SUBCOMMANDS } = require("../stickers/limits.cjs");
12
+ const ownerModule = require("../stickers/owner.cjs");
13
+ const library = require("../stickers/library.cjs");
14
+ const studio = require("../stickers/studio.cjs");
15
+
16
+ const keywords = Object.values(PACK_SUBCOMMANDS).flat();
17
+
18
+ function parse(args) {
19
+ const [first, ...rest] = args;
20
+ const word = /^[a-z]+$/i.test(first || "") ? first.toLowerCase() : first;
21
+ const action =
22
+ Object.entries(PACK_SUBCOMMANDS).find(([, words]) => words.includes(word))?.[0] || "auto";
23
+ if (action === "rename") {
24
+ const text = rest.join(" ").trim();
25
+ const names = text.includes("|")
26
+ ? text.split("|").map((s) => s.trim())
27
+ : rest.length === 2
28
+ ? rest
29
+ : [];
30
+ return {
31
+ action,
32
+ oldName: names[0] || "",
33
+ newName: names[1] || "",
34
+ valid: names.length === 2 && names.every(Boolean),
35
+ };
36
+ }
37
+ return { action, name: (action === "auto" ? args : rest).join(" ").trim() };
38
+ }
39
+
40
+ function requirePack(who, name) {
41
+ const pack = library.findPackByName(who, name);
42
+ if (!pack) throw new StickerError("PACK_NOT_FOUND", { name });
43
+ return pack;
44
+ }
45
+
46
+ module.exports = {
47
+ name: "pack",
48
+ aliases: ["حزمة"],
49
+ description: {
50
+ en: "Create, fill and manage your sticker packs.",
51
+ ar: "ينشئ حزم الملصقات ويديرها ويضيف إليها.",
52
+ },
53
+ usage: {
54
+ en: "pack <name> (reply to media to add)\npack <name> (show without a reply)\npack create <name>\npack add <name>\npack remove <name>\npack rename <old> | <new>\npack delete <name>\npack show <name>",
55
+ ar: "pack <الاسم> (رد على وسائط للإضافة)\npack <الاسم> (عرض بلا رد)\npack إنشاء <الاسم>\npack إضافة <الاسم>\npack إزالة <الاسم>\npack تسمية <القديم> | <الجديد>\npack حذف <الاسم>\npack عرض <الاسم>",
56
+ },
57
+ keywords,
58
+ chat: "all",
59
+ async execute(sock, msg, args = []) {
60
+ const jid = msg.key.remoteJid;
61
+ const who = await ownerModule.forMessage(msg, sock);
62
+ if (!who.key)
63
+ return sock.sendMessage(jid, {
64
+ text: tr("I couldn't identify the sender.", "تعذّر تحديد هوية المرسل."),
65
+ });
66
+ const parsed = parse(args);
67
+ let status;
68
+ try {
69
+ let line;
70
+ if (parsed.action === "rename") {
71
+ if (!parsed.valid) throw new StickerError("INVALID_NAME");
72
+ const pack = requirePack(who, parsed.oldName);
73
+ const renamed = library.updatePack(who, pack.id, parsed.newName);
74
+ line = tr(`Renamed pack to ${renamed.name}.`, `أُعيدت تسمية الحزمة إلى ${renamed.name}.`);
75
+ } else if (!parsed.name) {
76
+ line = tr(
77
+ `Use ${commandHint("pack", "<name>")} while replying to media, or ${commandHint("pack", "create <name>")}.`,
78
+ `استخدم ${commandHint("pack", "<الاسم>")} عند الرد على وسائط، أو ${commandHint("pack", "إنشاء <الاسم>")}.`,
79
+ );
80
+ } else if (parsed.action === "create") {
81
+ const pack = library.createPack(who, parsed.name);
82
+ line = tr(`Created pack ${pack.name}.`, `أُنشئت الحزمة ${pack.name}.`);
83
+ } else if (parsed.action === "delete") {
84
+ const pack = requirePack(who, parsed.name);
85
+ library.deletePack(who, pack.id);
86
+ line = tr(
87
+ `Deleted pack ${pack.name}. Its stickers remain in your library.`,
88
+ `حُذفت الحزمة ${pack.name}. بقيت ملصقاتها في مكتبتك.`,
89
+ );
90
+ } else if (parsed.action === "remove") {
91
+ const pack = requirePack(who, parsed.name);
92
+ const target = targetOf(msg, { quotedOnly: true });
93
+ if (target?.type !== "sticker") throw new StickerError("NO_MEDIA");
94
+ const buffer = await downloadTarget(target);
95
+ const sticker = library.findStickerByContent(who, buffer);
96
+ const removed = library.removeFromPack(who, pack.id, [sticker.id]);
97
+ if (!removed.affected) throw new StickerError("NOT_FOUND");
98
+ line = tr(
99
+ `Removed the sticker from ${pack.name}. It remains in your library.`,
100
+ `أُزيل الملصق من ${pack.name}. بقي في مكتبتك.`,
101
+ );
102
+ } else {
103
+ const target = targetOf(msg, { quotedOnly: true });
104
+ if (parsed.action === "show" || (parsed.action === "auto" && !target)) {
105
+ const pack = requirePack(who, parsed.name);
106
+ line = tr(
107
+ `${pack.name} — ${countLabel(pack.count)}. Use ${commandHint("stickers", `pack ${pack.name}`)} to see them.`,
108
+ `${pack.name} — ${countLabel(pack.count)}. استخدم ${commandHint("stickers", `حزمة ${pack.name}`)} لعرضها.`,
109
+ );
110
+ } else {
111
+ if (!target) throw new StickerError("NO_MEDIA");
112
+ let pack = library.findPackByName(who, parsed.name);
113
+ const createdPack = !pack;
114
+ if (createdPack) pack = library.createPack(who, parsed.name);
115
+ try {
116
+ const buffer = await downloadTarget(target);
117
+ status = await createStatus(
118
+ sock,
119
+ jid,
120
+ tr("🎨 Saving sticker...", "🎨 جارٍ حفظ الملصق..."),
121
+ { replyTo: msg },
122
+ );
123
+ const { promise } = studio.createFromBuffer({
124
+ owner: who,
125
+ buffer,
126
+ source: target.type === "sticker" ? "WHATSAPP_STICKER" : "BOT_COMMAND",
127
+ packId: pack.id,
128
+ maxSourceSeconds: BOT_VIDEO_MAX_SECONDS,
129
+ });
130
+ const result = await promise;
131
+ line = result.created
132
+ ? tr(`Saved sticker to ${pack.name}.`, `حُفظ الملصق في ${pack.name}.`)
133
+ : tr(
134
+ `Already in your library; added to ${pack.name}.`,
135
+ `الملصق موجود في مكتبتك بالفعل؛ أُضيف إلى ${pack.name}.`,
136
+ );
137
+ } catch (error) {
138
+ if (createdPack) {
139
+ try {
140
+ if (library.getPack(who, pack.id).pack.count === 0)
141
+ library.deletePack(who, pack.id);
142
+ } catch {
143
+ // Preserve the original conversion error; a concurrent change
144
+ // may have removed or filled the pack before cleanup.
145
+ }
146
+ }
147
+ throw error;
148
+ }
149
+ }
150
+ }
151
+ if (status) await status.finish(line);
152
+ else await sock.sendMessage(jid, { text: line });
153
+ } catch (error) {
154
+ const line = errorText(error);
155
+ if (status) await status.finish(line);
156
+ else await sock.sendMessage(jid, { text: line });
157
+ }
158
+ },
159
+ };
@@ -0,0 +1,47 @@
1
+ const { tr } = require("../utils/i18n.cjs");
2
+ const ownerModule = require("../stickers/owner.cjs");
3
+ const library = require("../stickers/library.cjs");
4
+ const { commandHint, countLabel, errorText } = require("../utils/stickerBot.cjs");
5
+
6
+ module.exports = {
7
+ name: "packs",
8
+ aliases: ["حزم"],
9
+ description: {
10
+ en: "List your sticker packs and library total.",
11
+ ar: "يعرض حزم ملصقاتك وإجمالي المكتبة.",
12
+ },
13
+ usage: { en: "packs", ar: "packs" },
14
+ chat: "all",
15
+ async execute(sock, msg) {
16
+ const jid = msg.key.remoteJid;
17
+ const who = await ownerModule.forMessage(msg, sock);
18
+ if (!who.key)
19
+ return sock.sendMessage(jid, {
20
+ text: tr("I couldn't identify the sender.", "تعذّر تحديد هوية المرسل."),
21
+ });
22
+ try {
23
+ const packs = library.listPacks(who);
24
+ const total = library.listStickers(who, { limit: 1 }).total;
25
+ if (!packs.length)
26
+ return sock.sendMessage(jid, {
27
+ text: tr(
28
+ `No packs yet. Reply to media with ${commandHint("pack", "<name>")} to start one. Library: ${countLabel(total)}.`,
29
+ `لا توجد حزم بعد. رد على وسائط بالأمر ${commandHint("pack", "<الاسم>")} لإنشاء حزمة. المكتبة: ${countLabel(total)}.`,
30
+ ),
31
+ });
32
+ const lines = packs.slice(0, 30).map((pack) => `${pack.name} — ${countLabel(pack.count)}`);
33
+ if (packs.length > 30)
34
+ lines.push(
35
+ tr(
36
+ `and ${countLabel(packs.length - 30, "pack")} more`,
37
+ `و${countLabel(packs.length - 30, "pack")} أخرى`,
38
+ ),
39
+ );
40
+ await sock.sendMessage(jid, {
41
+ text: `${tr("Your packs · Library:", "حزمك · المكتبة:")} ${countLabel(total)}\n${lines.join("\n")}`,
42
+ });
43
+ } catch (error) {
44
+ await sock.sendMessage(jid, { text: errorText(error) });
45
+ }
46
+ },
47
+ };
@@ -76,7 +76,7 @@ function labelFor(user) {
76
76
  // is async — awaiting them is not optional.
77
77
  async function rolesReport() {
78
78
  const { owners, admins, bootstrapOwners, bootstrapAdmins } = await listRoles();
79
- const none = tr("• (none)", "• (مفيش)");
79
+ const none = tr("• (none)", "• (لا شيء)");
80
80
  const lines = [tr("*🔑 Bot roles*", "*🔑 صلاحيات البوت*"), ""];
81
81
 
82
82
  lines.push(tr(`*👑 Owners (${owners.length}):*`, `*👑 المالكين (${owners.length}):*`));
@@ -220,7 +220,7 @@ module.exports = {
220
220
  {
221
221
  text: tr(
222
222
  `❌ *I couldn't change the role*\n\n*Details:* ${error.message}`,
223
- `❌ *مقدرتش أعدّل الصلاحية*\n\n*التفاصيل:* ${error.message}`,
223
+ `❌ *تعذّر تعديل الصلاحية*\n\n*التفاصيل:* ${error.message}`,
224
224
  ),
225
225
  },
226
226
  { replyTo: msg },
@@ -1,7 +1,7 @@
1
1
  // استفتاء — !poll
2
2
  //
3
- // !poll نروح فين النهاردة؟ | السينما | البحر | نقعد في البيت
4
- // !poll --multi اختر أكلك | كشري | فراخ | بيتزا (يسمح بأكتر من اختيار)
3
+ // !poll إلى أين نذهب اليوم؟ | السينما | البحر | نبقى في المنزل
4
+ // !poll --multi اختر طعامك | كشري | دجاج | بيتزا (يسمح بأكثر من خيار)
5
5
  //
6
6
  // Sends a native WhatsApp poll (not a text list), so members vote with a tap
7
7
  // and WhatsApp counts the results.
@@ -36,7 +36,7 @@ const HELP_TEXT_AR =
36
36
  "*خيارات:*\n" +
37
37
  "`--multi` يسمح باختيار أكتر من إجابة\n\n" +
38
38
  "*مثال:*\n" +
39
- "`!poll نروح فين؟ | السينما | البحر | البيت`\n\n" +
39
+ "`!poll إلى أين نذهب؟ | السينما | البحر | البيت`\n\n" +
40
40
  `_من ${MIN_OPTIONS} لـ ${MAX_OPTIONS} خيارات._`;
41
41
 
42
42
  /**
@@ -46,7 +46,7 @@ const HELP_TEXT_AR =
46
46
  "🎲 *عشوائي*\n\n" +
47
47
  "`!rand` رقم من 1 لـ 100\n" +
48
48
  "`!rand <أقصى>` رقم من 1 للرقم ده\n" +
49
- "`!rand <أدنى> <أقصى>` رقم بين الاتنين\n" +
49
+ "`!rand <أدنى> <أقصى>` رقم بين الحدّين\n" +
50
50
  "`!rand dice [عدد d أوجه]` نرد — مثال `!rand dice 2d6`\n" +
51
51
  "`!rand coin` ملك ولا كتابة\n" +
52
52
  "`!rand pick خيار | خيار | خيار` يختار واحد";
@@ -127,7 +127,7 @@ module.exports = {
127
127
  return reply(
128
128
  tr(
129
129
  `❌ Too many options (the limit is ${MAX_CHOICES}).`,
130
- `❌ الخيارات كتير أوي (الحد ${MAX_CHOICES}).`,
130
+ `❌ الخيارات كثيرة جدًا (الحد ${MAX_CHOICES}).`,
131
131
  ),
132
132
  );
133
133
  }
@@ -14,7 +14,7 @@ module.exports = {
14
14
  name: "restart",
15
15
  description: {
16
16
  en: "Reconnects WhatsApp (the process and panel stay up).",
17
- ar: "يعيد تشغيل اتصال واتساب (عملية البوت واللوحة يفضلوا شغالين).",
17
+ ar: "يعيد تشغيل اتصال واتساب (مع استمرار تشغيل البوت ولوحة التحكم).",
18
18
  },
19
19
  usage: {
20
20
  en: "restart",
@@ -27,7 +27,7 @@ module.exports = {
27
27
  const session = getSession();
28
28
  if (!session) {
29
29
  return await sock.sendMessage(chatId, {
30
- text: tr("The session manager isn't ready yet.", "مدير الجلسة لسه مش جاهز."),
30
+ text: tr("The session manager isn't ready yet.", "مدير الجلسة غير جاهز بعد."),
31
31
  });
32
32
  }
33
33
 
@@ -35,7 +35,7 @@ module.exports = {
35
35
  await sock.sendMessage(chatId, {
36
36
  text: tr(
37
37
  "🔄 Reconnecting WhatsApp... back in a moment.",
38
- "🔄 جاري إعادة تشغيل اتصال واتساب... هرجع في لحظة.",
38
+ "🔄 جارٍ إعادة تشغيل اتصال واتساب... سأعود خلال لحظات.",
39
39
  ),
40
40
  });
41
41
 
@@ -59,7 +59,7 @@ module.exports = {
59
59
  .sendMessage(chatId, {
60
60
  text: tr(
61
61
  `Connection state now: ${state?.status || "unknown"}. Check the panel's Connection screen.`,
62
- `حالة الاتصال دلوقتي: ${state?.status || "غير معروفة"}. راجع شاشة Connection في لوحة التحكم.`,
62
+ `حالة الاتصال الحالية: ${state?.status || "غير معروفة"}. راجع صفحة الاتصال في لوحة التحكم.`,
63
63
  ),
64
64
  })
65
65
  .catch(() => {});
@@ -86,7 +86,7 @@ module.exports = {
86
86
  return await sock.sendMessage(creatorJid, {
87
87
  text: tr(
88
88
  "I couldn't schedule that message. Check the time and try again.",
89
- "معرفتش أجدول الرسالة دي. راجع الوقت وجرب تاني.",
89
+ "تعذّرت جدولة هذه الرسالة. راجع الوقت وحاول مرة أخرى.",
90
90
  ),
91
91
  });
92
92
  }
@@ -8,28 +8,11 @@
8
8
  // decrypt it again — nothing is cached and nothing is archived.
9
9
  const { downloadContentFromMessage } = require("@whiskeysockets/baileys");
10
10
  const { downloadMedia } = require("../utils/geminiMedia.cjs");
11
- const { unwrapMessage, visibleText } = require("../utils/messageContent.cjs");
11
+ const { visibleText, pickMedia, quotedOf } = require("../utils/messageContent.cjs");
12
12
  const { createStatus } = require("../utils/statusMessage.cjs");
13
13
  const logger = require("../utils/logger.cjs");
14
14
  const { tr } = require("../utils/i18n.cjs");
15
15
 
16
- // The media in a message plus the download type that decrypts it — the type
17
- // WhatsApp filed it under, not the MIME type (same rule as the AI command).
18
- function pickMedia(message) {
19
- const inner = unwrapMessage(message);
20
- if (inner.stickerMessage) return { media: inner.stickerMessage, type: "sticker" };
21
- if (inner.imageMessage) return { media: inner.imageMessage, type: "image" };
22
- if (inner.videoMessage) return { media: inner.videoMessage, type: "video" };
23
- if (inner.audioMessage) return { media: inner.audioMessage, type: "audio" };
24
- if (inner.documentMessage) return { media: inner.documentMessage, type: "document" };
25
- return null;
26
- }
27
-
28
- function quotedOf(msg) {
29
- const own = unwrapMessage(msg.message);
30
- return own.extendedTextMessage?.contextInfo?.quotedMessage || null;
31
- }
32
-
33
16
  module.exports = {
34
17
  name: "send",
35
18
  description: {
@@ -63,7 +46,7 @@ module.exports = {
63
46
  });
64
47
  }
65
48
 
66
- const status = await createStatus(sock, chatId, tr("📥 Sending...", "📥 جاري الإرسال..."), {
49
+ const status = await createStatus(sock, chatId, tr("📥 Sending...", "📥 جارٍ الإرسال..."), {
67
50
  replyTo: msg,
68
51
  });
69
52
 
@@ -108,7 +91,7 @@ module.exports = {
108
91
  error,
109
92
  tr(
110
93
  "Couldn't re-send it — the media may have expired",
111
- "معرفتش أبعته — ممكن الميديا تكون انتهت",
94
+ "تعذّر إرساله — ربما انتهت صلاحية ملف الوسائط",
112
95
  ),
113
96
  );
114
97
  }
@@ -57,8 +57,8 @@ module.exports = {
57
57
  // binary is otherwise invisible.
58
58
  const ffmpeg = await checkFfmpeg();
59
59
  const ffmpegLine = ffmpeg.ok
60
- ? `✅ ${ffmpeg.version || tr("working", "شغال")}`
61
- : tr(`❌ not working (${ffmpeg.path})`, `❌ مش شغال (${ffmpeg.path})`);
60
+ ? `✅ ${ffmpeg.version || tr("working", "يعمل")}`
61
+ : tr(`❌ not working (${ffmpeg.path})`, `❌ لا يعمل (${ffmpeg.path})`);
62
62
 
63
63
  // --- BUILDING THE REPLY ---
64
64
  const reply = tr(