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
package/src/commands/mod.cjs
CHANGED
|
@@ -10,9 +10,17 @@ const {
|
|
|
10
10
|
normalizeFeatureAction,
|
|
11
11
|
policyFromFeatureAction,
|
|
12
12
|
} = require("../utils/moderationSummary.cjs");
|
|
13
|
-
const {
|
|
13
|
+
const { t, currentLang } = require("../utils/i18n.cjs");
|
|
14
14
|
const { applyModerationPolicy } = require("../services/moderationPolicy.cjs");
|
|
15
15
|
|
|
16
|
+
// The validator's detail is English only. Other languages get a generic line.
|
|
17
|
+
// A catalog value of "{detail}" is rejected: placeholder sets must match.
|
|
18
|
+
function actionNotAllowed(error) {
|
|
19
|
+
const generic = t("bot.moderation.actionNotAllowed");
|
|
20
|
+
const detail = error.errors?.[0]?.message;
|
|
21
|
+
return currentLang() === "en" ? detail || generic : generic;
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
// الهيكل الافتراضي لإعدادات المراقبة
|
|
17
25
|
const defaultModSettings = {
|
|
18
26
|
antiLink: { enabled: false },
|
|
@@ -57,30 +65,26 @@ function setFeatureEnabled(settings, key, enabled) {
|
|
|
57
65
|
module.exports = {
|
|
58
66
|
name: "mod",
|
|
59
67
|
aliases: ["moderation", "settings"],
|
|
60
|
-
description: {
|
|
61
|
-
en: "Controls the group's moderation settings.",
|
|
62
|
-
ar: "يتحكم في إعدادات الإشراف على المجموعة.",
|
|
63
|
-
},
|
|
64
|
-
usage: {
|
|
65
|
-
en: "mod status\nmod <enable|disable> <antiLink|antiSpam|forbiddenWords>\nmod action <antiLink|forbiddenWords> <DELETE|WARN|KICK>\nmod action antiSpam <WARN|KICK>\nmod words <add|remove> <word>\nmod words list",
|
|
66
|
-
ar: "mod status\nmod <enable|disable> <antiLink|antiSpam|forbiddenWords>\nmod action <antiLink|forbiddenWords> <DELETE|WARN|KICK>\nmod action antiSpam <WARN|KICK>\nmod words <add|remove> <الكلمة>\nmod words list",
|
|
67
|
-
},
|
|
68
68
|
chat: "group", // يعمل في الجروبات فقط
|
|
69
69
|
botAdminRequired: false, // لا يتطلب أن يكون البوت مشرفًا لتغيير الإعدادات
|
|
70
70
|
|
|
71
|
-
async execute(sock, msg, args) {
|
|
71
|
+
async execute(sock, msg, args, _body, _handed, ctx) {
|
|
72
72
|
const groupId = msg.key.remoteJid;
|
|
73
73
|
const senderIds = senderCandidates(msg, sock);
|
|
74
74
|
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
|
|
75
|
+
// The dispatcher already read a fresh roster. A direct call reads with
|
|
76
|
+
// `{ fresh: true }` so a stale admin flag cannot open this command.
|
|
77
|
+
// Owners still pass below. Forbidden-word protection keeps last-known data.
|
|
78
|
+
const groupMetadata =
|
|
79
|
+
ctx && Object.prototype.hasOwnProperty.call(ctx, "authGroupMetadata")
|
|
80
|
+
? ctx.authGroupMetadata
|
|
81
|
+
: await resolveGroupMetadata(sock, groupId, { fresh: true });
|
|
78
82
|
const senderIsAdmin = senderIds.some((id) => isAdminInGroupSync(groupMetadata, id));
|
|
79
83
|
const isOwner = msg.key.fromMe || senderIds.some(isOwnerJidSync);
|
|
80
84
|
if (!senderIsAdmin && !isOwner) {
|
|
81
85
|
return sock.sendMessage(
|
|
82
86
|
groupId,
|
|
83
|
-
{ text:
|
|
87
|
+
{ text: t("bot.moderation.mod.thisCommandIsForAdmins") },
|
|
84
88
|
{ quoted: msg },
|
|
85
89
|
);
|
|
86
90
|
}
|
|
@@ -98,10 +102,7 @@ module.exports = {
|
|
|
98
102
|
return sock.sendMessage(
|
|
99
103
|
groupId,
|
|
100
104
|
{
|
|
101
|
-
text:
|
|
102
|
-
`⚠️ There is no feature called "${args[1] || ""}".`,
|
|
103
|
-
`⚠️ الميزة "${args[1] || ""}" غير موجودة.`,
|
|
104
|
-
),
|
|
105
|
+
text: t("bot.moderation.mod.thereIsNoFeatureCalled", { featureName: args[1] || "" }),
|
|
105
106
|
},
|
|
106
107
|
{ quoted: msg },
|
|
107
108
|
);
|
|
@@ -110,7 +111,7 @@ module.exports = {
|
|
|
110
111
|
saveGroupSettings(groupId, settings);
|
|
111
112
|
await sock.sendMessage(
|
|
112
113
|
groupId,
|
|
113
|
-
{ text:
|
|
114
|
+
{ text: t("bot.moderation.mod.isOn", { feature }) },
|
|
114
115
|
{ quoted: msg },
|
|
115
116
|
);
|
|
116
117
|
break;
|
|
@@ -120,10 +121,7 @@ module.exports = {
|
|
|
120
121
|
return sock.sendMessage(
|
|
121
122
|
groupId,
|
|
122
123
|
{
|
|
123
|
-
text:
|
|
124
|
-
`⚠️ There is no feature called "${args[1] || ""}".`,
|
|
125
|
-
`⚠️ الميزة "${args[1] || ""}" غير موجودة.`,
|
|
126
|
-
),
|
|
124
|
+
text: t("bot.moderation.mod.thereIsNoFeatureCalled", { featureName: args[1] || "" }),
|
|
127
125
|
},
|
|
128
126
|
{ quoted: msg },
|
|
129
127
|
);
|
|
@@ -132,7 +130,7 @@ module.exports = {
|
|
|
132
130
|
saveGroupSettings(groupId, settings);
|
|
133
131
|
await sock.sendMessage(
|
|
134
132
|
groupId,
|
|
135
|
-
{ text:
|
|
133
|
+
{ text: t("bot.moderation.mod.isOff", { feature }) },
|
|
136
134
|
{ quoted: msg },
|
|
137
135
|
);
|
|
138
136
|
break;
|
|
@@ -142,10 +140,7 @@ module.exports = {
|
|
|
142
140
|
return sock.sendMessage(
|
|
143
141
|
groupId,
|
|
144
142
|
{
|
|
145
|
-
text:
|
|
146
|
-
`⚠️ There is no feature called "${args[1] || ""}".`,
|
|
147
|
-
`⚠️ الميزة "${args[1] || ""}" غير موجودة.`,
|
|
148
|
-
),
|
|
143
|
+
text: t("bot.moderation.mod.thereIsNoFeatureCalled", { featureName: args[1] || "" }),
|
|
149
144
|
},
|
|
150
145
|
{ quoted: msg },
|
|
151
146
|
);
|
|
@@ -156,14 +151,9 @@ module.exports = {
|
|
|
156
151
|
return sock.sendMessage(
|
|
157
152
|
groupId,
|
|
158
153
|
{
|
|
159
|
-
text:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
: "Invalid action. Available: `WARN`, `KICK`",
|
|
163
|
-
allowDelete
|
|
164
|
-
? "الإجراء غير صالح. الإجراءات المتاحة: `DELETE`, `WARN`, `KICK`"
|
|
165
|
-
: "الإجراء غير صالح. الإجراءات المتاحة: `WARN`, `KICK`",
|
|
166
|
-
),
|
|
154
|
+
text: allowDelete
|
|
155
|
+
? t("bot.moderation.mod.invalidActionWithDelete")
|
|
156
|
+
: t("bot.moderation.mod.invalidActionWithoutDelete"),
|
|
167
157
|
},
|
|
168
158
|
{ quoted: msg },
|
|
169
159
|
);
|
|
@@ -176,24 +166,21 @@ module.exports = {
|
|
|
176
166
|
return sock.sendMessage(
|
|
177
167
|
groupId,
|
|
178
168
|
{
|
|
179
|
-
text:
|
|
180
|
-
error.errors?.[0]?.message || "That action is not allowed.",
|
|
181
|
-
"هذا الإجراء غير مسموح.",
|
|
182
|
-
),
|
|
169
|
+
text: actionNotAllowed(error),
|
|
183
170
|
},
|
|
184
171
|
{ quoted: msg },
|
|
185
172
|
);
|
|
186
173
|
}
|
|
187
174
|
await sock.sendMessage(
|
|
188
175
|
groupId,
|
|
189
|
-
{ text:
|
|
176
|
+
{ text: t("bot.moderation.mod.actionIsNow", { feature, action }) },
|
|
190
177
|
{ quoted: msg },
|
|
191
178
|
);
|
|
192
179
|
break;
|
|
193
180
|
}
|
|
194
181
|
|
|
195
182
|
case "status": {
|
|
196
|
-
let statusText =
|
|
183
|
+
let statusText = t("bot.moderation.mod.moderationSettings");
|
|
197
184
|
const actionOf = {
|
|
198
185
|
antiLink: featureActionOf(settings, "antilink"),
|
|
199
186
|
antiSpam: featureActionOf(settings, "antispam"),
|
|
@@ -201,14 +188,11 @@ module.exports = {
|
|
|
201
188
|
};
|
|
202
189
|
for (const key of Object.values(FEATURE_KEYS)) {
|
|
203
190
|
const status = featureEnabled(settings, key)
|
|
204
|
-
?
|
|
205
|
-
:
|
|
191
|
+
? t("bot.moderation.mod.on")
|
|
192
|
+
: t("bot.moderation.mod.off");
|
|
206
193
|
statusText += `› *${key}*: ${status} · ${actionOf[key]}\n`;
|
|
207
194
|
}
|
|
208
|
-
statusText +=
|
|
209
|
-
`\n- To see the forbidden words, type: \`!mod words list\``,
|
|
210
|
-
`\n- لعرض قائمة الكلمات الممنوعة، اكتب: \`!mod words list\``,
|
|
211
|
-
);
|
|
195
|
+
statusText += t("bot.moderation.mod.toSeeTheForbiddenWords");
|
|
212
196
|
await sock.sendMessage(groupId, { text: statusText }, { quoted: msg });
|
|
213
197
|
break;
|
|
214
198
|
}
|
|
@@ -220,34 +204,31 @@ module.exports = {
|
|
|
220
204
|
if (wordAction === "add") {
|
|
221
205
|
if (!word)
|
|
222
206
|
return sock.sendMessage(groupId, {
|
|
223
|
-
text:
|
|
207
|
+
text: t("bot.moderation.mod.wordToAddRequired"),
|
|
224
208
|
});
|
|
225
209
|
if (!modSettings.forbiddenWords.list.includes(word)) {
|
|
226
210
|
modSettings.forbiddenWords.list.push(word.slice(0, 100));
|
|
227
211
|
}
|
|
228
212
|
saveGroupSettings(groupId, settings);
|
|
229
213
|
await sock.sendMessage(groupId, {
|
|
230
|
-
text:
|
|
231
|
-
`✅ Added "${word}" to the forbidden words.`,
|
|
232
|
-
`✅ تم إضافة "${word}" إلى قائمة الكلمات الممنوعة.`,
|
|
233
|
-
),
|
|
214
|
+
text: t("bot.moderation.mod.addedToTheForbiddenWords", { word }),
|
|
234
215
|
});
|
|
235
216
|
} else if (wordAction === "remove") {
|
|
236
217
|
if (!word)
|
|
237
218
|
return sock.sendMessage(groupId, {
|
|
238
|
-
text:
|
|
219
|
+
text: t("bot.moderation.mod.wordToRemoveRequired"),
|
|
239
220
|
});
|
|
240
221
|
modSettings.forbiddenWords.list = modSettings.forbiddenWords.list.filter(
|
|
241
222
|
(w) => w !== word,
|
|
242
223
|
);
|
|
243
224
|
saveGroupSettings(groupId, settings);
|
|
244
225
|
await sock.sendMessage(groupId, {
|
|
245
|
-
text:
|
|
226
|
+
text: t("bot.moderation.mod.removedFromTheList", { word }),
|
|
246
227
|
});
|
|
247
228
|
} else if (wordAction === "list") {
|
|
248
|
-
let listText =
|
|
229
|
+
let listText = t("bot.moderation.mod.forbiddenWords");
|
|
249
230
|
if (modSettings.forbiddenWords.list.length === 0) {
|
|
250
|
-
listText +=
|
|
231
|
+
listText += t("bot.moderation.mod.theListIsEmpty");
|
|
251
232
|
} else {
|
|
252
233
|
modSettings.forbiddenWords.list.forEach((w, i) => {
|
|
253
234
|
listText += `${i + 1}. ${w}\n`;
|
|
@@ -256,34 +237,14 @@ module.exports = {
|
|
|
256
237
|
await sock.sendMessage(groupId, { text: listText });
|
|
257
238
|
} else {
|
|
258
239
|
await sock.sendMessage(groupId, {
|
|
259
|
-
text:
|
|
260
|
-
"Wrong usage. Available: `add`, `remove`, `list`",
|
|
261
|
-
"استخدام خاطئ. الأوامر المتاحة: `add`, `remove`, `list`",
|
|
262
|
-
),
|
|
240
|
+
text: t("bot.moderation.mod.wrongUsageAvailableAddRemove"),
|
|
263
241
|
});
|
|
264
242
|
}
|
|
265
243
|
break;
|
|
266
244
|
}
|
|
267
245
|
|
|
268
246
|
default: {
|
|
269
|
-
const helpText =
|
|
270
|
-
"🤖 *Moderation commands*\n\n" +
|
|
271
|
-
"• `!mod enable <feature>`\nTurn a feature on (antilink, antispam, forbiddenwords)\n\n" +
|
|
272
|
-
"• `!mod disable <feature>`\nTurn a feature off.\n\n" +
|
|
273
|
-
"• `!mod action <feature> <DELETE|WARN|KICK>`\nSet the feature action (antiSpam: WARN|KICK).\n\n" +
|
|
274
|
-
"• `!mod status`\nShow which features are on.\n\n" +
|
|
275
|
-
"• `!mod words add <word>`\nAdd a forbidden word.\n\n" +
|
|
276
|
-
"• `!mod words remove <word>`\nRemove a forbidden word.\n\n" +
|
|
277
|
-
"• `!mod words list`\nList the forbidden words.",
|
|
278
|
-
"🤖 *أوامر التحكم في المراقبة*\n\n" +
|
|
279
|
-
"• `!mod enable <feature>`\nلتفعيل ميزة (antilink, antispam, forbiddenwords)\n\n" +
|
|
280
|
-
"• `!mod disable <feature>`\nلتعطيل ميزة.\n\n" +
|
|
281
|
-
"• `!mod action <feature> <DELETE|WARN|KICK>`\nتعيين إجراء الميزة (antiSpam: WARN|KICK).\n\n" +
|
|
282
|
-
"• `!mod status`\nلعرض حالة الميزات الحالية.\n\n" +
|
|
283
|
-
"• `!mod words add <word>`\nلإضافة كلمة ممنوعة.\n\n" +
|
|
284
|
-
"• `!mod words remove <word>`\nلإزالة كلمة ممنوعة.\n\n" +
|
|
285
|
-
"• `!mod words list`\nلعرض قائمة الكلمات الممنوعة.",
|
|
286
|
-
);
|
|
247
|
+
const helpText = t("bot.moderation.mod.help");
|
|
287
248
|
await sock.sendMessage(groupId, { text: helpText }, { quoted: msg });
|
|
288
249
|
break;
|
|
289
250
|
}
|
package/src/commands/notes.cjs
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
// file: /commands/notes.js
|
|
2
2
|
const { getAllNotes } = require("../utils/storage.cjs");
|
|
3
|
-
const {
|
|
3
|
+
const { t } = require("../utils/i18n.cjs");
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
name: "notes",
|
|
7
|
-
description: {
|
|
8
|
-
en: "Lists all saved note keywords for the group.",
|
|
9
|
-
ar: "يعرض الكلمات المفتاحية لكل الملاحظات المحفوظة في المجموعة.",
|
|
10
|
-
},
|
|
11
|
-
usage: {
|
|
12
|
-
en: "notes",
|
|
13
|
-
ar: "notes",
|
|
14
|
-
},
|
|
15
7
|
chat: "all",
|
|
16
8
|
|
|
17
9
|
async execute(sock, msg) {
|
|
@@ -22,16 +14,13 @@ module.exports = {
|
|
|
22
14
|
|
|
23
15
|
if (keywords.length === 0) {
|
|
24
16
|
return await sock.sendMessage(groupId, {
|
|
25
|
-
text:
|
|
17
|
+
text: t("bot.core.notes.empty"),
|
|
26
18
|
});
|
|
27
19
|
}
|
|
28
20
|
|
|
29
|
-
let reply =
|
|
21
|
+
let reply = t("bot.core.notes.heading");
|
|
30
22
|
reply += keywords.map((kw) => `\`#${kw}\``).join("\n");
|
|
31
|
-
reply +=
|
|
32
|
-
"\n\nTo get a note, use: `!note #keyword`",
|
|
33
|
-
"\n\nللحصول على ملاحظة، استخدم: `!note #keyword`",
|
|
34
|
-
);
|
|
23
|
+
reply += t("bot.core.notes.footer");
|
|
35
24
|
|
|
36
25
|
await sock.sendMessage(groupId, { text: reply });
|
|
37
26
|
},
|
package/src/commands/pack.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { t } = require("../utils/i18n.cjs");
|
|
2
2
|
const { isolate } = require("../utils/bidi.cjs");
|
|
3
3
|
const { createStatus } = require("../utils/statusMessage.cjs");
|
|
4
4
|
const {
|
|
@@ -46,14 +46,6 @@ function requirePack(who, name) {
|
|
|
46
46
|
module.exports = {
|
|
47
47
|
name: "pack",
|
|
48
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
49
|
keywords,
|
|
58
50
|
chat: "all",
|
|
59
51
|
async execute(sock, msg, args = []) {
|
|
@@ -61,7 +53,7 @@ module.exports = {
|
|
|
61
53
|
const who = await ownerModule.forMessage(msg, sock);
|
|
62
54
|
if (!who.key)
|
|
63
55
|
return sock.sendMessage(jid, {
|
|
64
|
-
text:
|
|
56
|
+
text: t("bot.stickers.pack.senderUnknown"),
|
|
65
57
|
});
|
|
66
58
|
const parsed = parse(args);
|
|
67
59
|
let status;
|
|
@@ -78,33 +70,26 @@ module.exports = {
|
|
|
78
70
|
}
|
|
79
71
|
}
|
|
80
72
|
if (!oldName || !newName) {
|
|
81
|
-
line =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
);
|
|
73
|
+
line = t("bot.stickers.pack.renameUsage", {
|
|
74
|
+
hint: commandHint("pack", t("bot.stickers.hint.rename")),
|
|
75
|
+
});
|
|
85
76
|
} else {
|
|
86
77
|
const pack = requirePack(who, oldName);
|
|
87
78
|
const renamed = library.updatePack(who, pack.id, newName);
|
|
88
|
-
line =
|
|
89
|
-
`Renamed pack to ${isolate(renamed.name)}.`,
|
|
90
|
-
`أُعيدت تسمية الحزمة إلى ${isolate(renamed.name)}.`,
|
|
91
|
-
);
|
|
79
|
+
line = t("bot.stickers.pack.renamed", { name: isolate(renamed.name) });
|
|
92
80
|
}
|
|
93
81
|
} else if (!parsed.name) {
|
|
94
|
-
line =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
);
|
|
82
|
+
line = t("bot.stickers.pack.needName", {
|
|
83
|
+
add: commandHint("pack", t("bot.stickers.hint.name")),
|
|
84
|
+
create: commandHint("pack", t("bot.stickers.hint.create")),
|
|
85
|
+
});
|
|
98
86
|
} else if (parsed.action === "create") {
|
|
99
87
|
const pack = library.createPack(who, parsed.name);
|
|
100
|
-
line =
|
|
88
|
+
line = t("bot.stickers.pack.created", { name: isolate(pack.name) });
|
|
101
89
|
} else if (parsed.action === "delete") {
|
|
102
90
|
const pack = requirePack(who, parsed.name);
|
|
103
91
|
library.deletePack(who, pack.id);
|
|
104
|
-
line =
|
|
105
|
-
`Deleted pack ${isolate(pack.name)}. Its stickers remain in your library.`,
|
|
106
|
-
`حُذفت الحزمة ${isolate(pack.name)}. بقيت ملصقاتها في مكتبتك.`,
|
|
107
|
-
);
|
|
92
|
+
line = t("bot.stickers.pack.deleted", { name: isolate(pack.name) });
|
|
108
93
|
} else if (parsed.action === "remove") {
|
|
109
94
|
const pack = requirePack(who, parsed.name);
|
|
110
95
|
const target = targetOf(msg, { quotedOnly: true });
|
|
@@ -113,18 +98,19 @@ module.exports = {
|
|
|
113
98
|
const sticker = library.findStickerByContent(who, buffer);
|
|
114
99
|
const removed = library.removeFromPack(who, pack.id, [sticker.id]);
|
|
115
100
|
if (!removed.affected) throw new StickerError("NOT_FOUND");
|
|
116
|
-
line =
|
|
117
|
-
`Removed the sticker from ${isolate(pack.name)}. It remains in your library.`,
|
|
118
|
-
`أُزيل الملصق من ${isolate(pack.name)}. بقي في مكتبتك.`,
|
|
119
|
-
);
|
|
101
|
+
line = t("bot.stickers.pack.removed", { name: isolate(pack.name) });
|
|
120
102
|
} else {
|
|
121
103
|
const target = targetOf(msg, { quotedOnly: true });
|
|
122
104
|
if (parsed.action === "show" || (parsed.action === "auto" && !target)) {
|
|
123
105
|
const pack = requirePack(who, parsed.name);
|
|
124
|
-
line =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
106
|
+
line = t("bot.stickers.pack.show", {
|
|
107
|
+
name: isolate(pack.name),
|
|
108
|
+
count: countLabel(pack.count),
|
|
109
|
+
hint: commandHint(
|
|
110
|
+
"stickers",
|
|
111
|
+
`${t("bot.stickers.hint.showWord")} ${pack.name}`,
|
|
112
|
+
),
|
|
113
|
+
});
|
|
128
114
|
} else {
|
|
129
115
|
if (!target) throw new StickerError("NO_MEDIA");
|
|
130
116
|
let pack = library.findPackByName(who, parsed.name);
|
|
@@ -132,12 +118,9 @@ module.exports = {
|
|
|
132
118
|
if (createdPack) pack = library.createPack(who, parsed.name);
|
|
133
119
|
try {
|
|
134
120
|
const buffer = await downloadTarget(target);
|
|
135
|
-
status = await createStatus(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
tr("🎨 Saving sticker...", "🎨 جارٍ حفظ الملصق..."),
|
|
139
|
-
{ replyTo: msg },
|
|
140
|
-
);
|
|
121
|
+
status = await createStatus(sock, jid, t("bot.stickers.pack.saving"), {
|
|
122
|
+
replyTo: msg,
|
|
123
|
+
});
|
|
141
124
|
const { promise } = studio.createFromBuffer({
|
|
142
125
|
owner: who,
|
|
143
126
|
buffer,
|
|
@@ -147,14 +130,8 @@ module.exports = {
|
|
|
147
130
|
});
|
|
148
131
|
const result = await promise;
|
|
149
132
|
line = result.created
|
|
150
|
-
?
|
|
151
|
-
|
|
152
|
-
`حُفظ الملصق في ${isolate(pack.name)}.`,
|
|
153
|
-
)
|
|
154
|
-
: tr(
|
|
155
|
-
`Already in your library; added to ${isolate(pack.name)}.`,
|
|
156
|
-
`الملصق موجود في مكتبتك بالفعل؛ أُضيف إلى ${isolate(pack.name)}.`,
|
|
157
|
-
);
|
|
133
|
+
? t("bot.stickers.pack.saved", { name: isolate(pack.name) })
|
|
134
|
+
: t("bot.stickers.pack.duplicate", { name: isolate(pack.name) });
|
|
158
135
|
} catch (error) {
|
|
159
136
|
if (createdPack) {
|
|
160
137
|
try {
|
package/src/commands/packs.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { t } = require("../utils/i18n.cjs");
|
|
2
2
|
const { isolate } = require("../utils/bidi.cjs");
|
|
3
3
|
const ownerModule = require("../stickers/owner.cjs");
|
|
4
4
|
const library = require("../stickers/library.cjs");
|
|
@@ -7,41 +7,31 @@ const { commandHint, countLabel, errorText } = require("../utils/stickerBot.cjs"
|
|
|
7
7
|
module.exports = {
|
|
8
8
|
name: "packs",
|
|
9
9
|
aliases: ["حزم"],
|
|
10
|
-
description: {
|
|
11
|
-
en: "List your sticker packs and library total.",
|
|
12
|
-
ar: "يعرض حزم ملصقاتك وإجمالي المكتبة.",
|
|
13
|
-
},
|
|
14
|
-
usage: { en: "packs", ar: "packs" },
|
|
15
10
|
chat: "all",
|
|
16
11
|
async execute(sock, msg) {
|
|
17
12
|
const jid = msg.key.remoteJid;
|
|
18
13
|
const who = await ownerModule.forMessage(msg, sock);
|
|
19
14
|
if (!who.key)
|
|
20
15
|
return sock.sendMessage(jid, {
|
|
21
|
-
text:
|
|
16
|
+
text: t("bot.stickers.packs.senderUnknown"),
|
|
22
17
|
});
|
|
23
18
|
try {
|
|
24
19
|
const packs = library.listPacks(who);
|
|
25
20
|
const total = library.listStickers(who, { limit: 1 }).total;
|
|
26
21
|
if (!packs.length)
|
|
27
22
|
return sock.sendMessage(jid, {
|
|
28
|
-
text:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
),
|
|
23
|
+
text: t("bot.stickers.packs.empty", {
|
|
24
|
+
hint: commandHint("pack", t("bot.stickers.hint.name")),
|
|
25
|
+
count: countLabel(total),
|
|
26
|
+
}),
|
|
32
27
|
});
|
|
33
28
|
const lines = packs
|
|
34
29
|
.slice(0, 30)
|
|
35
30
|
.map((pack) => `${isolate(pack.name)} — ${countLabel(pack.count)}`);
|
|
36
31
|
if (packs.length > 30)
|
|
37
|
-
lines.push(
|
|
38
|
-
tr(
|
|
39
|
-
`and ${countLabel(packs.length - 30, "pack")} more`,
|
|
40
|
-
`و${countLabel(packs.length - 30, "pack")} أخرى`,
|
|
41
|
-
),
|
|
42
|
-
);
|
|
32
|
+
lines.push(t("bot.stickers.packs.more", { count: countLabel(packs.length - 30, "pack") }));
|
|
43
33
|
await sock.sendMessage(jid, {
|
|
44
|
-
text: `${
|
|
34
|
+
text: `${t("bot.stickers.packs.header")} ${countLabel(total)}\n${lines.join("\n")}`,
|
|
45
35
|
});
|
|
46
36
|
} catch (error) {
|
|
47
37
|
await sock.sendMessage(jid, { text: errorText(error) });
|