levix-bot 4.2.1 → 4.3.1
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/app.cjs +50 -4
- package/package.json +1 -1
- package/public/dashboard/assets/index-B6RhYFIy.js +446 -0
- package/public/dashboard/assets/index-vEwOcxiH.css +2 -0
- package/public/dashboard/index.html +2 -2
- package/public/dashboard.css +71 -1
- package/public/gateway.js +41 -0
- package/src/bootstrap/core.js +4 -0
- package/src/bootstrap/panel.js +2 -0
- package/src/commands/autoschedule.cjs +11 -14
- package/src/commands/blacklist.cjs +1 -1
- package/src/commands/block.cjs +1 -1
- package/src/commands/calc.cjs +9 -9
- package/src/commands/gemini.cjs +26 -26
- package/src/commands/group/add.cjs +2 -2
- package/src/commands/group/demote.cjs +2 -2
- package/src/commands/group/members.cjs +2 -2
- package/src/commands/group/rules.cjs +1 -1
- package/src/commands/group/setname.cjs +3 -3
- package/src/commands/group/setpp.cjs +3 -3
- package/src/commands/group/setrules.cjs +1 -1
- package/src/commands/group/tagadmins.cjs +1 -1
- package/src/commands/group.cjs +1 -1
- package/src/commands/lang.cjs +3 -3
- package/src/commands/listschedules.cjs +1 -1
- package/src/commands/loop.cjs +3 -3
- package/src/commands/memory.cjs +18 -18
- package/src/commands/notes.cjs +1 -1
- package/src/commands/perm.cjs +2 -2
- package/src/commands/poll.cjs +3 -3
- package/src/commands/rand.cjs +2 -2
- package/src/commands/restart.cjs +46 -17
- package/src/commands/schedule.cjs +9 -11
- package/src/commands/send.cjs +116 -0
- package/src/commands/status.cjs +2 -2
- package/src/commands/stopbot.cjs +68 -0
- package/src/commands/stt.cjs +1 -1
- package/src/commands/tts.cjs +2 -2
- package/src/commands/unblock.cjs +1 -1
- package/src/config/defaults.cjs +2 -1
- package/src/config/settings.cjs +4 -2
- package/src/core/session-holder.cjs +23 -0
- package/src/handlers/command.handler.js +4 -6
- package/src/panel/password-reset.cjs +187 -0
- package/src/routes/dashboard.api.esm.js +48 -78
- package/src/services/aiAgent.cjs +2 -2
- package/src/services/aiProviders.cjs +1 -1
- package/src/services/aiTools.cjs +27 -27
- package/src/services/settingsTransfer.cjs +246 -0
- package/src/utils/memory.cjs +7 -7
- package/views/login.ejs +209 -9
- package/views/setup.ejs +19 -5
- package/public/dashboard/assets/index-4AuqfnH5.js +0 -431
- package/public/dashboard/assets/index-LvfJ8ybs.css +0 -2
- package/src/commands/shutdown.cjs +0 -55
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
countSchedules,
|
|
27
27
|
countTodos,
|
|
28
28
|
countWarnings,
|
|
29
|
+
describePeer,
|
|
29
30
|
getAllGroupDirectory,
|
|
30
31
|
getAllGroupSettings,
|
|
31
32
|
getAllNotesFlat,
|
|
32
33
|
getAllTodos,
|
|
33
34
|
getAllUsers,
|
|
34
35
|
getAllWarnings,
|
|
35
|
-
describePeer,
|
|
36
36
|
getGroupDirectory,
|
|
37
37
|
getGroupSettings,
|
|
38
38
|
getRecentDebts,
|
|
@@ -68,11 +68,7 @@ const {
|
|
|
68
68
|
} = require("../../scheduler.cjs");
|
|
69
69
|
const { describeScheduledJob } = require("../utils/recurrence.cjs");
|
|
70
70
|
const { discoverProviderModels, DiscoveryError } = require("../services/llmDiscovery.cjs");
|
|
71
|
-
const
|
|
72
|
-
invalidateDiscoveryCache,
|
|
73
|
-
applyCapabilityGuards,
|
|
74
|
-
resolveCapabilities,
|
|
75
|
-
} = require("../services/modelRegistry.cjs");
|
|
71
|
+
const settingsTransfer = require("../services/settingsTransfer.cjs");
|
|
76
72
|
const cron = require("node-cron");
|
|
77
73
|
|
|
78
74
|
const router = Router();
|
|
@@ -301,76 +297,18 @@ router.get("/settings", (req, res) => {
|
|
|
301
297
|
|
|
302
298
|
router.patch("/settings", (req, res) => {
|
|
303
299
|
const { key } = req.body || {};
|
|
304
|
-
let { value } = req.body || {};
|
|
305
300
|
if (typeof key !== "string" || !key) return badRequest(res, "key is required");
|
|
306
301
|
|
|
307
302
|
try {
|
|
308
303
|
if (key === "prefix") {
|
|
309
|
-
const prefix = runtimeConfig.setPrefix(value);
|
|
304
|
+
const prefix = runtimeConfig.setPrefix(req.body?.value);
|
|
310
305
|
return res.json({ success: true, prefix });
|
|
311
306
|
}
|
|
312
307
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
? "gemini_model"
|
|
318
|
-
: provider === "anthropic"
|
|
319
|
-
? "anthropic_model"
|
|
320
|
-
: "openai_model";
|
|
321
|
-
const resolved = resolveCapabilities(provider, settings.get(modelKey));
|
|
322
|
-
const next = applyCapabilityGuards({
|
|
323
|
-
visionEnabled: key === "ai_vision_enabled" ? value : settings.get("ai_vision_enabled"),
|
|
324
|
-
sttEnabled: key === "ai_stt_enabled" ? value : settings.get("ai_stt_enabled"),
|
|
325
|
-
capabilities: resolved.capabilities,
|
|
326
|
-
capabilitySource: resolved.capabilitySource,
|
|
327
|
-
autoDetect: settings.get("ai_auto_detect_capabilities"),
|
|
328
|
-
});
|
|
329
|
-
if (key === "ai_vision_enabled") value = next.visionEnabled;
|
|
330
|
-
if (key === "ai_stt_enabled") value = next.sttEnabled;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
settings.set(key, value);
|
|
334
|
-
if (typeof key === "string" && (key.includes("api_key") || key.includes("base_url"))) {
|
|
335
|
-
const prov = key.startsWith("gemini")
|
|
336
|
-
? "gemini"
|
|
337
|
-
: key.startsWith("anthropic")
|
|
338
|
-
? "anthropic"
|
|
339
|
-
: key.startsWith("openai")
|
|
340
|
-
? "openai"
|
|
341
|
-
: null;
|
|
342
|
-
if (prov) invalidateDiscoveryCache(prov);
|
|
343
|
-
else invalidateDiscoveryCache();
|
|
344
|
-
}
|
|
345
|
-
if (
|
|
346
|
-
key === "ai_provider" ||
|
|
347
|
-
key === "gemini_model" ||
|
|
348
|
-
key === "openai_model" ||
|
|
349
|
-
key === "anthropic_model"
|
|
350
|
-
) {
|
|
351
|
-
const provider = key === "ai_provider" ? String(value || "gemini") : key.split("_")[0];
|
|
352
|
-
const modelKey =
|
|
353
|
-
provider === "gemini"
|
|
354
|
-
? "gemini_model"
|
|
355
|
-
: provider === "anthropic"
|
|
356
|
-
? "anthropic_model"
|
|
357
|
-
: "openai_model";
|
|
358
|
-
const modelId = key.endsWith("_model") ? value : settings.get(modelKey);
|
|
359
|
-
const resolved = resolveCapabilities(provider, modelId);
|
|
360
|
-
const next = applyCapabilityGuards({
|
|
361
|
-
visionEnabled: settings.get("ai_vision_enabled"),
|
|
362
|
-
sttEnabled: settings.get("ai_stt_enabled"),
|
|
363
|
-
capabilities: resolved.capabilities,
|
|
364
|
-
capabilitySource: resolved.capabilitySource,
|
|
365
|
-
autoDetect: settings.get("ai_auto_detect_capabilities"),
|
|
366
|
-
});
|
|
367
|
-
if (Boolean(settings.get("ai_vision_enabled")) !== next.visionEnabled) {
|
|
368
|
-
settings.set("ai_vision_enabled", next.visionEnabled);
|
|
369
|
-
}
|
|
370
|
-
if (Boolean(settings.get("ai_stt_enabled")) !== next.sttEnabled) {
|
|
371
|
-
settings.set("ai_stt_enabled", next.sttEnabled);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
308
|
+
// Capability guards, discovery-cache drops and the save itself live in one
|
|
309
|
+
// place the import route shares (settingsTransfer.applySettingChange), so
|
|
310
|
+
// a hand edit and a shared file can't drift apart.
|
|
311
|
+
settingsTransfer.applySettingChange(key, req.body?.value);
|
|
374
312
|
return res.json({
|
|
375
313
|
success: true,
|
|
376
314
|
// Never echo a value back: for a secret that would hand it to anyone who
|
|
@@ -382,6 +320,37 @@ router.patch("/settings", (req, res) => {
|
|
|
382
320
|
}
|
|
383
321
|
});
|
|
384
322
|
|
|
323
|
+
// --- Share settings --------------------------------------------------------
|
|
324
|
+
//
|
|
325
|
+
// The file a friend can load: every non-secret override (settingsTransfer
|
|
326
|
+
// owns what is in and what stays out). The import applies what it understands
|
|
327
|
+
// and reports the rest, so a file from a different version never half-kills
|
|
328
|
+
// an install in silence.
|
|
329
|
+
|
|
330
|
+
// (no per-route no-store needed: the /dashboard/api mount already sets it)
|
|
331
|
+
router.get("/settings/export", (req, res) => {
|
|
332
|
+
try {
|
|
333
|
+
const payload = settingsTransfer.exportSettings();
|
|
334
|
+
const date = payload.exportedAt.slice(0, 10);
|
|
335
|
+
res.set("Content-Type", "application/json; charset=utf-8");
|
|
336
|
+
res.set("Content-Disposition", `attachment; filename="levix-settings-${date}.json"`);
|
|
337
|
+
return res.json(payload);
|
|
338
|
+
} catch (error) {
|
|
339
|
+
return fail(res, error, "Error exporting settings");
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
router.post("/settings/import", (req, res) => {
|
|
344
|
+
try {
|
|
345
|
+
const report = settingsTransfer.applyImport(req.body || {});
|
|
346
|
+
// Aliases and disabled commands are cached in the dispatcher's index.
|
|
347
|
+
rebuildCommandIndex();
|
|
348
|
+
return res.json({ success: true, ...report });
|
|
349
|
+
} catch (error) {
|
|
350
|
+
return badRequest(res, error.message);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
385
354
|
// ===========================================================================
|
|
386
355
|
// AI — the editable system prompt and the long-term memory files
|
|
387
356
|
// ===========================================================================
|
|
@@ -659,7 +628,12 @@ async function getChatConversationAsync(chatId) {
|
|
|
659
628
|
if (messages.length >= MAX_INSPECTOR_MESSAGES) break;
|
|
660
629
|
}
|
|
661
630
|
|
|
662
|
-
return {
|
|
631
|
+
return {
|
|
632
|
+
chatId,
|
|
633
|
+
updatedAt: meta.updatedAt ?? null,
|
|
634
|
+
truncated: messages.length >= MAX_INSPECTOR_MESSAGES,
|
|
635
|
+
messages,
|
|
636
|
+
};
|
|
663
637
|
}
|
|
664
638
|
|
|
665
639
|
// ===========================================================================
|
|
@@ -671,15 +645,10 @@ function groupView(groupId, stored) {
|
|
|
671
645
|
const directory = getGroupDirectory(groupId) || null;
|
|
672
646
|
const config = stored || {};
|
|
673
647
|
const subject = live?.subject || directory?.subject || null;
|
|
674
|
-
const memberCount =
|
|
675
|
-
live?.participants?.length ?? directory?.participant_count ?? null;
|
|
648
|
+
const memberCount = live?.participants?.length ?? directory?.participant_count ?? null;
|
|
676
649
|
const mediaEnabled = !!config.media_control?.enabled;
|
|
677
650
|
const blocked = config.media_control?.blocked_types || [];
|
|
678
|
-
const mediaRestriction = !mediaEnabled
|
|
679
|
-
? "none"
|
|
680
|
-
: blocked.length >= 4
|
|
681
|
-
? "block_all"
|
|
682
|
-
: "custom";
|
|
651
|
+
const mediaRestriction = !mediaEnabled ? "none" : blocked.length >= 4 ? "block_all" : "custom";
|
|
683
652
|
|
|
684
653
|
return {
|
|
685
654
|
id: groupId,
|
|
@@ -1185,7 +1154,8 @@ router.post("/security/password", (req, res) => {
|
|
|
1185
1154
|
clearAttempts(peer);
|
|
1186
1155
|
stampPanelSession(req.session);
|
|
1187
1156
|
req.session.save((err) => {
|
|
1188
|
-
if (err)
|
|
1157
|
+
if (err)
|
|
1158
|
+
return res.status(500).json({ success: false, error: "Could not refresh the session" });
|
|
1189
1159
|
try {
|
|
1190
1160
|
const { disconnectInvalidPanelSockets } = require("../../app.cjs");
|
|
1191
1161
|
disconnectInvalidPanelSockets();
|
package/src/services/aiAgent.cjs
CHANGED
|
@@ -502,7 +502,7 @@ async function runGeminiTurn({
|
|
|
502
502
|
search = null,
|
|
503
503
|
} = {}) {
|
|
504
504
|
const genAI = geminiClient();
|
|
505
|
-
if (!genAI) throw new Error(tr("No Gemini API key is set", "
|
|
505
|
+
if (!genAI) throw new Error(tr("No Gemini API key is set", "لم يُضبط مفتاح Gemini API"));
|
|
506
506
|
await assertProviderRequestUrl(settings.get("gemini_base_url"), { allowLoopback: true });
|
|
507
507
|
|
|
508
508
|
const stepBudget = maxSteps ?? settings.get("ai_max_tool_steps");
|
|
@@ -622,7 +622,7 @@ async function runGeminiTurn({
|
|
|
622
622
|
if (!text && steps >= stepBudget) {
|
|
623
623
|
text = tr(
|
|
624
624
|
"I ran the tools I have but couldn't reach a final answer. Try asking more clearly.",
|
|
625
|
-
"
|
|
625
|
+
"استخدمت الأدوات المتاحة، لكنني لم أتمكن من الوصول إلى إجابة نهائية. حاول صياغة السؤال بوضوح أكبر.",
|
|
626
626
|
);
|
|
627
627
|
}
|
|
628
628
|
|
|
@@ -757,7 +757,7 @@ async function runProviderAgent(
|
|
|
757
757
|
parsed.text ||
|
|
758
758
|
tr(
|
|
759
759
|
"I ran the tools I have but couldn't reach a final answer. Try asking more clearly.",
|
|
760
|
-
"
|
|
760
|
+
"استخدمت الأدوات المتاحة، لكنني لم أتمكن من الوصول إلى إجابة نهائية. حاول صياغة السؤال بوضوح أكبر.",
|
|
761
761
|
),
|
|
762
762
|
canonical,
|
|
763
763
|
toolCalls,
|
package/src/services/aiTools.cjs
CHANGED
|
@@ -244,14 +244,14 @@ async function assertPublicUrl(rawUrl) {
|
|
|
244
244
|
try {
|
|
245
245
|
url = new URL(rawUrl);
|
|
246
246
|
} catch {
|
|
247
|
-
throw new Error("الرابط
|
|
247
|
+
throw new Error("الرابط غير صالح");
|
|
248
248
|
}
|
|
249
|
-
if (url.protocol !== "https:") throw new Error("
|
|
249
|
+
if (url.protocol !== "https:") throw new Error("يُسمح بروابط HTTPS فقط");
|
|
250
250
|
|
|
251
251
|
const host = url.hostname.replace(/^\[|\]$/g, "");
|
|
252
252
|
|
|
253
253
|
if (net.isIP(host)) {
|
|
254
|
-
if (isForbiddenIp(host)) throw new Error("الرابط
|
|
254
|
+
if (isForbiddenIp(host)) throw new Error("هذا الرابط محظور");
|
|
255
255
|
return { url, host, addresses: [{ address: host, family: net.isIP(host) }] };
|
|
256
256
|
}
|
|
257
257
|
|
|
@@ -259,10 +259,10 @@ async function assertPublicUrl(rawUrl) {
|
|
|
259
259
|
try {
|
|
260
260
|
addresses = await dns.lookup(host, { all: true, verbatim: true });
|
|
261
261
|
} catch {
|
|
262
|
-
throw new Error("
|
|
262
|
+
throw new Error("تعذّر الوصول إلى هذا النطاق");
|
|
263
263
|
}
|
|
264
264
|
if (!addresses.length || addresses.some((a) => isForbiddenIp(a.address))) {
|
|
265
|
-
throw new Error("الرابط
|
|
265
|
+
throw new Error("هذا الرابط محظور");
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
return { url, host, addresses };
|
|
@@ -281,7 +281,7 @@ function pinnedAgent(expectedHost, addresses) {
|
|
|
281
281
|
? addresses.filter(({ family }) => family === requestedFamily)
|
|
282
282
|
: addresses;
|
|
283
283
|
if (!candidates.length) {
|
|
284
|
-
const error = new Error("
|
|
284
|
+
const error = new Error("لا يوجد عنوان متوافق لهذا النطاق");
|
|
285
285
|
error.code = "EAI_ADDRFAMILY";
|
|
286
286
|
return callback(error);
|
|
287
287
|
}
|
|
@@ -328,7 +328,7 @@ async function fetchUrl(rawUrl) {
|
|
|
328
328
|
const location = response.headers?.location;
|
|
329
329
|
const isRedirect = response.status >= 300 && response.status < 400 && location;
|
|
330
330
|
if (!isRedirect) break;
|
|
331
|
-
if (hop >= MAX_REDIRECTS) throw new Error("الرابط
|
|
331
|
+
if (hop >= MAX_REDIRECTS) throw new Error("تجاوز الرابط الحد المسموح لعمليات إعادة التوجيه");
|
|
332
332
|
|
|
333
333
|
target = await assertPublicUrl(new URL(location, url).toString());
|
|
334
334
|
}
|
|
@@ -405,7 +405,7 @@ const TOOLS = {
|
|
|
405
405
|
required: ["query"],
|
|
406
406
|
},
|
|
407
407
|
},
|
|
408
|
-
describe: (args) => `🔍
|
|
408
|
+
describe: (args) => `🔍 جارٍ البحث عن: ${preview(args?.query, 50)}`,
|
|
409
409
|
describeEn: (args) => `🔍 Searching for: ${preview(args?.query, 50)}`,
|
|
410
410
|
async run(args) {
|
|
411
411
|
const query = String(args?.query || "").trim();
|
|
@@ -446,7 +446,7 @@ const TOOLS = {
|
|
|
446
446
|
required: ["query"],
|
|
447
447
|
},
|
|
448
448
|
},
|
|
449
|
-
describe: (args) => `📚
|
|
449
|
+
describe: (args) => `📚 جارٍ البحث في ويكيبيديا: ${preview(args?.query, 45)}`,
|
|
450
450
|
describeEn: (args) => `📚 Searching Wikipedia: ${preview(args?.query, 45)}`,
|
|
451
451
|
async run(args) {
|
|
452
452
|
const query = String(args?.query || "").trim();
|
|
@@ -476,7 +476,7 @@ const TOOLS = {
|
|
|
476
476
|
required: ["query"],
|
|
477
477
|
},
|
|
478
478
|
},
|
|
479
|
-
describe: (args) => `📰
|
|
479
|
+
describe: (args) => `📰 جارٍ البحث عن الأخبار: ${preview(args?.query, 45)}`,
|
|
480
480
|
describeEn: (args) => `📰 Searching news: ${preview(args?.query, 45)}`,
|
|
481
481
|
async run(args) {
|
|
482
482
|
const query = String(args?.query || "").trim();
|
|
@@ -505,7 +505,7 @@ const TOOLS = {
|
|
|
505
505
|
required: ["url"],
|
|
506
506
|
},
|
|
507
507
|
},
|
|
508
|
-
describe: (args) => `🌐
|
|
508
|
+
describe: (args) => `🌐 جارٍ فتح الرابط: ${preview(args?.url, 45)}`,
|
|
509
509
|
describeEn: (args) => `🌐 Opening link: ${preview(args?.url, 45)}`,
|
|
510
510
|
async run(args) {
|
|
511
511
|
const url = String(args?.url || "").trim();
|
|
@@ -518,7 +518,7 @@ const TOOLS = {
|
|
|
518
518
|
declaration: {
|
|
519
519
|
name: "save_memory",
|
|
520
520
|
description:
|
|
521
|
-
"Save a fact to long-term memory so it survives across conversations. Use it whenever the user says things like 'save this', 'remember that', 'احفظ
|
|
521
|
+
"Save a fact to long-term memory so it survives across conversations. Use it whenever the user says things like 'save this', 'remember that', 'احفظ هذا في ذاكرتك'. scope 'chat' keeps it to this conversation, scope 'global' shares it with every chat.",
|
|
522
522
|
parameters: {
|
|
523
523
|
type: T.OBJECT,
|
|
524
524
|
properties: {
|
|
@@ -535,7 +535,7 @@ const TOOLS = {
|
|
|
535
535
|
},
|
|
536
536
|
},
|
|
537
537
|
describe: (args) =>
|
|
538
|
-
`🧠
|
|
538
|
+
`🧠 جارٍ الحفظ في ${scopeOf(args) === "global" ? "الذاكرة العامة" : "ذاكرة المحادثة"}: ${preview(
|
|
539
539
|
args?.content,
|
|
540
540
|
)}`,
|
|
541
541
|
describeEn: (args) =>
|
|
@@ -585,7 +585,7 @@ const TOOLS = {
|
|
|
585
585
|
},
|
|
586
586
|
},
|
|
587
587
|
},
|
|
588
|
-
describe: () => "🧠
|
|
588
|
+
describe: () => "🧠 جارٍ البحث في الذاكرة...",
|
|
589
589
|
describeEn: () => "🧠 Searching memory...",
|
|
590
590
|
// `!memory search` reads both scopes for anyone who may run `!memory`.
|
|
591
591
|
access: { command: "memory" },
|
|
@@ -619,7 +619,7 @@ const TOOLS = {
|
|
|
619
619
|
required: ["ref"],
|
|
620
620
|
},
|
|
621
621
|
},
|
|
622
|
-
describe: (args) => `🗑️
|
|
622
|
+
describe: (args) => `🗑️ جارٍ الحذف من الذاكرة: ${preview(args?.ref)}`,
|
|
623
623
|
describeEn: (args) => `🗑️ Removing from memory: ${preview(args?.ref)}`,
|
|
624
624
|
// `!memory forget`: global needs the owner or a bot admin; chat memory
|
|
625
625
|
// also lets an admin of this group tidy their own chat.
|
|
@@ -659,7 +659,7 @@ const TOOLS = {
|
|
|
659
659
|
},
|
|
660
660
|
},
|
|
661
661
|
describe: (args) =>
|
|
662
|
-
`🔑
|
|
662
|
+
`🔑 جارٍ فحص صلاحيات: ${preview(args?.target, 25)} (${args?.role || "admin"})`,
|
|
663
663
|
describeEn: (args) =>
|
|
664
664
|
`🔑 Checking permissions: ${preview(args?.target, 25)} (${args?.role || "admin"})`,
|
|
665
665
|
// `!perm add`: that command's level (owner only unless the operator
|
|
@@ -699,7 +699,7 @@ const TOOLS = {
|
|
|
699
699
|
required: ["target"],
|
|
700
700
|
},
|
|
701
701
|
},
|
|
702
|
-
describe: (args) => `🔑
|
|
702
|
+
describe: (args) => `🔑 جارٍ سحب الصلاحية من: ${preview(args?.target, 25)}`,
|
|
703
703
|
describeEn: (args) => `🔑 Revoking permissions from: ${preview(args?.target, 25)}`,
|
|
704
704
|
// `!perm remove`, gated exactly like grant_role.
|
|
705
705
|
access: (args) => ({ command: "perm", role: roleOf(args) === "owner" ? "owner" : undefined }),
|
|
@@ -723,7 +723,7 @@ const TOOLS = {
|
|
|
723
723
|
"List who currently holds bot owner / admin roles. Allowed for whoever may run !perm (the owner, by default).",
|
|
724
724
|
parameters: { type: T.OBJECT, properties: {} },
|
|
725
725
|
},
|
|
726
|
-
describe: () => "🔑
|
|
726
|
+
describe: () => "🔑 جارٍ جلب قائمة الصلاحيات...",
|
|
727
727
|
describeEn: () => "🔑 Fetching roles list...",
|
|
728
728
|
// `!perm list` — the roster is `!perm`'s to show.
|
|
729
729
|
access: { command: "perm" },
|
|
@@ -753,7 +753,7 @@ const TOOLS = {
|
|
|
753
753
|
},
|
|
754
754
|
},
|
|
755
755
|
},
|
|
756
|
-
describe: () => "🕒
|
|
756
|
+
describe: () => "🕒 جارٍ التحقق من الوقت الحالي...",
|
|
757
757
|
describeEn: () => "🕒 Checking current time...",
|
|
758
758
|
async run(args) {
|
|
759
759
|
const timeZone = args?.timezone || settings.get("bot_timezone");
|
|
@@ -788,7 +788,7 @@ const TOOLS = {
|
|
|
788
788
|
required: ["expression"],
|
|
789
789
|
},
|
|
790
790
|
},
|
|
791
|
-
describe: (args) => `🧮
|
|
791
|
+
describe: (args) => `🧮 جارٍ الحساب: ${preview(args?.expression, 40)}`,
|
|
792
792
|
describeEn: (args) => `🧮 Calculating: ${preview(args?.expression, 40)}`,
|
|
793
793
|
async run(args) {
|
|
794
794
|
const expression = String(args?.expression || "").trim();
|
|
@@ -829,7 +829,7 @@ const TOOLS = {
|
|
|
829
829
|
required: ["message"],
|
|
830
830
|
},
|
|
831
831
|
},
|
|
832
|
-
describe: (args) => `⏰
|
|
832
|
+
describe: (args) => `⏰ جارٍ إعداد التذكير: ${preview(args?.message, 40)}`,
|
|
833
833
|
describeEn: (args) => `⏰ Setting a reminder: ${preview(args?.message, 40)}`,
|
|
834
834
|
// Posting into a chat at a later time is exactly what `!schedule` does, so
|
|
835
835
|
// it takes `!schedule`'s permission level — whatever the dashboard sets.
|
|
@@ -911,7 +911,7 @@ const TOOLS = {
|
|
|
911
911
|
required: ["id"],
|
|
912
912
|
},
|
|
913
913
|
},
|
|
914
|
-
describe: (args) => `⏰
|
|
914
|
+
describe: (args) => `⏰ جارٍ إلغاء التذكير: ${preview(args?.id, 20)}`,
|
|
915
915
|
describeEn: (args) => `⏰ Cancelling reminder: ${preview(args?.id, 20)}`,
|
|
916
916
|
// Deleting a scheduled job is `!deleteschedule`'s job, so its level.
|
|
917
917
|
access: { command: "deleteschedule" },
|
|
@@ -937,7 +937,7 @@ const TOOLS = {
|
|
|
937
937
|
declaration: {
|
|
938
938
|
name: "speak",
|
|
939
939
|
description:
|
|
940
|
-
"Send your answer as a WhatsApp VOICE NOTE (text-to-speech) instead of text. Only when the user explicitly asks to hear it — '
|
|
940
|
+
"Send your answer as a WhatsApp VOICE NOTE (text-to-speech) instead of text. Only when the user explicitly asks to hear it — 'اقرأها بصوت', 'read it aloud', 'send it as voice'. The text must be ready to be read aloud; keep it short.",
|
|
941
941
|
parameters: {
|
|
942
942
|
type: T.OBJECT,
|
|
943
943
|
properties: {
|
|
@@ -953,7 +953,7 @@ const TOOLS = {
|
|
|
953
953
|
required: ["text"],
|
|
954
954
|
},
|
|
955
955
|
},
|
|
956
|
-
describe: (args) => `🎙️
|
|
956
|
+
describe: (args) => `🎙️ جارٍ تحويل الرد لرسالة صوتية: ${preview(args?.text, 40)}`,
|
|
957
957
|
describeEn: (args) => `🎙️ Converting the reply to a voice note: ${preview(args?.text, 40)}`,
|
|
958
958
|
// Posting a voice note into this chat is what `!tts` does, so its level.
|
|
959
959
|
access: { command: "tts" },
|
|
@@ -1003,7 +1003,7 @@ const TOOLS = {
|
|
|
1003
1003
|
required: ["question", "options"],
|
|
1004
1004
|
},
|
|
1005
1005
|
},
|
|
1006
|
-
describe: (args) => `📊
|
|
1006
|
+
describe: (args) => `📊 جارٍ إنشاء الاستفتاء: ${preview(args?.question, 40)}`,
|
|
1007
1007
|
describeEn: (args) => `📊 Creating a poll: ${preview(args?.question, 40)}`,
|
|
1008
1008
|
// A poll is a group message like any other, so `!poll`'s level.
|
|
1009
1009
|
access: { command: "poll" },
|
|
@@ -1042,7 +1042,7 @@ const TOOLS = {
|
|
|
1042
1042
|
},
|
|
1043
1043
|
},
|
|
1044
1044
|
},
|
|
1045
|
-
describe: () => "🧠
|
|
1045
|
+
describe: () => "🧠 جارٍ تلخيص المحادثة وحفظ المهم...",
|
|
1046
1046
|
describeEn: () => "🧠 Summarizing the chat and saving what matters...",
|
|
1047
1047
|
// Saving chat memory is what `!memory add` allows here; the global scope
|
|
1048
1048
|
// reaches every chat's prompt, so it takes save_memory's owner/admin role.
|
|
@@ -1171,7 +1171,7 @@ async function summarizeWithProvider(transcript) {
|
|
|
1171
1171
|
function describeCall(name, args, lang = currentLang()) {
|
|
1172
1172
|
const tool = TOOLS[name];
|
|
1173
1173
|
const isEn = lang === "en";
|
|
1174
|
-
const fallback = isEn ? `⚙️ Running: ${name}` : `⚙️
|
|
1174
|
+
const fallback = isEn ? `⚙️ Running: ${name}` : `⚙️ جارٍ تشغيل: ${name}`;
|
|
1175
1175
|
if (!tool) return fallback;
|
|
1176
1176
|
try {
|
|
1177
1177
|
if (isEn && typeof tool.describeEn === "function") {
|