levix-bot 4.1.0 → 4.2.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/package.json +1 -1
- package/public/dashboard/assets/{index-DngAcp-o.js → index-4AuqfnH5.js} +80 -80
- package/public/dashboard/index.html +1 -1
- package/scheduler.cjs +6 -1
- package/src/commands/autoschedule.cjs +40 -10
- package/src/commands/blacklist.cjs +35 -10
- package/src/commands/block.cjs +18 -5
- package/src/commands/calc.cjs +90 -24
- package/src/commands/debt.cjs +59 -33
- package/src/commands/deleteschedule.cjs +21 -5
- package/src/commands/digit.cjs +34 -8
- package/src/commands/gemini.cjs +217 -87
- package/src/commands/group/add.cjs +46 -13
- package/src/commands/group/all.cjs +15 -5
- package/src/commands/group/antiSpam.cjs +11 -4
- package/src/commands/group/antilink.cjs +36 -18
- package/src/commands/group/approveall.cjs +22 -7
- package/src/commands/group/clearwarns.cjs +18 -5
- package/src/commands/group/deletenote.cjs +18 -5
- package/src/commands/group/demote.cjs +25 -7
- package/src/commands/group/kick.cjs +28 -12
- package/src/commands/group/media.cjs +31 -12
- package/src/commands/group/members.cjs +21 -6
- package/src/commands/group/note.cjs +14 -4
- package/src/commands/group/promote.cjs +22 -6
- package/src/commands/group/removeall.cjs +13 -3
- package/src/commands/group/rules.cjs +20 -5
- package/src/commands/group/save.cjs +20 -5
- package/src/commands/group/setname.cjs +19 -6
- package/src/commands/group/setpp.cjs +21 -6
- package/src/commands/group/setrules.cjs +17 -5
- package/src/commands/group/setwarn.cjs +23 -7
- package/src/commands/group/tagadmins.cjs +16 -6
- package/src/commands/group/warn.cjs +35 -15
- package/src/commands/group/warns.cjs +33 -13
- package/src/commands/group/welcome.cjs +34 -16
- package/src/commands/group.cjs +96 -70
- package/src/commands/help.cjs +270 -135
- package/src/commands/lang.cjs +46 -13
- package/src/commands/listschedules.cjs +28 -11
- package/src/commands/loop.cjs +43 -9
- package/src/commands/memory.cjs +90 -30
- package/src/commands/mod.cjs +69 -27
- package/src/commands/notes.cjs +15 -5
- package/src/commands/perm.cjs +52 -20
- package/src/commands/ping.cjs +15 -3
- package/src/commands/poll.cjs +40 -9
- package/src/commands/prayer.cjs +28 -12
- package/src/commands/qr.cjs +20 -5
- package/src/commands/rand.cjs +54 -12
- package/src/commands/restart.cjs +13 -3
- package/src/commands/schedule.cjs +32 -9
- package/src/commands/score.cjs +26 -10
- package/src/commands/setprefix.cjs +27 -5
- package/src/commands/shortlink.cjs +36 -10
- package/src/commands/shutdown.cjs +13 -3
- package/src/commands/status.cjs +32 -11
- package/src/commands/sticker.cjs +34 -7
- package/src/commands/stt.cjs +159 -108
- package/src/commands/todo.cjs +31 -9
- package/src/commands/tts.cjs +25 -7
- package/src/commands/unblock.cjs +17 -4
- package/src/commands/weather.cjs +55 -17
- package/src/config/settings.cjs +1 -1
- package/src/handlers/command.handler.js +50 -10
- package/src/handlers/group.handler.js +5 -1
- package/src/handlers/message.handler.js +9 -0
- package/src/middleware/antispam.middleware.js +9 -2
- package/src/services/aiAgent.cjs +44 -39
- package/src/services/aiProviders.cjs +46 -19
- package/src/services/aiRouter.cjs +2 -1
- package/src/services/aiTools.cjs +2 -1
- package/src/utils/commandDocs.cjs +58 -0
- package/src/utils/geminiMedia.cjs +99 -0
- package/src/utils/i18n.cjs +113 -0
- package/src/utils/markdownParser.cjs +4 -2
- package/src/utils/memory.cjs +2 -1
- package/src/utils/permissionLevel.cjs +34 -6
- package/src/utils/providerUrl.cjs +29 -2
- package/src/utils/sendBotMessage.cjs +7 -3
- package/src/utils/sendBotMessage.esm.js +13 -3
- package/src/utils/statusMessage.cjs +11 -4
package/src/commands/score.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const logger = require("../utils/logger.cjs");
|
|
2
|
+
const { tr } = require("../utils/i18n.cjs");
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Extracts quoted message info with forwarding score
|
|
@@ -92,8 +93,14 @@ function getQuotedInfo(msg) {
|
|
|
92
93
|
module.exports = {
|
|
93
94
|
name: "score",
|
|
94
95
|
aliases: ["نقاط", "احصائية"],
|
|
95
|
-
description:
|
|
96
|
-
|
|
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
|
+
},
|
|
97
104
|
chat: "all",
|
|
98
105
|
|
|
99
106
|
async execute(sock, msg, args, body, groupMetadata) {
|
|
@@ -103,9 +110,11 @@ module.exports = {
|
|
|
103
110
|
|
|
104
111
|
if (!quotedInfo || !quotedInfo.stanzaId) {
|
|
105
112
|
return await sock.sendMessage(chatId, {
|
|
106
|
-
text:
|
|
113
|
+
text: tr(
|
|
114
|
+
"❌ Reply to a message to see its score.\n\n*Usage:* reply to a message and type `!score`",
|
|
107
115
|
"❌ يرجى الرد على رسالة لعرض نقاطها.\n\n" +
|
|
108
|
-
|
|
116
|
+
"*الاستخدام:* قم بالرد على رسالة واكتب `!score`",
|
|
117
|
+
),
|
|
109
118
|
});
|
|
110
119
|
}
|
|
111
120
|
|
|
@@ -113,14 +122,18 @@ module.exports = {
|
|
|
113
122
|
const { forwardingScore, isForwarded } = quotedInfo;
|
|
114
123
|
|
|
115
124
|
// Display the forward score
|
|
116
|
-
let responseText = "📊 *نقاط الرسالة*\n\n";
|
|
125
|
+
let responseText = tr("📊 *Message score*\n\n", "📊 *نقاط الرسالة*\n\n");
|
|
117
126
|
|
|
118
127
|
if (isForwarded || forwardingScore > 0) {
|
|
119
|
-
responseText +=
|
|
120
|
-
|
|
128
|
+
responseText += tr(
|
|
129
|
+
`🔢 *Times forwarded:* ${forwardingScore}\n✅ *Status:* forwarded`,
|
|
130
|
+
`🔢 *عدد مرات إعادة التوجيه:* ${forwardingScore}\n✅ *حالة الرسالة:* تم إعادة توجيهها`,
|
|
131
|
+
);
|
|
121
132
|
} else {
|
|
122
|
-
responseText +=
|
|
123
|
-
|
|
133
|
+
responseText += tr(
|
|
134
|
+
"🔢 *Times forwarded:* 0\nℹ️ *Status:* original message (never forwarded)",
|
|
135
|
+
"🔢 *عدد مرات إعادة التوجيه:* 0\nℹ️ *حالة الرسالة:* رسالة أصلية (لم يتم إعادة توجيهها)",
|
|
136
|
+
);
|
|
124
137
|
}
|
|
125
138
|
|
|
126
139
|
await sock.sendMessage(chatId, {
|
|
@@ -129,7 +142,10 @@ module.exports = {
|
|
|
129
142
|
} catch (error) {
|
|
130
143
|
logger.error({ err: error }, "Error in !score command");
|
|
131
144
|
await sock.sendMessage(chatId, {
|
|
132
|
-
text:
|
|
145
|
+
text: tr(
|
|
146
|
+
"❌ Something went wrong while reading the message's score.",
|
|
147
|
+
"❌ حدث خطأ أثناء جلب نقاط الرسالة.",
|
|
148
|
+
),
|
|
133
149
|
});
|
|
134
150
|
}
|
|
135
151
|
},
|
|
@@ -2,12 +2,25 @@
|
|
|
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 { tr } = require("../utils/i18n.cjs");
|
|
6
|
+
|
|
7
|
+
const PREFIX_ERRORS_AR = {
|
|
8
|
+
"Prefix can't be empty": "البادئة لا يمكن أن تكون فارغة",
|
|
9
|
+
"Prefix can't be longer than 3 characters": "البادئة لا يمكن أن تزيد عن 3 أحرف",
|
|
10
|
+
"Prefix can't contain whitespace": "البادئة لا يمكن أن تحتوي على مسافات",
|
|
11
|
+
};
|
|
5
12
|
|
|
6
13
|
module.exports = {
|
|
7
14
|
name: "setprefix",
|
|
8
15
|
aliases: ["prefix"],
|
|
9
|
-
description:
|
|
10
|
-
|
|
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
|
+
},
|
|
11
24
|
chat: "all",
|
|
12
25
|
|
|
13
26
|
async execute(sock, msg, args) {
|
|
@@ -18,7 +31,10 @@ module.exports = {
|
|
|
18
31
|
const currentPrefix = runtimeConfig.getPrefix();
|
|
19
32
|
|
|
20
33
|
await sock.sendMessage(chatId, {
|
|
21
|
-
text:
|
|
34
|
+
text: tr(
|
|
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
|
+
),
|
|
22
38
|
});
|
|
23
39
|
return;
|
|
24
40
|
}
|
|
@@ -27,14 +43,20 @@ module.exports = {
|
|
|
27
43
|
try {
|
|
28
44
|
newPrefix = runtimeConfig.setPrefix(args[0]);
|
|
29
45
|
} catch (error) {
|
|
30
|
-
|
|
46
|
+
// runtime-config words its refusals in English for the dashboard.
|
|
47
|
+
await sock.sendMessage(chatId, {
|
|
48
|
+
text: `❌ ${tr(error.message, PREFIX_ERRORS_AR[error.message] || error.message)}`,
|
|
49
|
+
});
|
|
31
50
|
return;
|
|
32
51
|
}
|
|
33
52
|
|
|
34
53
|
logger.info(`[Prefix] Bot prefix changed to: ${newPrefix}`);
|
|
35
54
|
|
|
36
55
|
await sock.sendMessage(chatId, {
|
|
37
|
-
text:
|
|
56
|
+
text: tr(
|
|
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
|
+
),
|
|
38
60
|
});
|
|
39
61
|
},
|
|
40
62
|
};
|
|
@@ -3,21 +3,32 @@
|
|
|
3
3
|
const axios = require("axios");
|
|
4
4
|
const logger = require("../utils/logger.cjs");
|
|
5
5
|
const { createStatus } = require("../utils/statusMessage.cjs");
|
|
6
|
+
const { tr } = require("../utils/i18n.cjs");
|
|
6
7
|
|
|
7
8
|
// A simple regex to validate if the input is a URL
|
|
8
9
|
const urlRegex = new RegExp(/^(https?:\/\/[^\s/$.?#].[^\s]*)$/i);
|
|
9
10
|
|
|
10
11
|
module.exports = {
|
|
11
12
|
name: "shortlink",
|
|
12
|
-
description:
|
|
13
|
-
|
|
13
|
+
description: {
|
|
14
|
+
en: "Shortens a long URL with the is.gd service.",
|
|
15
|
+
ar: "يختصر رابطًا طويلًا باستخدام خدمة is.gd.",
|
|
16
|
+
},
|
|
17
|
+
usage: {
|
|
18
|
+
en: "shortlink <url>",
|
|
19
|
+
ar: "shortlink <الرابط>",
|
|
20
|
+
},
|
|
14
21
|
chat: "all", // This command can be used anywhere
|
|
22
|
+
neutralArgs: true, // a URL is not a language
|
|
15
23
|
|
|
16
24
|
async execute(sock, msg, args) {
|
|
17
25
|
// 1. Check if the user provided any arguments
|
|
18
26
|
if (!args || args.length === 0) {
|
|
19
27
|
return await sock.sendMessage(msg.key.remoteJid, {
|
|
20
|
-
text:
|
|
28
|
+
text: tr(
|
|
29
|
+
"Send the link you want to shorten.\n\n*Example:*\n`!shortlink https://github.com/WhiskeySockets/Baileys`",
|
|
30
|
+
"يرجى إرسال الرابط الذي تريد اختصاره.\n\n*مثال:*\n`!shortlink https://github.com/WhiskeySockets/Baileys`",
|
|
31
|
+
),
|
|
21
32
|
});
|
|
22
33
|
}
|
|
23
34
|
|
|
@@ -26,7 +37,10 @@ module.exports = {
|
|
|
26
37
|
// 2. Validate if the provided argument is a valid URL
|
|
27
38
|
if (!urlRegex.test(longUrl)) {
|
|
28
39
|
return await sock.sendMessage(msg.key.remoteJid, {
|
|
29
|
-
text:
|
|
40
|
+
text: tr(
|
|
41
|
+
"That link isn't valid. Make sure it starts with `http://` or `https://`.",
|
|
42
|
+
"الرابط الذي أرسلته غير صالح. يرجى التأكد من أنه يبدأ بـ `http://` أو `https://`.",
|
|
43
|
+
),
|
|
30
44
|
});
|
|
31
45
|
}
|
|
32
46
|
|
|
@@ -35,9 +49,14 @@ module.exports = {
|
|
|
35
49
|
const API_URL = `https://is.gd/create.php?format=simple&url=${encodeURIComponent(longUrl)}`;
|
|
36
50
|
|
|
37
51
|
// One message: "shortening..." becomes the short link itself.
|
|
38
|
-
const status = await createStatus(
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
const status = await createStatus(
|
|
53
|
+
sock,
|
|
54
|
+
msg.key.remoteJid,
|
|
55
|
+
tr("🔗 Shortening...", "🔗 بختصر الرابط..."),
|
|
56
|
+
{
|
|
57
|
+
replyTo: msg,
|
|
58
|
+
},
|
|
59
|
+
);
|
|
41
60
|
|
|
42
61
|
try {
|
|
43
62
|
// 4. Make the GET request to the API
|
|
@@ -46,7 +65,10 @@ module.exports = {
|
|
|
46
65
|
// 5. The API returns the shortened URL as plain text in the response body
|
|
47
66
|
const shortUrl = response.data;
|
|
48
67
|
|
|
49
|
-
const reply =
|
|
68
|
+
const reply = tr(
|
|
69
|
+
`✅ Link shortened!\n\n🔗 *Short link:*\n${shortUrl}`,
|
|
70
|
+
`✅ تم اختصار الرابط بنجاح!\n\n` + `🔗 *الرابط المختصر:*\n${shortUrl}`,
|
|
71
|
+
);
|
|
50
72
|
|
|
51
73
|
await status.finish(reply);
|
|
52
74
|
} catch (error) {
|
|
@@ -56,10 +78,14 @@ module.exports = {
|
|
|
56
78
|
);
|
|
57
79
|
|
|
58
80
|
// The API returns a plain text error message if something goes wrong
|
|
59
|
-
const errorMessage = error.response
|
|
81
|
+
const errorMessage = error.response
|
|
82
|
+
? error.response.data
|
|
83
|
+
: tr("Something unexpected went wrong.", "حدث خطأ غير متوقع.");
|
|
60
84
|
|
|
61
85
|
await sock.sendMessage(msg.key.remoteJid, {
|
|
62
|
-
text:
|
|
86
|
+
text:
|
|
87
|
+
tr(`*Sorry, something went wrong:*\n\n`, `*عذرًا، حدث خطأ:*\n\n`) +
|
|
88
|
+
`\`\`\`${errorMessage}\`\`\``,
|
|
63
89
|
});
|
|
64
90
|
}
|
|
65
91
|
},
|
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
const { delay } = require("@whiskeysockets/baileys");
|
|
3
3
|
const { exec } = require("child_process"); // 1. Import the 'exec' function
|
|
4
4
|
const logger = require("../utils/logger.cjs");
|
|
5
|
+
const { tr } = require("../utils/i18n.cjs");
|
|
5
6
|
|
|
6
7
|
module.exports = {
|
|
7
8
|
name: "shutdown",
|
|
8
|
-
description:
|
|
9
|
-
|
|
9
|
+
description: {
|
|
10
|
+
en: "Stops the bot process permanently (via PM2).",
|
|
11
|
+
ar: "يوقف عملية البوت نهائيًا (عبر PM2).",
|
|
12
|
+
},
|
|
13
|
+
usage: {
|
|
14
|
+
en: "shutdown",
|
|
15
|
+
ar: "shutdown",
|
|
16
|
+
},
|
|
10
17
|
chat: "all",
|
|
11
18
|
|
|
12
19
|
async execute(sock, msg) {
|
|
@@ -16,7 +23,10 @@ module.exports = {
|
|
|
16
23
|
|
|
17
24
|
// 2. Send a final message to the user before shutting down
|
|
18
25
|
await sock.sendMessage(msg.key.remoteJid, {
|
|
19
|
-
text:
|
|
26
|
+
text: tr(
|
|
27
|
+
"🔌 Shutdown received. Stopping the bot now... goodbye! 👋",
|
|
28
|
+
"🔌 تم استلام أمر الإيقاف النهائي. سيتم إيقاف البوت الآن... وداعًا! 👋",
|
|
29
|
+
),
|
|
20
30
|
});
|
|
21
31
|
|
|
22
32
|
// A small delay to ensure the WhatsApp message is sent out
|
package/src/commands/status.cjs
CHANGED
|
@@ -4,6 +4,7 @@ const os = require("os");
|
|
|
4
4
|
const baileysVersion = require("@whiskeysockets/baileys/package.json").version;
|
|
5
5
|
const logger = require("../utils/logger.cjs");
|
|
6
6
|
const { checkFfmpeg } = require("../utils/thumbnail.cjs");
|
|
7
|
+
const { tr } = require("../utils/i18n.cjs");
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* A helper function to format seconds into a human-readable string.
|
|
@@ -17,13 +18,19 @@ function formatUptime(seconds) {
|
|
|
17
18
|
const m = Math.floor((seconds % 3600) / 60);
|
|
18
19
|
const s = Math.floor(seconds % 60);
|
|
19
20
|
|
|
20
|
-
return `${d} يوم, ${h} ساعة, ${m} دقيقة, ${s}
|
|
21
|
+
return tr(`${d}d ${h}h ${m}m ${s}s`, `${d} يوم, ${h} ساعة, ${m} دقيقة, ${s} ثانية`);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
module.exports = {
|
|
24
25
|
name: "status",
|
|
25
|
-
description:
|
|
26
|
-
|
|
26
|
+
description: {
|
|
27
|
+
en: "Shows the bot's system status.",
|
|
28
|
+
ar: "يعرض حالة نظام البوت.",
|
|
29
|
+
},
|
|
30
|
+
usage: {
|
|
31
|
+
en: "status",
|
|
32
|
+
ar: "status",
|
|
33
|
+
},
|
|
27
34
|
chat: "all", // Can be used in any chat
|
|
28
35
|
|
|
29
36
|
async execute(sock, msg) {
|
|
@@ -50,25 +57,39 @@ module.exports = {
|
|
|
50
57
|
// binary is otherwise invisible.
|
|
51
58
|
const ffmpeg = await checkFfmpeg();
|
|
52
59
|
const ffmpegLine = ffmpeg.ok
|
|
53
|
-
? `✅ ${ffmpeg.version || "شغال"}`
|
|
54
|
-
: `❌ مش شغال (${ffmpeg.path})
|
|
60
|
+
? `✅ ${ffmpeg.version || tr("working", "شغال")}`
|
|
61
|
+
: tr(`❌ not working (${ffmpeg.path})`, `❌ مش شغال (${ffmpeg.path})`);
|
|
55
62
|
|
|
56
63
|
// --- BUILDING THE REPLY ---
|
|
57
|
-
const 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
|
+
`*🤖 حالة البوت 🤖*
|
|
58
75
|
|
|
59
76
|
*⏰ وقت التشغيل:* ${formattedUptime}
|
|
60
|
-
|
|
61
|
-
*🟢 Node.js
|
|
62
|
-
*📚 Baileys
|
|
77
|
+
*📊 استخدام الذاكرة:* ${rssMb} MB
|
|
78
|
+
*🟢 إصدار Node.js:* ${nodeVersion}
|
|
79
|
+
*📚 إصدار Baileys:* v${baileysVersion}
|
|
63
80
|
*💻 نظام التشغيل:* ${platform}
|
|
64
81
|
*💿 إصدار نظام التشغيل:* ${osRelease}
|
|
65
|
-
*🎞️ ffmpeg (الصور المصغرة):* ${ffmpegLine}
|
|
82
|
+
*🎞️ ffmpeg (الصور المصغرة):* ${ffmpegLine}`,
|
|
83
|
+
);
|
|
66
84
|
|
|
67
85
|
await sock.sendMessage(msg.key.remoteJid, { text: reply });
|
|
68
86
|
} catch (error) {
|
|
69
87
|
logger.error(error, "[Error] في أمر !status:");
|
|
70
88
|
await sock.sendMessage(msg.key.remoteJid, {
|
|
71
|
-
text:
|
|
89
|
+
text: tr(
|
|
90
|
+
"Something went wrong while reading the system status.",
|
|
91
|
+
"حدث خطأ أثناء جلب حالة النظام.",
|
|
92
|
+
),
|
|
72
93
|
});
|
|
73
94
|
}
|
|
74
95
|
},
|
package/src/commands/sticker.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const { spawn } = require("node:child_process");
|
|
|
6
6
|
const { downloadContentFromMessage } = require("@whiskeysockets/baileys");
|
|
7
7
|
const logger = require("../utils/logger.cjs");
|
|
8
8
|
const { ffmpegPath } = require("../utils/thumbnail.cjs");
|
|
9
|
+
const { tr } = require("../utils/i18n.cjs");
|
|
9
10
|
|
|
10
11
|
function runFfmpeg(args) {
|
|
11
12
|
return new Promise((resolve, reject) => {
|
|
@@ -48,8 +49,14 @@ async function streamToBuffer(stream) {
|
|
|
48
49
|
module.exports = {
|
|
49
50
|
name: "sticker",
|
|
50
51
|
aliases: ["s", "ملصق", "toimg", "tosticker"],
|
|
51
|
-
description:
|
|
52
|
-
|
|
52
|
+
description: {
|
|
53
|
+
en: "Turns images/videos into stickers, or stickers back into images/videos.",
|
|
54
|
+
ar: "يحوّل الصور والفيديوهات إلى ملصقات، أو الملصقات إلى صور وفيديوهات.",
|
|
55
|
+
},
|
|
56
|
+
usage: {
|
|
57
|
+
en: "sticker (reply to an image, video or sticker)\ntoimg (reply to a sticker)",
|
|
58
|
+
ar: "sticker (رد على صورة أو فيديو أو ملصق)\ntoimg (رد على ملصق)",
|
|
59
|
+
},
|
|
53
60
|
chat: "all",
|
|
54
61
|
|
|
55
62
|
async execute(sock, msg, args, body, groupMetadata, { invokedName } = {}) {
|
|
@@ -75,7 +82,10 @@ module.exports = {
|
|
|
75
82
|
await sock.sendMessage(
|
|
76
83
|
chatId,
|
|
77
84
|
{
|
|
78
|
-
text:
|
|
85
|
+
text: tr(
|
|
86
|
+
`🎨 *Sticker converter*\n\n• *Image/video ➔ sticker:* send or reply to an image or video with \`!sticker\` or \`!s\`\n• *Sticker ➔ image/video:* reply to any sticker with \`!toimg\` or \`!sticker\``,
|
|
87
|
+
`🎨 *محول الملصقات والوسائط*\n\n• *صورة/فيديو ➔ ملصق:* أرسل أو رد على صورة أو فيديو بـ \`!sticker\` أو \`!s\`\n• *ملصق ➔ صورة/فيديو:* رد على أي ملصق بـ \`!toimg\` أو \`!sticker\``,
|
|
88
|
+
),
|
|
79
89
|
},
|
|
80
90
|
{ quoted: msg },
|
|
81
91
|
);
|
|
@@ -93,7 +103,12 @@ module.exports = {
|
|
|
93
103
|
if (!stickerMsg) {
|
|
94
104
|
await sock.sendMessage(
|
|
95
105
|
chatId,
|
|
96
|
-
{
|
|
106
|
+
{
|
|
107
|
+
text: tr(
|
|
108
|
+
"Reply to a sticker to turn it into an image or video.",
|
|
109
|
+
"يرجى الرد على ملصق لتحويله إلى صورة أو فيديو.",
|
|
110
|
+
),
|
|
111
|
+
},
|
|
97
112
|
{ quoted: msg },
|
|
98
113
|
);
|
|
99
114
|
return;
|
|
@@ -128,7 +143,11 @@ module.exports = {
|
|
|
128
143
|
const videoBuffer = await fs.promises.readFile(outMp4);
|
|
129
144
|
await sock.sendMessage(
|
|
130
145
|
chatId,
|
|
131
|
-
{
|
|
146
|
+
{
|
|
147
|
+
video: videoBuffer,
|
|
148
|
+
gifPlayback: true,
|
|
149
|
+
caption: tr("✅ Sticker turned into a video/GIF", "✅ تم تحويل الملصق إلى فيديو/GIF"),
|
|
150
|
+
},
|
|
132
151
|
{ quoted: msg },
|
|
133
152
|
);
|
|
134
153
|
} else {
|
|
@@ -141,7 +160,10 @@ module.exports = {
|
|
|
141
160
|
const imageBuffer = await fs.promises.readFile(outJpg);
|
|
142
161
|
await sock.sendMessage(
|
|
143
162
|
chatId,
|
|
144
|
-
{
|
|
163
|
+
{
|
|
164
|
+
image: imageBuffer,
|
|
165
|
+
caption: tr("✅ Sticker turned into an image", "✅ تم تحويل الملصق إلى صورة"),
|
|
166
|
+
},
|
|
145
167
|
{ quoted: msg },
|
|
146
168
|
);
|
|
147
169
|
}
|
|
@@ -206,7 +228,12 @@ module.exports = {
|
|
|
206
228
|
logger.error({ err: err?.message }, "[Sticker] Conversion failed");
|
|
207
229
|
await sock.sendMessage(
|
|
208
230
|
chatId,
|
|
209
|
-
{
|
|
231
|
+
{
|
|
232
|
+
text: tr(
|
|
233
|
+
`❌ Conversion failed: ${err?.message || "unexpected error"}`,
|
|
234
|
+
`❌ فشل تحويل الوسائط: ${err?.message || "خطأ غير متوقع"}`,
|
|
235
|
+
),
|
|
236
|
+
},
|
|
210
237
|
{ quoted: msg },
|
|
211
238
|
);
|
|
212
239
|
} finally {
|