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
|
@@ -2,20 +2,12 @@
|
|
|
2
2
|
const { scheduleNewJob, saveScheduledJob } = require("../../scheduler.cjs");
|
|
3
3
|
const { zonedTimeToDate } = require("../utils/datetime.cjs");
|
|
4
4
|
const logger = require("../utils/logger.cjs");
|
|
5
|
-
const {
|
|
5
|
+
const { t } = require("../utils/i18n.cjs");
|
|
6
6
|
|
|
7
7
|
const DATETIME_RE = /^(\d{1,2}):(\d{2})\s+(\d{1,2})-(\d{1,2})-(\d{4})$/;
|
|
8
8
|
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "schedule",
|
|
11
|
-
description: {
|
|
12
|
-
en: "Schedules a message to be sent later.",
|
|
13
|
-
ar: "يجدول رسالة لتُرسل في وقت لاحق.",
|
|
14
|
-
},
|
|
15
|
-
usage: {
|
|
16
|
-
en: 'schedule "HH:mm DD-MM-YYYY" "message"',
|
|
17
|
-
ar: 'schedule "HH:mm DD-MM-YYYY" "الرسالة"',
|
|
18
|
-
},
|
|
19
11
|
chat: "all",
|
|
20
12
|
|
|
21
13
|
async execute(sock, msg, args) {
|
|
@@ -28,10 +20,7 @@ module.exports = {
|
|
|
28
20
|
|
|
29
21
|
if (!parts || parts.length < 2) {
|
|
30
22
|
return await sock.sendMessage(creatorJid, {
|
|
31
|
-
text:
|
|
32
|
-
'Wrong format. Use:\n`!schedule "HH:mm DD-MM-YYYY" "your message"`',
|
|
33
|
-
'الصيغة غير صحيحة. يرجى استخدام:\n`!schedule "HH:mm DD-MM-YYYY" "رسالتك"`',
|
|
34
|
-
),
|
|
23
|
+
text: t("bot.schedules.schedule.wrongFormat"),
|
|
35
24
|
});
|
|
36
25
|
}
|
|
37
26
|
|
|
@@ -42,10 +31,7 @@ module.exports = {
|
|
|
42
31
|
const match = DATETIME_RE.exec(dateTimeString.trim());
|
|
43
32
|
if (!match) {
|
|
44
33
|
return await sock.sendMessage(creatorJid, {
|
|
45
|
-
text:
|
|
46
|
-
"Wrong time format. Use `HH:mm DD-MM-YYYY` (for example `22:30 07-06-2025`).",
|
|
47
|
-
"صيغة الوقت غير صحيحة. استخدم `HH:mm DD-MM-YYYY` (مثال: `22:30 07-06-2025`).",
|
|
48
|
-
),
|
|
34
|
+
text: t("bot.schedules.schedule.wrongTime"),
|
|
49
35
|
});
|
|
50
36
|
}
|
|
51
37
|
|
|
@@ -64,10 +50,7 @@ module.exports = {
|
|
|
64
50
|
|
|
65
51
|
if (isNaN(scheduleDate.getTime()) || scheduleDate <= new Date()) {
|
|
66
52
|
return await sock.sendMessage(creatorJid, {
|
|
67
|
-
text:
|
|
68
|
-
"That date or time is invalid or in the past. Use `HH:mm DD-MM-YYYY` with a future date.",
|
|
69
|
-
"التاريخ أو الوقت غير صالح أو في الماضي. يرجى استخدام صيغة `HH:mm DD-MM-YYYY` بتاريخ مستقبلي.",
|
|
70
|
-
),
|
|
53
|
+
text: t("bot.schedules.schedule.pastDate"),
|
|
71
54
|
});
|
|
72
55
|
}
|
|
73
56
|
|
|
@@ -84,10 +67,7 @@ module.exports = {
|
|
|
84
67
|
// Schedule the job to run in the current session
|
|
85
68
|
if (!scheduleNewJob(sock, newJob)) {
|
|
86
69
|
return await sock.sendMessage(creatorJid, {
|
|
87
|
-
text:
|
|
88
|
-
"I couldn't schedule that message. Check the time and try again.",
|
|
89
|
-
"تعذّرت جدولة هذه الرسالة. راجع الوقت وحاول مرة أخرى.",
|
|
90
|
-
),
|
|
70
|
+
text: t("bot.schedules.schedule.couldNotSchedule"),
|
|
91
71
|
});
|
|
92
72
|
}
|
|
93
73
|
|
package/src/commands/score.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const logger = require("../utils/logger.cjs");
|
|
2
|
-
const {
|
|
2
|
+
const { t } = require("../utils/i18n.cjs");
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Extracts quoted message info with forwarding score
|
|
@@ -93,14 +93,6 @@ function getQuotedInfo(msg) {
|
|
|
93
93
|
module.exports = {
|
|
94
94
|
name: "score",
|
|
95
95
|
aliases: ["نقاط", "احصائية"],
|
|
96
|
-
description: {
|
|
97
|
-
en: "Shows how many times a message has been forwarded.",
|
|
98
|
-
ar: "يعرض عدد مرات إعادة توجيه رسالة معيّنة.",
|
|
99
|
-
},
|
|
100
|
-
usage: {
|
|
101
|
-
en: "score (reply to the message)",
|
|
102
|
-
ar: "score (رد على الرسالة)",
|
|
103
|
-
},
|
|
104
96
|
chat: "all",
|
|
105
97
|
|
|
106
98
|
async execute(sock, msg, args, body, groupMetadata) {
|
|
@@ -110,11 +102,7 @@ module.exports = {
|
|
|
110
102
|
|
|
111
103
|
if (!quotedInfo || !quotedInfo.stanzaId) {
|
|
112
104
|
return await sock.sendMessage(chatId, {
|
|
113
|
-
text:
|
|
114
|
-
"❌ Reply to a message to see its score.\n\n*Usage:* reply to a message and type `!score`",
|
|
115
|
-
"❌ يرجى الرد على رسالة لعرض نقاطها.\n\n" +
|
|
116
|
-
"*الاستخدام:* قم بالرد على رسالة واكتب `!score`",
|
|
117
|
-
),
|
|
105
|
+
text: t("bot.tools.score.replyNeeded"),
|
|
118
106
|
});
|
|
119
107
|
}
|
|
120
108
|
|
|
@@ -122,18 +110,12 @@ module.exports = {
|
|
|
122
110
|
const { forwardingScore, isForwarded } = quotedInfo;
|
|
123
111
|
|
|
124
112
|
// Display the forward score
|
|
125
|
-
let responseText =
|
|
113
|
+
let responseText = t("bot.tools.score.header");
|
|
126
114
|
|
|
127
115
|
if (isForwarded || forwardingScore > 0) {
|
|
128
|
-
responseText +=
|
|
129
|
-
`🔢 *Times forwarded:* ${forwardingScore}\n✅ *Status:* forwarded`,
|
|
130
|
-
`🔢 *عدد مرات إعادة التوجيه:* ${forwardingScore}\n✅ *حالة الرسالة:* تم إعادة توجيهها`,
|
|
131
|
-
);
|
|
116
|
+
responseText += t("bot.tools.score.forwarded", { count: forwardingScore });
|
|
132
117
|
} else {
|
|
133
|
-
responseText +=
|
|
134
|
-
"🔢 *Times forwarded:* 0\nℹ️ *Status:* original message (never forwarded)",
|
|
135
|
-
"🔢 *عدد مرات إعادة التوجيه:* 0\nℹ️ *حالة الرسالة:* رسالة أصلية (لم يتم إعادة توجيهها)",
|
|
136
|
-
);
|
|
118
|
+
responseText += t("bot.tools.score.original");
|
|
137
119
|
}
|
|
138
120
|
|
|
139
121
|
await sock.sendMessage(chatId, {
|
|
@@ -142,10 +124,7 @@ module.exports = {
|
|
|
142
124
|
} catch (error) {
|
|
143
125
|
logger.error({ err: error }, "Error in !score command");
|
|
144
126
|
await sock.sendMessage(chatId, {
|
|
145
|
-
text:
|
|
146
|
-
"❌ Something went wrong while reading the message's score.",
|
|
147
|
-
"❌ حدث خطأ أثناء جلب نقاط الرسالة.",
|
|
148
|
-
),
|
|
127
|
+
text: t("bot.tools.score.error"),
|
|
149
128
|
});
|
|
150
129
|
}
|
|
151
130
|
},
|
package/src/commands/send.cjs
CHANGED
|
@@ -11,18 +11,10 @@ const { downloadMedia } = require("../utils/geminiMedia.cjs");
|
|
|
11
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
|
-
const {
|
|
14
|
+
const { t } = require("../utils/i18n.cjs");
|
|
15
15
|
|
|
16
16
|
module.exports = {
|
|
17
17
|
name: "send",
|
|
18
|
-
description: {
|
|
19
|
-
en: "Re-sends the replied message here: a status/story, photo, video, voice note, sticker, document or text.",
|
|
20
|
-
ar: "يعيد إرسال الرسالة الموجّه لها الرد هنا: استوري، صورة، فيديو، رسالة صوتية، ستيكر، مستند أو نص.",
|
|
21
|
-
},
|
|
22
|
-
usage: {
|
|
23
|
-
en: "send (reply to a status or any message with it)",
|
|
24
|
-
ar: "send (اعمل رد على استوري أو أي رسالة بالأمر)",
|
|
25
|
-
},
|
|
26
18
|
chat: "all",
|
|
27
19
|
|
|
28
20
|
async execute(sock, msg) {
|
|
@@ -39,14 +31,11 @@ module.exports = {
|
|
|
39
31
|
return await sock.sendMessage(chatId, { text: quotedText });
|
|
40
32
|
}
|
|
41
33
|
return await sock.sendMessage(chatId, {
|
|
42
|
-
text:
|
|
43
|
-
"Reply to a status or any message with `!send` and I'll re-send it here.",
|
|
44
|
-
"اعمل رد على استوري أو أي رسالة بالأمر `!send` وأنا هعيد إرسالها هنا.",
|
|
45
|
-
),
|
|
34
|
+
text: t("bot.core.send.replyHint"),
|
|
46
35
|
});
|
|
47
36
|
}
|
|
48
37
|
|
|
49
|
-
const status = await createStatus(sock, chatId,
|
|
38
|
+
const status = await createStatus(sock, chatId, t("bot.core.send.sending"), {
|
|
50
39
|
replyTo: msg,
|
|
51
40
|
});
|
|
52
41
|
|
|
@@ -89,10 +78,7 @@ module.exports = {
|
|
|
89
78
|
logger.error({ err: error, command: "send" }, "Failed to re-send replied media");
|
|
90
79
|
await status.fail(
|
|
91
80
|
error,
|
|
92
|
-
|
|
93
|
-
"Couldn't re-send it — the media may have expired",
|
|
94
|
-
"تعذّر إرساله — ربما انتهت صلاحية ملف الوسائط",
|
|
95
|
-
),
|
|
81
|
+
t("bot.core.send.resendFailed"),
|
|
96
82
|
);
|
|
97
83
|
}
|
|
98
84
|
},
|
|
@@ -2,25 +2,19 @@
|
|
|
2
2
|
const logger = require("../utils/logger.cjs");
|
|
3
3
|
// Same validation and storage the dashboard uses, so both doors agree.
|
|
4
4
|
const runtimeConfig = require("../config/runtime-config.cjs");
|
|
5
|
-
const {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"Prefix can't
|
|
5
|
+
const { t } = require("../utils/i18n.cjs");
|
|
6
|
+
|
|
7
|
+
// runtime-config words its refusals in English for the dashboard. Each known
|
|
8
|
+
// refusal maps to a catalog message, built when it is sent.
|
|
9
|
+
const PREFIX_ERRORS = {
|
|
10
|
+
"Prefix can't be empty": () => t("bot.core.setprefix.errorEmpty"),
|
|
11
|
+
"Prefix can't be longer than 3 characters": () => t("bot.core.setprefix.errorTooLong"),
|
|
12
|
+
"Prefix can't contain whitespace": () => t("bot.core.setprefix.errorWhitespace"),
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
module.exports = {
|
|
14
16
|
name: "setprefix",
|
|
15
17
|
aliases: ["prefix"],
|
|
16
|
-
description: {
|
|
17
|
-
en: "Sets the bot's command prefix (owner only).",
|
|
18
|
-
ar: "يغيّر بادئة أوامر البوت (للمالك فقط).",
|
|
19
|
-
},
|
|
20
|
-
usage: {
|
|
21
|
-
en: "setprefix <new prefix>",
|
|
22
|
-
ar: "setprefix <البادئة الجديدة>",
|
|
23
|
-
},
|
|
24
18
|
chat: "all",
|
|
25
19
|
|
|
26
20
|
async execute(sock, msg, args) {
|
|
@@ -31,10 +25,7 @@ module.exports = {
|
|
|
31
25
|
const currentPrefix = runtimeConfig.getPrefix();
|
|
32
26
|
|
|
33
27
|
await sock.sendMessage(chatId, {
|
|
34
|
-
text:
|
|
35
|
-
`The bot's current prefix: \`${currentPrefix}\`\n\nTo change it, use:\n\`${currentPrefix}setprefix <new_prefix>\`\n\nExample: \`${currentPrefix}setprefix /\`\n\n⚠️ Only the owner can change the prefix.`,
|
|
36
|
-
`البادئة الحالية للبوت: \`${currentPrefix}\`\n\nلتغيير البادئة، استخدم:\n\`${currentPrefix}setprefix <البادئة_الجديدة>\`\n\nمثال: \`${currentPrefix}setprefix /\`\n\n⚠️ ملاحظة: يمكن للمالك فقط تغيير البادئة.`,
|
|
37
|
-
),
|
|
28
|
+
text: t("bot.core.setprefix.current", { prefix: currentPrefix }),
|
|
38
29
|
});
|
|
39
30
|
return;
|
|
40
31
|
}
|
|
@@ -45,7 +36,7 @@ module.exports = {
|
|
|
45
36
|
} catch (error) {
|
|
46
37
|
// runtime-config words its refusals in English for the dashboard.
|
|
47
38
|
await sock.sendMessage(chatId, {
|
|
48
|
-
text: `❌ ${
|
|
39
|
+
text: `❌ ${Object.hasOwn(PREFIX_ERRORS, error.message) ? PREFIX_ERRORS[error.message]() : error.message}`,
|
|
49
40
|
});
|
|
50
41
|
return;
|
|
51
42
|
}
|
|
@@ -53,10 +44,7 @@ module.exports = {
|
|
|
53
44
|
logger.info(`[Prefix] Bot prefix changed to: ${newPrefix}`);
|
|
54
45
|
|
|
55
46
|
await sock.sendMessage(chatId, {
|
|
56
|
-
text:
|
|
57
|
-
`✅ The prefix is now \`${newPrefix}\`\n\nUse \`${newPrefix}help\` to see the commands.\n\n⚠️ The new prefix works in every chat right away.`,
|
|
58
|
-
`✅ تم تغيير البادئة بنجاح إلى: \`${newPrefix}\`\n\nالآن استخدم \`${newPrefix}help\` لعرض الأوامر.\n\n⚠️ البادئة الجديدة تعمل الآن في كل المحادثات.`,
|
|
59
|
-
),
|
|
47
|
+
text: t("bot.core.setprefix.changed", { prefix: newPrefix }),
|
|
60
48
|
});
|
|
61
49
|
},
|
|
62
50
|
};
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
const axios = require("axios");
|
|
12
12
|
const logger = require("../utils/logger.cjs");
|
|
13
13
|
const { createStatus } = require("../utils/statusMessage.cjs");
|
|
14
|
-
const {
|
|
14
|
+
const { t } = require("../utils/i18n.cjs");
|
|
15
15
|
const { visibleText, quotedOf } = require("../utils/messageContent.cjs");
|
|
16
16
|
|
|
17
17
|
// The one HTTP GET the command performs. Exposed so tests can stub the network.
|
|
@@ -176,19 +176,13 @@ async function shortenUrl(longUrl, get = http.get) {
|
|
|
176
176
|
function failureText(reason) {
|
|
177
177
|
switch (reason) {
|
|
178
178
|
case "invalid":
|
|
179
|
-
return
|
|
180
|
-
"the service rejected the link (invalid or blocked)",
|
|
181
|
-
"الخدمة رفضت الرابط (غير صالح أو محظور)",
|
|
182
|
-
);
|
|
179
|
+
return t("bot.tools.shortlink.reasonInvalid");
|
|
183
180
|
case "rate":
|
|
184
|
-
return
|
|
185
|
-
"the service is rate-limiting, try again later",
|
|
186
|
-
"الخدمة تحدّ من الطلبات، جرّب لاحقًا",
|
|
187
|
-
);
|
|
181
|
+
return t("bot.tools.shortlink.reasonRate");
|
|
188
182
|
case "unreachable":
|
|
189
|
-
return
|
|
183
|
+
return t("bot.tools.shortlink.reasonUnreachable");
|
|
190
184
|
default:
|
|
191
|
-
return
|
|
185
|
+
return t("bot.tools.shortlink.reasonUnknown");
|
|
192
186
|
}
|
|
193
187
|
}
|
|
194
188
|
|
|
@@ -199,22 +193,16 @@ function renderResults(results) {
|
|
|
199
193
|
if (!ok.length) {
|
|
200
194
|
const reason = results[results.length - 1].reason;
|
|
201
195
|
if (results.length === 1) {
|
|
202
|
-
return
|
|
203
|
-
`❌ *Couldn't shorten the link*\n\n${failureText(reason)}`,
|
|
204
|
-
`❌ *تعذّر اختصار الرابط*\n\n${failureText(reason)}`,
|
|
205
|
-
);
|
|
196
|
+
return t("bot.tools.shortlink.oneFail", { reason: failureText(reason) });
|
|
206
197
|
}
|
|
207
198
|
const failed = results.map((r) => `• ${r.url} — ${failureText(r.reason)}`).join("\n");
|
|
208
|
-
return
|
|
209
|
-
`❌ *Couldn't shorten any of the links*\n\n${failed}`,
|
|
210
|
-
`❌ *تعذّر اختصار أي من الروابط*\n\n${failed}`,
|
|
211
|
-
);
|
|
199
|
+
return t("bot.tools.shortlink.allFail", { failed });
|
|
212
200
|
}
|
|
213
201
|
|
|
214
202
|
const heading =
|
|
215
203
|
results.length === 1
|
|
216
|
-
?
|
|
217
|
-
:
|
|
204
|
+
? t("bot.tools.shortlink.oneDone")
|
|
205
|
+
: t("bot.tools.shortlink.manyDone", { count: ok.length });
|
|
218
206
|
|
|
219
207
|
const body = results
|
|
220
208
|
.map((r) => (r.ok ? `🔗 ${r.url}` : `❌ ${r.url} — ${failureText(r.reason)}`))
|
|
@@ -233,32 +221,18 @@ async function shortenMany(urls) {
|
|
|
233
221
|
|
|
234
222
|
function sendUsage(sock, chatId) {
|
|
235
223
|
return sock.sendMessage(chatId, {
|
|
236
|
-
text:
|
|
237
|
-
"Send the link you want to shorten, or reply to a message containing one.\n\n*Example:*\n`!shortlink https://github.com/WhiskeySockets/Baileys`",
|
|
238
|
-
"أرسل الرابط الذي تريد اختصاره، أو اعمل رد على رسالة تحتوي رابطًا.\n\n*مثال:*\n`!shortlink https://github.com/WhiskeySockets/Baileys`",
|
|
239
|
-
),
|
|
224
|
+
text: t("bot.tools.shortlink.usageHint"),
|
|
240
225
|
});
|
|
241
226
|
}
|
|
242
227
|
|
|
243
228
|
function sendInvalid(sock, chatId) {
|
|
244
229
|
return sock.sendMessage(chatId, {
|
|
245
|
-
text:
|
|
246
|
-
"I couldn't find a valid link. Send a URL like `https://example.com`, or reply to a message with one.",
|
|
247
|
-
"لم أجد رابطًا صالحًا. أرسل رابطًا مثل `https://example.com`، أو اعمل رد على رسالة تحتوي عليه.",
|
|
248
|
-
),
|
|
230
|
+
text: t("bot.tools.shortlink.noLink"),
|
|
249
231
|
});
|
|
250
232
|
}
|
|
251
233
|
|
|
252
234
|
module.exports = {
|
|
253
235
|
name: "shortlink",
|
|
254
|
-
description: {
|
|
255
|
-
en: "Shortens up to 5 links with is.gd, falling back to v.gd. Reads a URL from the command or a replied message.",
|
|
256
|
-
ar: "يختصر حتى 5 روابط باستخدام is.gd مع التحويل إلى v.gd عند الحاجة، من الأمر أو من رسالة موجّه لها الرد.",
|
|
257
|
-
},
|
|
258
|
-
usage: {
|
|
259
|
-
en: "shortlink <url> | reply to a message containing a link",
|
|
260
|
-
ar: "shortlink <الرابط> | اعمل رد على رسالة تحتوي رابطًا",
|
|
261
|
-
},
|
|
262
236
|
chat: "all",
|
|
263
237
|
neutralArgs: true, // a URL is not a language
|
|
264
238
|
|
|
@@ -277,7 +251,7 @@ module.exports = {
|
|
|
277
251
|
}
|
|
278
252
|
|
|
279
253
|
// One message: "shortening..." becomes the short link(s) or the reason.
|
|
280
|
-
const status = await createStatus(sock, chatId,
|
|
254
|
+
const status = await createStatus(sock, chatId, t("bot.tools.shortlink.shortening"), {
|
|
281
255
|
replyTo: msg,
|
|
282
256
|
});
|
|
283
257
|
|
|
@@ -286,7 +260,7 @@ module.exports = {
|
|
|
286
260
|
await status.finish(renderResults(results));
|
|
287
261
|
} catch (error) {
|
|
288
262
|
logger.error({ err: error, command: "shortlink" }, "[Error] in !shortlink command");
|
|
289
|
-
await status.fail(error,
|
|
263
|
+
await status.fail(error, t("bot.tools.shortlink.failed"));
|
|
290
264
|
}
|
|
291
265
|
},
|
|
292
266
|
|
package/src/commands/status.cjs
CHANGED
|
@@ -1,96 +1,208 @@
|
|
|
1
|
-
//
|
|
1
|
+
// !status — a short line for the owner, and an owner-only health report.
|
|
2
|
+
//
|
|
3
|
+
// The command's permission stays OWNER_ONLY (Q-06, option a). `!status debug`
|
|
4
|
+
// is gated again on the owner role, so lowering the command in the panel
|
|
5
|
+
// cannot show versions, paths or the kernel to a group member.
|
|
2
6
|
|
|
3
7
|
const os = require("os");
|
|
4
|
-
const
|
|
5
|
-
const logger = require("../utils/logger.cjs");
|
|
8
|
+
const { getSession } = require("../core/session-holder.cjs");
|
|
6
9
|
const { checkFfmpeg } = require("../utils/thumbnail.cjs");
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const { t } = require("../utils/i18n.cjs");
|
|
11
|
+
const { isOwnerJidSync, getSenderCandidatesSync } = require("../utils/permissions.cjs");
|
|
12
|
+
const logger = require("../utils/logger.cjs");
|
|
13
|
+
const { assessHealth, whatsAppProbe } = require("../messaging/health.cjs");
|
|
14
|
+
|
|
15
|
+
const FAMILIES = {
|
|
16
|
+
linux: "Linux",
|
|
17
|
+
darwin: "macOS",
|
|
18
|
+
win32: "Windows",
|
|
19
|
+
android: "Android",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function osFamily() {
|
|
23
|
+
if (process.env.LEVIX_ANDROID === "1") return "Android";
|
|
24
|
+
return FAMILIES[os.platform()] || t("bot.core.status.osUnknown");
|
|
25
|
+
}
|
|
26
|
+
|
|
15
27
|
function formatUptime(seconds) {
|
|
16
28
|
const d = Math.floor(seconds / (3600 * 24));
|
|
17
29
|
const h = Math.floor((seconds % (3600 * 24)) / 3600);
|
|
18
30
|
const m = Math.floor((seconds % 3600) / 60);
|
|
19
31
|
const s = Math.floor(seconds % 60);
|
|
32
|
+
return t("bot.core.status.uptime", { days: d, hours: h, minutes: m, seconds: s });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function senderIsOwner(msg, sock, groupMetadata) {
|
|
36
|
+
if (msg?.key?.fromMe) return true;
|
|
37
|
+
try {
|
|
38
|
+
const ids = getSenderCandidatesSync(msg, sock);
|
|
39
|
+
return ids.some((id) => isOwnerJidSync(id, groupMetadata));
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function sessionState() {
|
|
46
|
+
try {
|
|
47
|
+
return getSession()?.getState() || null;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function nodeProbe() {
|
|
54
|
+
const major = Number(String(process.versions.node || "").split(".")[0]);
|
|
55
|
+
return { state: major === 24 ? "ok" : "degraded" };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function databaseProbe() {
|
|
59
|
+
let opened = false;
|
|
60
|
+
try {
|
|
61
|
+
const { db } = require("../db/db.cjs");
|
|
62
|
+
opened = true;
|
|
63
|
+
db.prepare("SELECT 1 AS ok").get();
|
|
64
|
+
db.exec("BEGIN IMMEDIATE");
|
|
65
|
+
try {
|
|
66
|
+
db.prepare("SELECT 1 AS ok").get();
|
|
67
|
+
} finally {
|
|
68
|
+
db.exec("ROLLBACK");
|
|
69
|
+
}
|
|
70
|
+
const row = db.prepare("PRAGMA quick_check(1)").get();
|
|
71
|
+
const value = row ? Object.values(row)[0] : null;
|
|
72
|
+
return { state: value === "ok" ? "ok" : "down" };
|
|
73
|
+
} catch {
|
|
74
|
+
return { state: opened ? "degraded" : "down" };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function schedulerProbe() {
|
|
79
|
+
try {
|
|
80
|
+
const jobs = require("../../scheduler.cjs").getScheduledJobs();
|
|
81
|
+
if (!Array.isArray(jobs)) return { state: "unknown" };
|
|
82
|
+
const failed = jobs.some((job) => job?.status === "failed" || job?.status === "error");
|
|
83
|
+
return { state: failed ? "degraded" : "ok" };
|
|
84
|
+
} catch {
|
|
85
|
+
return { state: "unknown" };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
20
88
|
|
|
21
|
-
|
|
89
|
+
function diskProbe() {
|
|
90
|
+
try {
|
|
91
|
+
const dir = require("../config/paths.cjs").DATA_DIR;
|
|
92
|
+
const stats = fsStatfs(dir);
|
|
93
|
+
const free = Number(stats.bavail) * Number(stats.bsize);
|
|
94
|
+
if (!Number.isFinite(free) || free < 0) return { state: "unknown" };
|
|
95
|
+
const mb = Math.round(free / (1024 * 1024));
|
|
96
|
+
return { state: free < 50 * 1024 * 1024 ? "degraded" : "ok", detail: `${mb} MB` };
|
|
97
|
+
} catch {
|
|
98
|
+
return { state: "unknown" };
|
|
99
|
+
}
|
|
22
100
|
}
|
|
23
101
|
|
|
102
|
+
function fsStatfs(dir) {
|
|
103
|
+
return require("fs").statfsSync(dir);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function memoryProbe() {
|
|
107
|
+
try {
|
|
108
|
+
const free = os.freemem();
|
|
109
|
+
if (!Number.isFinite(free)) return { state: "unknown" };
|
|
110
|
+
const mb = Math.round(free / (1024 * 1024));
|
|
111
|
+
return { state: free < 32 * 1024 * 1024 ? "degraded" : "ok", detail: `${mb} MB` };
|
|
112
|
+
} catch {
|
|
113
|
+
return { state: "unknown" };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function recoveryProbe() {
|
|
118
|
+
try {
|
|
119
|
+
const journal = require("../backup/journal.cjs").readJournal();
|
|
120
|
+
return { state: journal ? "degraded" : "ok" };
|
|
121
|
+
} catch {
|
|
122
|
+
return { state: "unknown" };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function mediaProbe() {
|
|
127
|
+
try {
|
|
128
|
+
const ffmpeg = await checkFfmpeg();
|
|
129
|
+
return { state: ffmpeg?.ok ? "ok" : "down" };
|
|
130
|
+
} catch {
|
|
131
|
+
return { state: "unknown" };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function gatherProbes() {
|
|
136
|
+
const [media] = await Promise.all([mediaProbe()]);
|
|
137
|
+
return {
|
|
138
|
+
node: nodeProbe(),
|
|
139
|
+
whatsapp: whatsAppProbe(sessionState()),
|
|
140
|
+
database: databaseProbe(),
|
|
141
|
+
scheduler: schedulerProbe(),
|
|
142
|
+
disk: diskProbe(),
|
|
143
|
+
memory: memoryProbe(),
|
|
144
|
+
recovery: recoveryProbe(),
|
|
145
|
+
media,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function safeDetail(detail) {
|
|
150
|
+
return typeof detail === "string" && /^[0-9]+ MB$/.test(detail) ? detail : null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function debugText(report) {
|
|
154
|
+
const lines = [t("bot.core.status.debugHeader")];
|
|
155
|
+
for (const check of report.checks) {
|
|
156
|
+
const name = t(`bot.core.status.check.${check.id}`);
|
|
157
|
+
const state = t(`bot.core.status.state.${check.state}`);
|
|
158
|
+
const detail = safeDetail(check.detail);
|
|
159
|
+
lines.push(
|
|
160
|
+
detail
|
|
161
|
+
? t("bot.core.status.debugLineDetail", { name, state, detail })
|
|
162
|
+
: t("bot.core.status.debugLine", { name, state }),
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
lines.push(t("bot.core.status.debugNode", { version: process.version }));
|
|
166
|
+
let baileys = "unknown";
|
|
167
|
+
try {
|
|
168
|
+
baileys = require("@whiskeysockets/baileys/package.json").version;
|
|
169
|
+
} catch {
|
|
170
|
+
baileys = t("bot.core.status.osUnknown");
|
|
171
|
+
}
|
|
172
|
+
lines.push(t("bot.core.status.debugBaileys", { version: baileys }));
|
|
173
|
+
return lines.join("\n");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const probes = { gather: gatherProbes };
|
|
177
|
+
|
|
24
178
|
module.exports = {
|
|
25
179
|
name: "status",
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
usage: {
|
|
31
|
-
en: "status",
|
|
32
|
-
ar: "status",
|
|
33
|
-
},
|
|
34
|
-
chat: "all", // Can be used in any chat
|
|
180
|
+
keywords: ["debug"],
|
|
181
|
+
chat: "all",
|
|
182
|
+
probes,
|
|
35
183
|
|
|
36
|
-
async execute(sock, msg) {
|
|
184
|
+
async execute(sock, msg, args, body, groupMetadata, ctx) {
|
|
185
|
+
const chatId = msg.key.remoteJid;
|
|
186
|
+
const send = (text) => sock.sendMessage(chatId, { text });
|
|
37
187
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const platform = os.platform();
|
|
54
|
-
const osRelease = os.release();
|
|
55
|
-
|
|
56
|
-
// 5. ffmpeg — media previews (jpegThumbnail) depend on it, and a broken
|
|
57
|
-
// binary is otherwise invisible.
|
|
58
|
-
const ffmpeg = await checkFfmpeg();
|
|
59
|
-
const ffmpegLine = ffmpeg.ok
|
|
60
|
-
? `✅ ${ffmpeg.version || tr("working", "يعمل")}`
|
|
61
|
-
: tr(`❌ not working (${ffmpeg.path})`, `❌ لا يعمل (${ffmpeg.path})`);
|
|
62
|
-
|
|
63
|
-
// --- BUILDING THE REPLY ---
|
|
64
|
-
const reply = tr(
|
|
65
|
-
`*🤖 Bot Status 🤖*
|
|
66
|
-
|
|
67
|
-
*⏰ Uptime:* ${formattedUptime}
|
|
68
|
-
*📊 Memory:* ${rssMb} MB
|
|
69
|
-
*🟢 Node.js:* ${nodeVersion}
|
|
70
|
-
*📚 Baileys:* v${baileysVersion}
|
|
71
|
-
*💻 OS:* ${platform}
|
|
72
|
-
*💿 OS release:* ${osRelease}
|
|
73
|
-
*🎞️ ffmpeg (thumbnails):* ${ffmpegLine}`,
|
|
74
|
-
`*🤖 حالة البوت 🤖*
|
|
75
|
-
|
|
76
|
-
*⏰ وقت التشغيل:* ${formattedUptime}
|
|
77
|
-
*📊 استخدام الذاكرة:* ${rssMb} MB
|
|
78
|
-
*🟢 إصدار Node.js:* ${nodeVersion}
|
|
79
|
-
*📚 إصدار Baileys:* v${baileysVersion}
|
|
80
|
-
*💻 نظام التشغيل:* ${platform}
|
|
81
|
-
*💿 إصدار نظام التشغيل:* ${osRelease}
|
|
82
|
-
*🎞️ ffmpeg (الصور المصغرة):* ${ffmpegLine}`,
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
await sock.sendMessage(msg.key.remoteJid, { text: reply });
|
|
188
|
+
if (String(args?.[0] || "").toLowerCase() === "debug") {
|
|
189
|
+
const authMetadata =
|
|
190
|
+
ctx && Object.hasOwn(ctx, "authGroupMetadata") ? ctx.authGroupMetadata : groupMetadata;
|
|
191
|
+
if (!senderIsOwner(msg, sock, authMetadata)) {
|
|
192
|
+
return await send(t("bot.core.status.debugOwnerOnly"));
|
|
193
|
+
}
|
|
194
|
+
const report = assessHealth(await probes.gather());
|
|
195
|
+
return await send(debugText(report));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const reply = t("bot.core.status.short", {
|
|
199
|
+
uptime: formatUptime(process.uptime()),
|
|
200
|
+
osFamily: osFamily(),
|
|
201
|
+
});
|
|
202
|
+
return await send(reply);
|
|
86
203
|
} catch (error) {
|
|
87
204
|
logger.error(error, "[Error] في أمر !status:");
|
|
88
|
-
await
|
|
89
|
-
text: tr(
|
|
90
|
-
"Something went wrong while reading the system status.",
|
|
91
|
-
"حدث خطأ أثناء جلب حالة النظام.",
|
|
92
|
-
),
|
|
93
|
-
});
|
|
205
|
+
return await send(t("bot.core.status.failed"));
|
|
94
206
|
}
|
|
95
207
|
},
|
|
96
208
|
};
|