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.
- package/README.md +1 -0
- package/package.json +1 -1
- package/public/dashboard/assets/index-5P8GnKLg.css +2 -0
- package/public/dashboard/assets/index-DXzno3X6.js +515 -0
- package/public/dashboard/index.html +2 -2
- package/public/dashboard.css +32 -0
- package/src/bootstrap/panel.js +16 -4
- package/src/commands/autoschedule.cjs +1 -1
- package/src/commands/blacklist.cjs +1 -1
- package/src/commands/calc.cjs +9 -9
- package/src/commands/gemini.cjs +26 -26
- package/src/commands/group/add.cjs +2 -2
- package/src/commands/group/demote.cjs +2 -2
- package/src/commands/group/members.cjs +2 -2
- package/src/commands/group/rules.cjs +1 -1
- package/src/commands/group/setname.cjs +3 -3
- package/src/commands/group/setpp.cjs +3 -3
- package/src/commands/group/setrules.cjs +1 -1
- package/src/commands/group/tagadmins.cjs +1 -1
- package/src/commands/group.cjs +1 -1
- package/src/commands/lang.cjs +3 -3
- package/src/commands/listschedules.cjs +1 -1
- package/src/commands/loop.cjs +3 -3
- package/src/commands/memory.cjs +18 -18
- package/src/commands/notes.cjs +1 -1
- package/src/commands/pack.cjs +159 -0
- package/src/commands/packs.cjs +47 -0
- package/src/commands/perm.cjs +2 -2
- package/src/commands/poll.cjs +3 -3
- package/src/commands/rand.cjs +2 -2
- package/src/commands/restart.cjs +4 -4
- package/src/commands/schedule.cjs +1 -1
- package/src/commands/send.cjs +3 -20
- package/src/commands/status.cjs +2 -2
- package/src/commands/sticker.cjs +77 -232
- package/src/commands/stickers.cjs +100 -0
- package/src/commands/stopbot.cjs +5 -5
- package/src/commands/stt.cjs +1 -1
- package/src/commands/toimage.cjs +88 -0
- package/src/commands/tts.cjs +2 -2
- package/src/config/defaults.cjs +5 -0
- package/src/config/settings.cjs +10 -0
- package/src/core/events.js +15 -1
- package/src/core/session.js +7 -0
- package/src/db/db.cjs +381 -0
- package/src/db/store.cjs +729 -21
- package/src/handlers/command.handler.js +5 -1
- package/src/panel/password-reset.cjs +1 -1
- package/src/routes/dashboard.api.esm.js +43 -10
- package/src/routes/stickers.api.esm.js +570 -0
- package/src/services/aiAgent.cjs +2 -2
- package/src/services/aiProviders.cjs +1 -1
- package/src/services/aiTools.cjs +27 -27
- package/src/stickers/errors.cjs +239 -0
- package/src/stickers/ffmpeg.cjs +133 -0
- package/src/stickers/jobs.cjs +183 -0
- package/src/stickers/library.cjs +712 -0
- package/src/stickers/limits.cjs +60 -0
- package/src/stickers/media.cjs +748 -0
- package/src/stickers/options.cjs +128 -0
- package/src/stickers/owner.cjs +103 -0
- package/src/stickers/studio.cjs +473 -0
- package/src/stickers/uploads.cjs +263 -0
- package/src/stickers/webp.cjs +231 -0
- package/src/stickers/zip.cjs +107 -0
- package/src/utils/memory.cjs +7 -7
- package/src/utils/messageContent.cjs +30 -4
- package/src/utils/recurrence.cjs +189 -30
- package/src/utils/stickerBot.cjs +84 -0
- package/src/utils/storage.cjs +3 -0
- package/src/utils/storage.esm.js +3 -0
- package/views/login.ejs +39 -3
- package/views/setup.ejs +21 -0
- package/public/dashboard/assets/index-BCXZoPGP.js +0 -446
- package/public/dashboard/assets/index-LvfJ8ybs.css +0 -2
|
@@ -49,6 +49,10 @@ const EDIT_IN_PLACE_EXCLUDE = new Set([
|
|
|
49
49
|
"loop",
|
|
50
50
|
"rand",
|
|
51
51
|
"poll",
|
|
52
|
+
"sticker",
|
|
53
|
+
"toimage",
|
|
54
|
+
"pack",
|
|
55
|
+
"stickers",
|
|
52
56
|
]);
|
|
53
57
|
|
|
54
58
|
// Wrap a socket so commands reply nicely:
|
|
@@ -299,7 +303,7 @@ async function runCommand(sock, msg, body, { command, args, invokedName, isGroup
|
|
|
299
303
|
await sendBotMessage(
|
|
300
304
|
sock,
|
|
301
305
|
msg.key.remoteJid,
|
|
302
|
-
{ text: tr("⛔ This command is turned off right now.", "⛔ الأمر
|
|
306
|
+
{ text: tr("⛔ This command is turned off right now.", "⛔ هذا الأمر معطّل حاليًا.") },
|
|
303
307
|
{ replyTo: msg },
|
|
304
308
|
);
|
|
305
309
|
return true;
|
|
@@ -68,7 +68,7 @@ function codeMessage(code) {
|
|
|
68
68
|
`If you didn't request this, ignore this message — nobody else can use it.`,
|
|
69
69
|
`🔐 *${brand.name} — كود إعادة تعيين كلمة السر: ${code}*\n\n` +
|
|
70
70
|
`ادخل الكود في لوحة التحكم خلال ١٠ دقائق. ` +
|
|
71
|
-
|
|
71
|
+
`إذا لم تطلب هذا الرمز، فتجاهل الرسالة — لا يمكن لأحد سواك استخدامه.`,
|
|
72
72
|
),
|
|
73
73
|
);
|
|
74
74
|
}
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
getGroupSettings,
|
|
38
38
|
getRecentDebts,
|
|
39
39
|
getSchedules,
|
|
40
|
+
rememberSavedName,
|
|
40
41
|
saveGroupSettings,
|
|
41
42
|
} from "../utils/storage.esm.js";
|
|
42
43
|
|
|
@@ -66,7 +67,11 @@ const {
|
|
|
66
67
|
scheduleNewJob,
|
|
67
68
|
saveScheduledJob,
|
|
68
69
|
} = require("../../scheduler.cjs");
|
|
69
|
-
const {
|
|
70
|
+
const {
|
|
71
|
+
describeScheduledJob,
|
|
72
|
+
recurrenceErrorMessage,
|
|
73
|
+
recurrenceToCron,
|
|
74
|
+
} = require("../utils/recurrence.cjs");
|
|
70
75
|
const { discoverProviderModels, DiscoveryError } = require("../services/llmDiscovery.cjs");
|
|
71
76
|
const settingsTransfer = require("../services/settingsTransfer.cjs");
|
|
72
77
|
const cron = require("node-cron");
|
|
@@ -960,10 +965,14 @@ function scheduleView(job) {
|
|
|
960
965
|
const peer = describePeer(job.targetJid);
|
|
961
966
|
return {
|
|
962
967
|
...job,
|
|
963
|
-
when: describeScheduledJob(job, timezone),
|
|
968
|
+
when: describeScheduledJob(job, timezone, "en"),
|
|
969
|
+
whenAr: describeScheduledJob(job, timezone, "ar"),
|
|
964
970
|
targetLabel: peer.label,
|
|
965
971
|
targetKind: peer.kind,
|
|
966
972
|
targetPhone: peer.phone,
|
|
973
|
+
savedName: peer.savedName ?? null,
|
|
974
|
+
pushName: peer.pushName ?? null,
|
|
975
|
+
phone: peer.phone,
|
|
967
976
|
};
|
|
968
977
|
}
|
|
969
978
|
|
|
@@ -986,6 +995,9 @@ router.get("/recipients", (req, res) => {
|
|
|
986
995
|
name: live?.subject || peer.label,
|
|
987
996
|
type: "group",
|
|
988
997
|
memberCount: live?.participants?.length ?? peer.memberCount,
|
|
998
|
+
savedName: null,
|
|
999
|
+
pushName: null,
|
|
1000
|
+
phone: null,
|
|
989
1001
|
});
|
|
990
1002
|
};
|
|
991
1003
|
|
|
@@ -998,12 +1010,18 @@ router.get("/recipients", (req, res) => {
|
|
|
998
1010
|
for (const u of users.slice(0, 80)) {
|
|
999
1011
|
const jid = u.jid;
|
|
1000
1012
|
if (!jid || seen.has(jid) || String(jid).endsWith("@g.us")) continue;
|
|
1001
|
-
seen.add(jid);
|
|
1002
1013
|
const peer = describePeer(jid);
|
|
1014
|
+
const personKey = peer.phone || u.lid || jid;
|
|
1015
|
+
if (seen.has(personKey)) continue;
|
|
1016
|
+
seen.add(jid);
|
|
1017
|
+
seen.add(personKey);
|
|
1018
|
+
if (u.lid) seen.add(u.lid);
|
|
1003
1019
|
recipients.push({
|
|
1004
1020
|
id: jid,
|
|
1005
1021
|
name: peer.label,
|
|
1006
1022
|
phone: peer.phone,
|
|
1023
|
+
savedName: peer.savedName ?? null,
|
|
1024
|
+
pushName: peer.pushName ?? null,
|
|
1007
1025
|
type: "contact",
|
|
1008
1026
|
});
|
|
1009
1027
|
}
|
|
@@ -1022,7 +1040,8 @@ router.post(
|
|
|
1022
1040
|
return badRequest(res, "Maximum 3 scheduled messages reached");
|
|
1023
1041
|
}
|
|
1024
1042
|
|
|
1025
|
-
const { targetJid, message, type, cronString, scheduledTime } =
|
|
1043
|
+
const { targetJid, message, type, cronString, scheduledTime, recurrence, targetName } =
|
|
1044
|
+
req.body || {};
|
|
1026
1045
|
if (!targetJid || !message) {
|
|
1027
1046
|
return badRequest(res, "Recipient and message are required");
|
|
1028
1047
|
}
|
|
@@ -1038,10 +1057,20 @@ router.post(
|
|
|
1038
1057
|
};
|
|
1039
1058
|
|
|
1040
1059
|
if (job.type === "recurring") {
|
|
1041
|
-
if (
|
|
1042
|
-
|
|
1060
|
+
if (recurrence && typeof recurrence === "object") {
|
|
1061
|
+
const built = recurrenceToCron(recurrence);
|
|
1062
|
+
if (built.error) return badRequest(res, recurrenceErrorMessage(built.error));
|
|
1063
|
+
if (!cron.validate(built.cronString)) {
|
|
1064
|
+
return badRequest(res, recurrenceErrorMessage("recurrence"));
|
|
1065
|
+
}
|
|
1066
|
+
job.cronString = built.cronString;
|
|
1067
|
+
} else if (cronString && cron.validate(cronString)) {
|
|
1068
|
+
// Raw cron is accepted only for existing callers/tests. The panel
|
|
1069
|
+
// sends a structured `recurrence` object and never a cron string.
|
|
1070
|
+
job.cronString = cronString;
|
|
1071
|
+
} else {
|
|
1072
|
+
return badRequest(res, "Invalid recurrence");
|
|
1043
1073
|
}
|
|
1044
|
-
job.cron = cronString;
|
|
1045
1074
|
} else {
|
|
1046
1075
|
const timeMs = Number(scheduledTime);
|
|
1047
1076
|
if (!timeMs || timeMs <= Date.now()) {
|
|
@@ -1050,13 +1079,17 @@ router.post(
|
|
|
1050
1079
|
job.date = new Date(timeMs).toISOString();
|
|
1051
1080
|
}
|
|
1052
1081
|
|
|
1053
|
-
|
|
1082
|
+
if (targetName && !String(job.targetJid).endsWith("@g.us")) {
|
|
1083
|
+
rememberSavedName(job.targetJid, targetName);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
const saved = saveScheduledJob(job);
|
|
1054
1087
|
const sock = currentSocket();
|
|
1055
1088
|
if (sock) {
|
|
1056
|
-
scheduleNewJob(sock,
|
|
1089
|
+
scheduleNewJob(sock, saved);
|
|
1057
1090
|
}
|
|
1058
1091
|
|
|
1059
|
-
res.json({ success: true, schedule: scheduleView(
|
|
1092
|
+
res.json({ success: true, schedule: scheduleView(saved) });
|
|
1060
1093
|
}),
|
|
1061
1094
|
);
|
|
1062
1095
|
|