levix-bot 4.9.1 → 5.0.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 +57 -3
- package/SETUP.md +63 -7
- package/app.cjs +159 -46
- package/deploy/install.sh +10 -5
- package/package.json +9 -6
- package/public/dashboard/assets/40af6d88b63079a0-BZ8ojJNu.woff2 +0 -0
- package/public/dashboard/assets/481acf6760031cee-BypgxfGb.woff2 +0 -0
- package/public/dashboard/assets/6d3351fc535f8ef3-D2-eand5.woff2 +0 -0
- package/public/dashboard/assets/8ab0af53a3bda9d3-CyCXRvzh.woff2 +0 -0
- package/public/dashboard/assets/8f262393e9249e61-TQp-UTiE.woff2 +0 -0
- package/public/dashboard/assets/94d65887a83f1282-DmpS2jIq.woff2 +0 -0
- package/public/dashboard/assets/99e400330f36ae77-D3oMJlXt.woff2 +0 -0
- package/public/dashboard/assets/9d1f41b13e519d90-BVNSOH3d.woff2 +0 -0
- package/public/dashboard/assets/a005256cb957ecc7-CoYeBiSI.woff2 +0 -0
- package/public/dashboard/assets/b19c2080652a3c2b-DIC32ArD.woff2 +0 -0
- package/public/dashboard/assets/c4064400db3750ce-BehTv68k.woff2 +0 -0
- package/public/dashboard/assets/c69d345fa1068c2d-CmI34b-g.woff2 +0 -0
- package/public/dashboard/assets/cc27b30471250057-6fWv1k7M.woff2 +0 -0
- package/public/dashboard/assets/d8c30647abfeffe6-eXO_dkmS.woff2 +0 -0
- package/public/dashboard/assets/eb83d8d40af4411f-Buze_B52.woff2 +0 -0
- package/public/dashboard/assets/effc6711249e7349-qRpaaN48.woff2 +0 -0
- package/public/dashboard/assets/gateway-BDYet0pI.css +1 -0
- package/public/dashboard/assets/gateway-BYt6-s1O.js +1 -0
- package/public/dashboard/assets/index-B9wFpD_z.css +2 -0
- package/public/dashboard/assets/index-DWcQmu0_.js +124 -0
- package/public/dashboard/assets/index-Da-j89O-.js +458 -0
- package/public/dashboard/font-licenses/jetbrainsmono-OFL.txt +93 -0
- package/public/dashboard/font-licenses/plusjakartasans-OFL.txt +93 -0
- package/public/dashboard/font-licenses/tajawal-OFL.txt +93 -0
- package/public/dashboard/gateway.html +17 -0
- package/public/dashboard/index.html +3 -5
- package/public/ui-boot.js +33 -14
- package/scheduler.cjs +76 -23
- package/src/auth/auth-storage.cjs +54 -7
- package/src/auth/use-database-auth-state.js +70 -39
- package/src/automation/engine.js +412 -0
- package/src/automation/limits.cjs +6 -0
- package/src/automation/manage.js +290 -0
- package/src/automation/reactions.js +471 -0
- package/src/automation/rules.cjs +114 -0
- package/src/automation/status.cjs +76 -0
- package/src/backup/account.cjs +29 -0
- package/src/backup/activation.cjs +247 -0
- package/src/backup/content.cjs +36 -0
- package/src/backup/create.cjs +280 -0
- package/src/backup/extensions.cjs +101 -0
- package/src/backup/format.cjs +565 -0
- package/src/backup/jobs.cjs +111 -0
- package/src/backup/journal.cjs +41 -0
- package/src/backup/plan.cjs +223 -0
- package/src/backup/recovery.cjs +110 -0
- package/src/backup/restore.cjs +460 -0
- package/src/backup/uploads.cjs +146 -0
- package/src/bootstrap/core.js +50 -12
- package/src/bootstrap/panel.js +53 -2
- package/src/bootstrap/session-startup-policy.js +8 -1
- package/src/cli.js +163 -22
- package/src/commands/autodelete.cjs +41 -57
- package/src/commands/autoschedule.cjs +7 -33
- package/src/commands/blacklist.cjs +17 -35
- package/src/commands/block.cjs +4 -18
- package/src/commands/calc.cjs +22 -74
- package/src/commands/debt.cjs +28 -59
- package/src/commands/deleteschedule.cjs +7 -23
- package/src/commands/digit.cjs +5 -39
- package/src/commands/gemini.cjs +135 -218
- package/src/commands/group/add.cjs +28 -76
- package/src/commands/group/all.cjs +4 -15
- package/src/commands/group/antilink.cjs +28 -41
- package/src/commands/group/antispam.cjs +25 -35
- package/src/commands/group/approveall.cjs +7 -21
- package/src/commands/group/clearwarns.cjs +4 -18
- package/src/commands/group/deletenote.cjs +4 -18
- package/src/commands/group/demote.cjs +6 -23
- package/src/commands/group/flagged.cjs +10 -19
- package/src/commands/group/kick.cjs +26 -36
- package/src/commands/group/media.cjs +21 -36
- package/src/commands/group/members.cjs +16 -28
- package/src/commands/group/note.cjs +3 -14
- package/src/commands/group/policy.cjs +16 -37
- package/src/commands/group/promote.cjs +5 -22
- package/src/commands/group/removeall.cjs +6 -38
- package/src/commands/group/rules.cjs +4 -19
- package/src/commands/group/save.cjs +4 -18
- package/src/commands/group/setname.cjs +5 -19
- package/src/commands/group/setpp.cjs +8 -26
- package/src/commands/group/setrules.cjs +4 -15
- package/src/commands/group/setwarn.cjs +6 -23
- package/src/commands/group/tagadmins.cjs +5 -16
- package/src/commands/group/warn.cjs +5 -16
- package/src/commands/group/warns.cjs +12 -33
- package/src/commands/group/welcome.cjs +17 -34
- package/src/commands/group.cjs +91 -68
- package/src/commands/help.cjs +48 -89
- package/src/commands/lang.cjs +38 -97
- package/src/commands/listschedules.cjs +19 -30
- package/src/commands/loop.cjs +9 -55
- package/src/commands/md.cjs +2 -13
- package/src/commands/memory.cjs +53 -87
- package/src/commands/mod.cjs +40 -79
- package/src/commands/notes.cjs +4 -15
- package/src/commands/pack.cjs +26 -49
- package/src/commands/packs.cjs +8 -18
- package/src/commands/perm.cjs +48 -51
- package/src/commands/ping.cjs +2 -10
- package/src/commands/poll.cjs +5 -38
- package/src/commands/prayer.cjs +55 -36
- package/src/commands/qr.cjs +4 -18
- package/src/commands/rand.cjs +9 -58
- package/src/commands/restart.cjs +15 -33
- package/src/commands/schedule.cjs +5 -25
- package/src/commands/score.cjs +6 -27
- package/src/commands/send.cjs +4 -18
- package/src/commands/setprefix.cjs +11 -23
- package/src/commands/shortlink.cjs +13 -39
- package/src/commands/status.cjs +188 -76
- package/src/commands/sticker.cjs +5 -16
- package/src/commands/stickers.cjs +16 -20
- package/src/commands/stopbot.cjs +9 -25
- package/src/commands/stt.cjs +75 -107
- package/src/commands/todo.cjs +11 -31
- package/src/commands/toimage.cjs +11 -27
- package/src/commands/translate.cjs +53 -36
- package/src/commands/tts.cjs +46 -40
- package/src/commands/unblock.cjs +3 -17
- package/src/commands/update.cjs +23 -0
- package/src/commands/weather.cjs +40 -47
- package/src/config/ai-identity.cjs +14 -1
- package/src/config/baileys.config.js +16 -3
- package/src/config/data-dir.cjs +37 -0
- package/src/config/defaults.cjs +1 -0
- package/src/config/exit-codes.cjs +11 -0
- package/src/config/lock.cjs +55 -81
- package/src/config/official-links.cjs +61 -0
- package/src/config/paths.cjs +4 -33
- package/src/config/release.cjs +87 -0
- package/src/config/settings.cjs +199 -10
- package/src/core/connection.js +77 -9
- package/src/core/events.js +119 -33
- package/src/core/session.js +536 -84
- package/src/core/socket.js +81 -10
- package/src/db/copy.cjs +136 -0
- package/src/db/db.cjs +241 -36
- package/src/db/startup-guard.js +5 -0
- package/src/db/store.cjs +561 -54
- package/src/diagnostics/baileysLog.cjs +87 -0
- package/src/diagnostics/debugLog.cjs +16 -4
- package/src/diagnostics/device.cjs +4 -2
- package/src/diagnostics/nodeRuntime.cjs +131 -0
- package/src/diagnostics/signalSessionInspect.cjs +38 -0
- package/src/domain/command.js +24 -22
- package/src/extensions/autoReply.cjs +521 -0
- package/src/extensions/context.cjs +73 -0
- package/src/extensions/contract.cjs +69 -0
- package/src/extensions/entitlement/client.cjs +381 -0
- package/src/extensions/entitlement/index.cjs +629 -0
- package/src/extensions/entitlement/installation.cjs +117 -0
- package/src/extensions/entitlement/keys.cjs +72 -0
- package/src/extensions/entitlement/state.cjs +201 -0
- package/src/extensions/entitlement/target.cjs +7 -0
- package/src/extensions/entitlement/token.cjs +225 -0
- package/src/extensions/host.cjs +519 -0
- package/src/extensions/templateKeys.cjs +81 -0
- package/src/handlers/command.handler.js +191 -64
- package/src/handlers/group.handler.js +78 -18
- package/src/handlers/message.handler.js +56 -25
- package/src/i18n/catalog.generated.cjs +3537 -0
- package/src/index.js +51 -12
- package/src/legal/bundled/ar.json +102 -0
- package/src/legal/bundled/en.json +102 -0
- package/src/legal/bundled/es-419.json +102 -0
- package/src/legal/bundled/pt-BR.json +102 -0
- package/src/legal/cli.cjs +200 -0
- package/src/legal/consent.cjs +187 -0
- package/src/legal/document.cjs +156 -0
- package/src/legal/keys.cjs +100 -0
- package/src/legal/release.cjs +226 -0
- package/src/legal/remote.cjs +419 -0
- package/src/legal/terms.cjs +142 -0
- package/src/messaging/escape.cjs +31 -0
- package/src/messaging/health.cjs +65 -0
- package/src/messaging/identity.cjs +42 -0
- package/src/messaging/message.cjs +136 -0
- package/src/messaging/parser.cjs +88 -0
- package/src/messaging/router.cjs +217 -0
- package/src/middleware/permissions.middleware.js +34 -2
- package/src/panel/account-profile.cjs +489 -0
- package/src/panel/fallback-page.cjs +177 -0
- package/src/panel/password-reset.cjs +13 -14
- package/src/panel/recovery-email.cjs +3 -1
- package/src/routes/backup.api.esm.js +175 -0
- package/src/routes/dashboard.api.esm.js +183 -7
- package/src/routes/plus.api.esm.js +172 -0
- package/src/routes/reactions.api.esm.js +60 -0
- package/src/services/aiAgent.cjs +56 -43
- package/src/services/aiDocs.cjs +187 -0
- package/src/services/aiImage.cjs +183 -0
- package/src/services/aiMedia.cjs +146 -0
- package/src/services/aiProviders.cjs +76 -80
- package/src/services/aiRouter.cjs +2 -2
- package/src/services/aiToolAuth.cjs +76 -4
- package/src/services/aiTools.cjs +431 -105
- package/src/services/autoDelete.cjs +9 -1
- package/src/services/levix-docs.generated.json +2623 -0
- package/src/services/memoryPolicy.cjs +56 -0
- package/src/services/updateCheck.cjs +362 -0
- package/src/stickers/errors.cjs +53 -97
- package/src/stickers/library.cjs +13 -6
- package/src/stickers/owner.cjs +1 -1
- package/src/utils/commandContext.cjs +13 -0
- package/src/utils/commandDocs.cjs +42 -20
- package/src/utils/geminiHttpOptions.cjs +56 -0
- package/src/utils/geminiMedia.cjs +28 -3
- package/src/utils/groupMetadataCache.cjs +386 -21
- package/src/utils/httpsFetch.cjs +113 -0
- package/src/utils/i18n.cjs +117 -7
- package/src/utils/linkPreview.cjs +90 -0
- package/src/utils/logger.cjs +6 -0
- package/src/utils/markdownParser.cjs +3 -3
- package/src/utils/memory.cjs +375 -28
- package/src/utils/messageContent.cjs +7 -1
- package/src/utils/moderationAction.cjs +116 -73
- package/src/utils/moderationSummary.cjs +32 -56
- package/src/utils/permissionLevel.cjs +7 -28
- package/src/utils/permissions.cjs +23 -14
- package/src/utils/permissions.esm.js +99 -166
- package/src/utils/recentMessageCache.esm.js +241 -37
- package/src/utils/recurrence.cjs +78 -66
- package/src/utils/sendBotMessage.cjs +14 -29
- package/src/utils/sendBotMessage.esm.js +28 -13
- package/src/utils/statusMessage.cjs +94 -33
- package/src/utils/stickerBot.cjs +18 -16
- package/src/utils/storage.cjs +2 -0
- package/src/utils/storage.esm.js +2 -0
- package/src/utils/thumbnail.cjs +5 -21
- package/public/dashboard/assets/index-B1sOW2VX.js +0 -561
- package/public/dashboard/assets/index-CK8osB4o.css +0 -2
- package/public/dashboard.css +0 -3127
- package/public/dashboard.js +0 -1981
- package/public/gateway-i18n.js +0 -321
- package/public/gateway.js +0 -70
- package/views/dashboard.ejs +0 -775
- package/views/login.ejs +0 -408
- package/views/qr.ejs +0 -155
- package/views/setup.ejs +0 -118
|
@@ -5,18 +5,10 @@ const {
|
|
|
5
5
|
rosterJidForSync,
|
|
6
6
|
} = require("../../utils/permissions.cjs");
|
|
7
7
|
const { targetFromCommand } = require("../../utils/moderationAction.cjs");
|
|
8
|
-
const {
|
|
8
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
name: "promote",
|
|
12
|
-
description: {
|
|
13
|
-
en: "Promotes a member to admin.",
|
|
14
|
-
ar: "يرقّي عضوًا إلى مشرف.",
|
|
15
|
-
},
|
|
16
|
-
usage: {
|
|
17
|
-
en: "promote @member",
|
|
18
|
-
ar: "promote @عضو",
|
|
19
|
-
},
|
|
20
12
|
chat: "group",
|
|
21
13
|
userAdminRequired: true,
|
|
22
14
|
botAdminRequired: true,
|
|
@@ -28,10 +20,7 @@ module.exports = {
|
|
|
28
20
|
|
|
29
21
|
if (!targetJid) {
|
|
30
22
|
return await sock.sendMessage(groupId, {
|
|
31
|
-
text:
|
|
32
|
-
"Mention the member, or reply to their message, to promote them.",
|
|
33
|
-
"يجب عمل منشن للعضو أو الرد على رسالته لترقيته.",
|
|
34
|
-
),
|
|
23
|
+
text: t("bot.group.promote.noTarget"),
|
|
35
24
|
});
|
|
36
25
|
}
|
|
37
26
|
|
|
@@ -40,10 +29,7 @@ module.exports = {
|
|
|
40
29
|
|
|
41
30
|
if (targetUser && (targetUser.admin === "admin" || targetUser.admin === "superadmin")) {
|
|
42
31
|
return await sock.sendMessage(groupId, {
|
|
43
|
-
text:
|
|
44
|
-
`⚠️ @${targetJid.split("@")[0]} is already an admin.`,
|
|
45
|
-
`⚠️ العضو @${targetJid.split("@")[0]} مشرف بالفعل.`,
|
|
46
|
-
),
|
|
32
|
+
text: t("bot.group.promote.alreadyAdmin", { number: targetJid.split("@")[0] }),
|
|
47
33
|
mentions: [targetJid],
|
|
48
34
|
});
|
|
49
35
|
}
|
|
@@ -51,16 +37,13 @@ module.exports = {
|
|
|
51
37
|
try {
|
|
52
38
|
await sock.groupParticipantsUpdate(groupId, [rosterJid], "promote");
|
|
53
39
|
await sock.sendMessage(groupId, {
|
|
54
|
-
text:
|
|
55
|
-
`👑 @${targetJid.split("@")[0]} is now an admin.`,
|
|
56
|
-
`👑 تم ترقية @${targetJid.split("@")[0]} إلى مشرف بنجاح.`,
|
|
57
|
-
),
|
|
40
|
+
text: t("bot.group.promote.done", { number: targetJid.split("@")[0] }),
|
|
58
41
|
mentions: [targetJid],
|
|
59
42
|
});
|
|
60
43
|
} catch (error) {
|
|
61
44
|
logger.error({ err: error, command: "promote" }, "Error in !promote command");
|
|
62
45
|
await sock.sendMessage(groupId, {
|
|
63
|
-
text:
|
|
46
|
+
text: t("bot.group.promote.failed"),
|
|
64
47
|
});
|
|
65
48
|
}
|
|
66
49
|
},
|
|
@@ -1,49 +1,17 @@
|
|
|
1
1
|
// file: /commands/removeall.js
|
|
2
|
-
const
|
|
3
|
-
const { tr } = require("../../utils/i18n.cjs");
|
|
2
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
4
3
|
|
|
5
4
|
module.exports = {
|
|
6
5
|
name: "removeall",
|
|
7
|
-
description: {
|
|
8
|
-
en: "Removes every non-admin member from the group, after confirmation.",
|
|
9
|
-
ar: "يطرد كل الأعضاء غير المشرفين من المجموعة بعد التأكيد.",
|
|
10
|
-
},
|
|
11
|
-
usage: {
|
|
12
|
-
en: "removeall",
|
|
13
|
-
ar: "removeall",
|
|
14
|
-
},
|
|
15
6
|
chat: "group",
|
|
16
7
|
userAdminRequired: true,
|
|
17
8
|
botAdminRequired: true,
|
|
18
9
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const groupId = msg.key.remoteJid;
|
|
25
|
-
|
|
26
|
-
// Ask for confirmation
|
|
27
|
-
await sock.sendMessage(groupId, {
|
|
28
|
-
text: tr(
|
|
29
|
-
"⚠️ Are you sure you want to remove every non-admin member?\n\nSend `yes` within 30 seconds to confirm.",
|
|
30
|
-
"⚠️ هل أنت متأكد من أنك تريد حذف جميع الأعضاء غير المشرفين؟\n\nأرسل `yes` للتأكيد خلال 30 ثانية.",
|
|
31
|
-
),
|
|
10
|
+
// Removing every member at once is disabled. The old confirmation flow had no
|
|
11
|
+
// consumer, so the command only says so and removes nobody.
|
|
12
|
+
async execute(sock, msg) {
|
|
13
|
+
await sock.sendMessage(msg.key.remoteJid, {
|
|
14
|
+
text: t("bot.group.removeall.unavailable"),
|
|
32
15
|
});
|
|
33
|
-
|
|
34
|
-
// Store the confirmation request
|
|
35
|
-
confirmationSessions.set(senderId, {
|
|
36
|
-
command: "removeall",
|
|
37
|
-
groupId: groupId,
|
|
38
|
-
timestamp: Date.now(),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Set a timeout to delete the confirmation request after 30 seconds
|
|
42
|
-
setTimeout(() => {
|
|
43
|
-
if (confirmationSessions.has(senderId)) {
|
|
44
|
-
confirmationSessions.delete(senderId);
|
|
45
|
-
logger.info(`[Confirmation] Timed out for ${senderId} on command removeall.`);
|
|
46
|
-
}
|
|
47
|
-
}, 30000); // 30 seconds
|
|
48
16
|
},
|
|
49
17
|
};
|
|
@@ -2,18 +2,10 @@
|
|
|
2
2
|
const { getGroupSettings } = require("../../utils/storage.cjs");
|
|
3
3
|
const { buildModerationSummary } = require("../../utils/moderationSummary.cjs");
|
|
4
4
|
const logger = require("../../utils/logger.cjs");
|
|
5
|
-
const {
|
|
5
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
6
6
|
|
|
7
7
|
module.exports = {
|
|
8
8
|
name: "rules",
|
|
9
|
-
description: {
|
|
10
|
-
en: "Shows the group rules.",
|
|
11
|
-
ar: "يعرض قواعد المجموعة.",
|
|
12
|
-
},
|
|
13
|
-
usage: {
|
|
14
|
-
en: "rules",
|
|
15
|
-
ar: "rules",
|
|
16
|
-
},
|
|
17
9
|
chat: "group",
|
|
18
10
|
|
|
19
11
|
async execute(sock, msg) {
|
|
@@ -25,24 +17,17 @@ module.exports = {
|
|
|
25
17
|
const summary = buildModerationSummary(settings);
|
|
26
18
|
|
|
27
19
|
if (rules) {
|
|
28
|
-
const reply =
|
|
29
|
-
`*📜 Rules of ${msg.pushName}'s group:*\n\n${rules}\n\n${summary}`,
|
|
30
|
-
`*📜 قواعد جروب ${msg.pushName}:*\n\n${rules}\n\n${summary}`,
|
|
31
|
-
);
|
|
20
|
+
const reply = t("bot.group.rules.header", { name: msg.pushName, rules, summary });
|
|
32
21
|
await sock.sendMessage(groupId, { text: reply });
|
|
33
22
|
} else {
|
|
34
23
|
await sock.sendMessage(groupId, {
|
|
35
|
-
text:
|
|
36
|
-
tr(
|
|
37
|
-
"This group has no rules yet. Admins can set them with `!setrules`.",
|
|
38
|
-
"لم يتم تعيين أي قواعد لهذه المجموعة حتى الآن. يمكن للمشرفين تعيينها باستخدام `!setrules`.",
|
|
39
|
-
) + `\n\n${summary}`,
|
|
24
|
+
text: t("bot.group.rules.none") + `\n\n${summary}`,
|
|
40
25
|
});
|
|
41
26
|
}
|
|
42
27
|
} catch (error) {
|
|
43
28
|
logger.error(error, "[Error] in !rules command:");
|
|
44
29
|
await sock.sendMessage(groupId, {
|
|
45
|
-
text:
|
|
30
|
+
text: t("bot.group.rules.failed"),
|
|
46
31
|
});
|
|
47
32
|
}
|
|
48
33
|
},
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
// file: /commands/save.js
|
|
2
2
|
const { saveNote } = require("../../utils/storage.cjs");
|
|
3
3
|
const logger = require("../../utils/logger.cjs");
|
|
4
|
-
const {
|
|
4
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
name: "save",
|
|
8
|
-
description: {
|
|
9
|
-
en: "Saves a new note for the group.",
|
|
10
|
-
ar: "يحفظ ملاحظة جديدة للمجموعة.",
|
|
11
|
-
},
|
|
12
|
-
usage: {
|
|
13
|
-
en: "save #keyword <note text>",
|
|
14
|
-
ar: "save #الكلمة-المفتاحية <نص الملاحظة>",
|
|
15
|
-
},
|
|
16
8
|
chat: "group",
|
|
17
9
|
userAdminRequired: true,
|
|
18
10
|
|
|
@@ -23,10 +15,7 @@ module.exports = {
|
|
|
23
15
|
|
|
24
16
|
if (!keywordArg || !keywordArg.startsWith("#") || !noteText) {
|
|
25
17
|
return await sock.sendMessage(groupId, {
|
|
26
|
-
text:
|
|
27
|
-
"Wrong format. Use:\n`!save #keyword note text`",
|
|
28
|
-
"صيغة غير صحيحة. استخدم:\n`!save #keyword نص الملاحظة`",
|
|
29
|
-
),
|
|
18
|
+
text: t("bot.group.save.usageHint"),
|
|
30
19
|
});
|
|
31
20
|
}
|
|
32
21
|
|
|
@@ -36,15 +25,12 @@ module.exports = {
|
|
|
36
25
|
// Simply call the new storage function
|
|
37
26
|
saveNote(groupId, keyword, noteText);
|
|
38
27
|
await sock.sendMessage(groupId, {
|
|
39
|
-
text:
|
|
40
|
-
`✅ Note saved under the keyword \`#${keyword}\``,
|
|
41
|
-
`✅ تم حفظ الملاحظة بنجاح بالكلمة المفتاحية: \`#${keyword}\``,
|
|
42
|
-
),
|
|
28
|
+
text: t("bot.group.save.saved", { keyword }),
|
|
43
29
|
});
|
|
44
30
|
} catch (error) {
|
|
45
31
|
logger.error({ err: error, command: "save" }, "Error in !save command");
|
|
46
32
|
await sock.sendMessage(groupId, {
|
|
47
|
-
text:
|
|
33
|
+
text: t("bot.group.save.failed"),
|
|
48
34
|
});
|
|
49
35
|
}
|
|
50
36
|
},
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
// file: /commands/group/setname.js
|
|
2
2
|
const logger = require("../../utils/logger.cjs");
|
|
3
|
-
const {
|
|
3
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
name: "setname",
|
|
7
|
-
description: {
|
|
8
|
-
en: "Changes the group's name.",
|
|
9
|
-
ar: "يغيّر اسم المجموعة.",
|
|
10
|
-
},
|
|
11
|
-
usage: {
|
|
12
|
-
en: "setname <new name>",
|
|
13
|
-
ar: "setname <الاسم الجديد>",
|
|
14
|
-
},
|
|
15
7
|
chat: "group",
|
|
16
8
|
userAdminRequired: true,
|
|
17
9
|
botAdminRequired: true,
|
|
@@ -22,32 +14,26 @@ module.exports = {
|
|
|
22
14
|
|
|
23
15
|
if (!newName) {
|
|
24
16
|
return await sock.sendMessage(groupId, {
|
|
25
|
-
text:
|
|
17
|
+
text: t("bot.group.setname.noName"),
|
|
26
18
|
});
|
|
27
19
|
}
|
|
28
20
|
|
|
29
21
|
// WhatsApp has a limit of 25 characters for the subject
|
|
30
22
|
if (newName.length > 25) {
|
|
31
23
|
return await sock.sendMessage(groupId, {
|
|
32
|
-
text:
|
|
33
|
-
"⚠️ That name is too long. The limit is 25 characters.",
|
|
34
|
-
"⚠️ اسم المجموعة طويل جدًا. الحد الأقصى هو 25 حرفًا.",
|
|
35
|
-
),
|
|
24
|
+
text: t("bot.group.setname.tooLong"),
|
|
36
25
|
});
|
|
37
26
|
}
|
|
38
27
|
|
|
39
28
|
try {
|
|
40
29
|
await sock.groupUpdateSubject(groupId, newName);
|
|
41
30
|
await sock.sendMessage(groupId, {
|
|
42
|
-
text:
|
|
31
|
+
text: t("bot.group.setname.done", { name: newName }),
|
|
43
32
|
});
|
|
44
33
|
} catch (error) {
|
|
45
34
|
logger.error({ err: error }, "Error in !group setname command");
|
|
46
35
|
await sock.sendMessage(groupId, {
|
|
47
|
-
text:
|
|
48
|
-
"Something went wrong. Make sure I'm an admin and allowed to change the group's name.",
|
|
49
|
-
"حدث خطأ. تأكد من أنني مشرف ولدي صلاحية تغيير اسم المجموعة.",
|
|
50
|
-
),
|
|
36
|
+
text: t("bot.group.setname.failed"),
|
|
51
37
|
});
|
|
52
38
|
}
|
|
53
39
|
},
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
// file: /commands/group/setpp.js
|
|
2
2
|
const { downloadMediaMessage } = require("@whiskeysockets/baileys");
|
|
3
3
|
const logger = require("../../utils/logger.cjs");
|
|
4
|
-
const {
|
|
4
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
5
|
+
const { createStatus } = require("../../utils/statusMessage.cjs");
|
|
5
6
|
|
|
6
7
|
module.exports = {
|
|
7
8
|
name: "setpp", // pp = profile picture
|
|
8
|
-
description: {
|
|
9
|
-
en: "Changes the group's profile picture.",
|
|
10
|
-
ar: "يغيّر صورة المجموعة.",
|
|
11
|
-
},
|
|
12
|
-
usage: {
|
|
13
|
-
en: "setpp (reply to an image)",
|
|
14
|
-
ar: "setpp (رد على صورة)",
|
|
15
|
-
},
|
|
16
9
|
chat: "group",
|
|
17
10
|
userAdminRequired: true,
|
|
18
11
|
botAdminRequired: true,
|
|
@@ -24,18 +17,14 @@ module.exports = {
|
|
|
24
17
|
const quoted = msg.message?.extendedTextMessage?.contextInfo?.quotedMessage;
|
|
25
18
|
if (!quoted || !quoted.imageMessage) {
|
|
26
19
|
return await sock.sendMessage(groupId, {
|
|
27
|
-
text:
|
|
28
|
-
"To change the group's picture, reply to the image you want with this command.",
|
|
29
|
-
"لتغيير صورة المجموعة، يرجى الرد على الصورة التي تريدها بهذا الأمر.",
|
|
30
|
-
),
|
|
20
|
+
text: t("bot.group.setpp.notImage"),
|
|
31
21
|
});
|
|
32
22
|
}
|
|
33
23
|
|
|
24
|
+
const status = await createStatus(sock, groupId, t("bot.group.setpp.changing"), {
|
|
25
|
+
replyTo: msg,
|
|
26
|
+
});
|
|
34
27
|
try {
|
|
35
|
-
await sock.sendMessage(groupId, {
|
|
36
|
-
text: tr("🖼️ Changing the group's picture...", "🖼️ جارٍ تغيير صورة المجموعة..."),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
28
|
// Download the image from the quoted message
|
|
40
29
|
const imageBuffer = await downloadMediaMessage(
|
|
41
30
|
{
|
|
@@ -50,17 +39,10 @@ module.exports = {
|
|
|
50
39
|
// Update the group's profile picture using the downloaded image buffer
|
|
51
40
|
await sock.updateProfilePicture(groupId, imageBuffer);
|
|
52
41
|
|
|
53
|
-
await
|
|
54
|
-
text: tr("✅ The group's picture was updated.", "✅ تم تحديث صورة المجموعة بنجاح."),
|
|
55
|
-
});
|
|
42
|
+
await status.finish(t("bot.group.setpp.done"));
|
|
56
43
|
} catch (error) {
|
|
57
44
|
logger.error({ err: error }, "Error in !group setpp command");
|
|
58
|
-
await
|
|
59
|
-
text: tr(
|
|
60
|
-
"Something went wrong. Make sure I'm an admin and the image is valid.",
|
|
61
|
-
"حدث خطأ. تأكد من أنني مشرف وأن الصورة صالحة.",
|
|
62
|
-
),
|
|
63
|
-
});
|
|
45
|
+
await status.finish(t("bot.group.setpp.failed"), { category: "error" });
|
|
64
46
|
}
|
|
65
47
|
},
|
|
66
48
|
};
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
const { getGroupSettings, saveGroupSettings } = require("../../utils/storage.cjs");
|
|
2
2
|
const logger = require("../../utils/logger.cjs");
|
|
3
|
-
const {
|
|
3
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
name: "setrules",
|
|
7
|
-
description: {
|
|
8
|
-
en: "Sets the rules for this group.",
|
|
9
|
-
ar: "يضبط قواعد هذه المجموعة.",
|
|
10
|
-
},
|
|
11
|
-
usage: {
|
|
12
|
-
en: "setrules <rules>",
|
|
13
|
-
ar: "setrules <القواعد>",
|
|
14
|
-
},
|
|
15
7
|
chat: "group",
|
|
16
8
|
userAdminRequired: true,
|
|
17
9
|
|
|
@@ -21,10 +13,7 @@ module.exports = {
|
|
|
21
13
|
|
|
22
14
|
if (!rulesText) {
|
|
23
15
|
return await sock.sendMessage(groupId, {
|
|
24
|
-
text:
|
|
25
|
-
"Write the rules after the command.\n*Example:*\n`!setrules 1. Respect the members.\n2. No spam.`",
|
|
26
|
-
"يرجى كتابة القواعد بعد الأمر.\n*مثال:*\n`!setrules 1. احترام الأعضاء.\n2. ممنوع السبام.`",
|
|
27
|
-
),
|
|
16
|
+
text: t("bot.group.setrules.usageHint"),
|
|
28
17
|
});
|
|
29
18
|
}
|
|
30
19
|
|
|
@@ -39,13 +28,13 @@ module.exports = {
|
|
|
39
28
|
saveGroupSettings(groupId, settings);
|
|
40
29
|
|
|
41
30
|
await sock.sendMessage(groupId, {
|
|
42
|
-
text:
|
|
31
|
+
text: t("bot.group.setrules.saved"),
|
|
43
32
|
});
|
|
44
33
|
} catch (error) {
|
|
45
34
|
// Improved logging for better debugging
|
|
46
35
|
logger.error({ err: error, groupId: groupId }, "Error in !setrules command");
|
|
47
36
|
await sock.sendMessage(groupId, {
|
|
48
|
-
text:
|
|
37
|
+
text: t("bot.group.setrules.failed"),
|
|
49
38
|
});
|
|
50
39
|
}
|
|
51
40
|
},
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
// file: /commands/group/setwarn.js
|
|
2
2
|
const { normalizeWarnAction } = require("../../utils/moderationSummary.cjs");
|
|
3
|
-
const {
|
|
3
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
4
4
|
const { applyModerationPolicy } = require("../../services/moderationPolicy.cjs");
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
name: "setwarn",
|
|
8
|
-
description: {
|
|
9
|
-
en: "Configures the automatic warning system.",
|
|
10
|
-
ar: "يضبط نظام التحذيرات التلقائي.",
|
|
11
|
-
},
|
|
12
|
-
usage: {
|
|
13
|
-
en: "setwarn max <count>\nsetwarn action <KICK|FLAG>",
|
|
14
|
-
ar: "setwarn max <عدد>\nsetwarn action <KICK|FLAG>",
|
|
15
|
-
},
|
|
16
8
|
chat: "group",
|
|
17
9
|
userAdminRequired: true,
|
|
18
10
|
|
|
@@ -26,15 +18,12 @@ module.exports = {
|
|
|
26
18
|
const max = parseInt(value, 10);
|
|
27
19
|
if (!Number.isInteger(max) || max < 1 || max > 50) {
|
|
28
20
|
return await sock.sendMessage(groupId, {
|
|
29
|
-
text:
|
|
30
|
-
"Give a whole number from 1 to 50 for the warning limit.",
|
|
31
|
-
"يرجى تحديد عدد صحيح من 1 إلى 50 للحد الأقصى للتحذيرات.",
|
|
32
|
-
),
|
|
21
|
+
text: t("bot.moderation.setwarn.giveAWholeNumberFrom"),
|
|
33
22
|
});
|
|
34
23
|
}
|
|
35
24
|
applyModerationPolicy(groupId, { limit: max });
|
|
36
25
|
return await sock.sendMessage(groupId, {
|
|
37
|
-
text:
|
|
26
|
+
text: t("bot.moderation.setwarn.theWarningLimitIsNow", { max }),
|
|
38
27
|
});
|
|
39
28
|
}
|
|
40
29
|
|
|
@@ -42,24 +31,18 @@ module.exports = {
|
|
|
42
31
|
const action = normalizeWarnAction(value);
|
|
43
32
|
if (!action) {
|
|
44
33
|
return await sock.sendMessage(groupId, {
|
|
45
|
-
text:
|
|
46
|
-
"Invalid action. Available: `KICK`, `FLAG`",
|
|
47
|
-
"الإجراء غير صالح. الإجراءات المتاحة: `KICK`, `FLAG`",
|
|
48
|
-
),
|
|
34
|
+
text: t("bot.moderation.setwarn.invalidActionAvailableKickFlag"),
|
|
49
35
|
});
|
|
50
36
|
}
|
|
51
37
|
applyModerationPolicy(groupId, { limitAction: action });
|
|
52
38
|
return await sock.sendMessage(groupId, {
|
|
53
|
-
text:
|
|
39
|
+
text: t("bot.moderation.setwarn.theAutomaticActionIsNow", { action }),
|
|
54
40
|
});
|
|
55
41
|
}
|
|
56
42
|
|
|
57
43
|
default:
|
|
58
44
|
return await sock.sendMessage(groupId, {
|
|
59
|
-
text:
|
|
60
|
-
"Wrong format. Use:\n`!setwarn max <number>`\n`!setwarn action <KICK|FLAG>`",
|
|
61
|
-
"صيغة غير صحيحة. استخدم:\n`!setwarn max <number>`\n`!setwarn action <KICK|FLAG>`",
|
|
62
|
-
),
|
|
45
|
+
text: t("bot.moderation.setwarn.wrongFormatUseSetwarnMax"),
|
|
63
46
|
});
|
|
64
47
|
}
|
|
65
48
|
},
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
// file: /commands/tagadmins.js
|
|
2
2
|
const logger = require("../../utils/logger.cjs");
|
|
3
|
-
const {
|
|
3
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
name: "tagadmins",
|
|
7
|
-
description: {
|
|
8
|
-
en: "Mentions every admin in the group.",
|
|
9
|
-
ar: "يذكر (منشن) جميع مشرفي المجموعة.",
|
|
10
|
-
},
|
|
11
|
-
usage: {
|
|
12
|
-
en: "tagadmins [message]",
|
|
13
|
-
ar: "tagadmins [رسالة]",
|
|
14
|
-
},
|
|
15
7
|
chat: "group",
|
|
16
8
|
|
|
17
9
|
async execute(sock, msg, args, body, groupMetadata) {
|
|
@@ -25,20 +17,17 @@ module.exports = {
|
|
|
25
17
|
|
|
26
18
|
if (admins.length === 0) {
|
|
27
19
|
return await sock.sendMessage(groupId, {
|
|
28
|
-
text:
|
|
20
|
+
text: t("bot.group.tagadmins.noAdmins"),
|
|
29
21
|
});
|
|
30
22
|
}
|
|
31
23
|
|
|
32
24
|
// Get the custom message provided by the user, or use a default one
|
|
33
|
-
const customMessage = args.join(" ") ||
|
|
25
|
+
const customMessage = args.join(" ") || t("bot.group.tagadmins.defaultMessage");
|
|
34
26
|
|
|
35
27
|
// Get an array of JIDs for the mentions property
|
|
36
28
|
const mentions = admins.map((a) => a.id);
|
|
37
29
|
|
|
38
|
-
let text =
|
|
39
|
-
`*🚨 Calling the admins 🚨*\n\n*Message:* ${customMessage}\n\n`,
|
|
40
|
-
`*🚨 تنبيه للمشرفين 🚨*\n\n*الرسالة:* ${customMessage}\n\n`,
|
|
41
|
-
);
|
|
30
|
+
let text = t("bot.group.tagadmins.header", { message: customMessage });
|
|
42
31
|
|
|
43
32
|
// Add a tag for each admin
|
|
44
33
|
for (const admin of admins) {
|
|
@@ -51,7 +40,7 @@ module.exports = {
|
|
|
51
40
|
});
|
|
52
41
|
} catch (error) {
|
|
53
42
|
logger.error({ err: error, command: "tagadmins" }, "Error in !tagadmins command");
|
|
54
|
-
await sock.sendMessage(groupId, { text:
|
|
43
|
+
await sock.sendMessage(groupId, { text: t("bot.group.tagadmins.failed") });
|
|
55
44
|
}
|
|
56
45
|
},
|
|
57
46
|
};
|
|
@@ -6,18 +6,10 @@ const {
|
|
|
6
6
|
sameUserSync,
|
|
7
7
|
} = require("../../utils/permissions.cjs");
|
|
8
8
|
const { enforceGroupRule, senderCandidates } = require("../../utils/moderationAction.cjs");
|
|
9
|
-
const {
|
|
9
|
+
const { t } = require("../../utils/i18n.cjs");
|
|
10
10
|
|
|
11
11
|
module.exports = {
|
|
12
12
|
name: "warn",
|
|
13
|
-
description: {
|
|
14
|
-
en: "Warns a member, and takes action once the limit is reached.",
|
|
15
|
-
ar: "يوجّه تحذيرًا لعضو، ويتخذ إجراءً عند بلوغ الحد.",
|
|
16
|
-
},
|
|
17
|
-
usage: {
|
|
18
|
-
en: "warn @member [reason]",
|
|
19
|
-
ar: "warn @عضو [السبب]",
|
|
20
|
-
},
|
|
21
13
|
chat: "group",
|
|
22
14
|
userAdminRequired: true,
|
|
23
15
|
|
|
@@ -30,12 +22,12 @@ module.exports = {
|
|
|
30
22
|
// --- 1. Validate Inputs ---
|
|
31
23
|
if (!mentionedJid) {
|
|
32
24
|
return await sock.sendMessage(groupId, {
|
|
33
|
-
text:
|
|
25
|
+
text: t("bot.moderation.warn.mentionTheMemberYouWant"),
|
|
34
26
|
});
|
|
35
27
|
}
|
|
36
28
|
if (!reason) {
|
|
37
29
|
return await sock.sendMessage(groupId, {
|
|
38
|
-
text:
|
|
30
|
+
text: t("bot.moderation.warn.writeAReasonForThe"),
|
|
39
31
|
});
|
|
40
32
|
}
|
|
41
33
|
const isBot = [sock.user?.id, sock.user?.lid]
|
|
@@ -47,10 +39,7 @@ module.exports = {
|
|
|
47
39
|
isAdminInGroupSync(groupMetadata, mentionedJid)
|
|
48
40
|
) {
|
|
49
41
|
return await sock.sendMessage(groupId, {
|
|
50
|
-
text:
|
|
51
|
-
"The bot, its owner and admins can't be warned or kicked this way.",
|
|
52
|
-
"لا يمكن تحذير أو طرد البوت أو مالكه أو أحد المشرفين بهذه الطريقة.",
|
|
53
|
-
),
|
|
42
|
+
text: t("bot.moderation.warn.theBotItsOwnerAnd"),
|
|
54
43
|
});
|
|
55
44
|
}
|
|
56
45
|
|
|
@@ -70,7 +59,7 @@ module.exports = {
|
|
|
70
59
|
} catch (error) {
|
|
71
60
|
logger.error({ err: error }, "An error occurred in the !warn command.");
|
|
72
61
|
await sock.sendMessage(msg.key.remoteJid, {
|
|
73
|
-
text:
|
|
62
|
+
text: t("bot.moderation.warn.somethingWentWrongWithThe"),
|
|
74
63
|
});
|
|
75
64
|
}
|
|
76
65
|
},
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
// file: /commands/warns.js
|
|
2
2
|
const { getUserWarnings } = require("../../utils/storage.cjs");
|
|
3
3
|
const logger = require("../../utils/logger.cjs");
|
|
4
|
-
const {
|
|
4
|
+
const { t, intlTag } = require("../../utils/i18n.cjs");
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
name: "warns",
|
|
8
|
-
description: {
|
|
9
|
-
en: "Shows a member's warnings.",
|
|
10
|
-
ar: "يعرض تحذيرات عضو معيّن.",
|
|
11
|
-
},
|
|
12
|
-
usage: {
|
|
13
|
-
en: "warns @member",
|
|
14
|
-
ar: "warns @عضو",
|
|
15
|
-
},
|
|
16
8
|
chat: "group",
|
|
17
9
|
userAdminRequired: true,
|
|
18
10
|
|
|
@@ -23,10 +15,7 @@ module.exports = {
|
|
|
23
15
|
|
|
24
16
|
if (!mentionedJid) {
|
|
25
17
|
return await sock.sendMessage(groupId, {
|
|
26
|
-
text:
|
|
27
|
-
"Mention the member whose warnings you want to see.",
|
|
28
|
-
"يجب عمل منشن للعضو الذي تريد عرض تحذيراته.",
|
|
29
|
-
),
|
|
18
|
+
text: t("bot.moderation.warns.mentionTheMemberWhoseWarnings"),
|
|
30
19
|
});
|
|
31
20
|
}
|
|
32
21
|
|
|
@@ -35,38 +24,28 @@ module.exports = {
|
|
|
35
24
|
|
|
36
25
|
if (userWarnings.length === 0) {
|
|
37
26
|
return await sock.sendMessage(groupId, {
|
|
38
|
-
text:
|
|
39
|
-
`✅ @${mentionedJid.split("@")[0]} has no warnings.`,
|
|
40
|
-
`✅ لا توجد أي تحذيرات للعضو @${mentionedJid.split("@")[0]}.`,
|
|
41
|
-
),
|
|
27
|
+
text: t("bot.moderation.warns.hasNoWarnings", { member: mentionedJid.split("@")[0] }),
|
|
42
28
|
mentions: [mentionedJid],
|
|
43
29
|
});
|
|
44
30
|
}
|
|
45
31
|
|
|
46
32
|
const who = mentionedJid.split("@")[0];
|
|
47
|
-
let reply =
|
|
48
|
-
`*Warnings for @${who}:*\n*Total: ${userWarnings.length}*\n\n`,
|
|
49
|
-
`*سجل تحذيرات @${who}:*\n*إجمالي التحذيرات: ${userWarnings.length}*\n\n`,
|
|
50
|
-
);
|
|
33
|
+
let reply = t("bot.moderation.warns.warningsForTotal", { member: who, count: userWarnings.length });
|
|
51
34
|
|
|
52
35
|
const mentionedAdmins = [];
|
|
53
36
|
userWarnings.forEach((warning, index) => {
|
|
54
37
|
const adminJid = warning.by;
|
|
55
38
|
mentionedAdmins.push(adminJid);
|
|
56
|
-
const warningDate = new Date(warning.date).toLocaleString(
|
|
39
|
+
const warningDate = new Date(warning.date).toLocaleString(intlTag(), {
|
|
57
40
|
timeZone: "Africa/Cairo",
|
|
58
41
|
});
|
|
59
42
|
|
|
60
|
-
reply +=
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
`*السبب:* ${warning.reason}\n` +
|
|
67
|
-
`*بواسطة المشرف:* @${adminJid.split("@")[0]}\n` +
|
|
68
|
-
`*التاريخ:* ${warningDate}\n\n`,
|
|
69
|
-
);
|
|
43
|
+
reply += t("bot.moderation.warns.warningReasonByDate", {
|
|
44
|
+
number: index + 1,
|
|
45
|
+
reason: warning.reason,
|
|
46
|
+
admin: adminJid.split("@")[0],
|
|
47
|
+
warningDate,
|
|
48
|
+
});
|
|
70
49
|
});
|
|
71
50
|
|
|
72
51
|
const mentions = [mentionedJid, ...mentionedAdmins];
|
|
@@ -78,7 +57,7 @@ module.exports = {
|
|
|
78
57
|
} catch (error) {
|
|
79
58
|
logger.error({ err: error }, "Error in !warns command");
|
|
80
59
|
await sock.sendMessage(msg.key.remoteJid, {
|
|
81
|
-
text:
|
|
60
|
+
text: t("bot.moderation.warns.somethingWentWrongWhileListing"),
|
|
82
61
|
});
|
|
83
62
|
}
|
|
84
63
|
},
|