halbot 1990.1.68 → 1990.1.70
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halbot",
|
|
3
3
|
"description": "Just another ChatGPT/Bing Chat Telegram bob, which is simple design, easy to use, extendable and fun.",
|
|
4
|
-
"version": "1990.1.
|
|
4
|
+
"version": "1990.1.70",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"jsdom": "^21.1.1",
|
|
40
40
|
"mysql2": "^3.2.1",
|
|
41
41
|
"telegraf": "^4.12.2",
|
|
42
|
-
"utilitas": "^1994.0.
|
|
42
|
+
"utilitas": "^1994.0.7",
|
|
43
43
|
"youtube-transcript": "^1.0.5"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -4,27 +4,29 @@ const ACP = '[🧠 Awesome ChatGPT Prompts](https://github.com/f/awesome-chatgpt
|
|
|
4
4
|
|
|
5
5
|
const action = async (ctx, next) => {
|
|
6
6
|
ctx.session.prompts || (ctx.session.prompts = {});
|
|
7
|
-
|
|
7
|
+
const cmd = ctx.cmd?.cmd;
|
|
8
|
+
switch (cmd) {
|
|
8
9
|
case 'prompts':
|
|
9
10
|
const prompts = bot.lines2(Object.keys(ctx.session.prompts || {}).map(
|
|
10
11
|
x => bot.lines([`- /${x}`, ctx.session.prompts[x]])
|
|
11
12
|
));
|
|
12
|
-
await ctx.ok(prompts || 'No custom prompts.');
|
|
13
|
-
break;
|
|
13
|
+
return await ctx.ok(prompts || 'No custom prompts.');
|
|
14
14
|
case 'add':
|
|
15
15
|
const arrText = (ctx.cmd.args || '').split('\n');
|
|
16
16
|
const subArrText = arrText[0].split('>');
|
|
17
|
-
const
|
|
17
|
+
const _cmd = utilitas.ensureString(
|
|
18
18
|
subArrText[0], { case: 'SNAKE' }
|
|
19
19
|
).slice(0, bot.MAX_MENU_LENGTH);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const _prompt = bot.lines([
|
|
21
|
+
subArrText.slice(1).join(' '), ...arrText.slice(1)
|
|
22
|
+
]).trim();
|
|
23
|
+
if (_cmd && _prompt) {
|
|
24
|
+
ctx.session.prompts[_cmd] = _prompt;
|
|
25
|
+
await ctx.ok(`Prompt added: /${_cmd}`);
|
|
24
26
|
} else {
|
|
25
27
|
await ctx.ok('Invalid command or prompt.');
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
return;
|
|
28
30
|
case 'del':
|
|
29
31
|
if (ctx.session.prompts[ctx.cmd.args]) {
|
|
30
32
|
delete ctx.session.prompts[ctx.cmd.args];
|
|
@@ -32,13 +34,12 @@ const action = async (ctx, next) => {
|
|
|
32
34
|
} else {
|
|
33
35
|
await ctx.ok('Prompt not found.');
|
|
34
36
|
}
|
|
35
|
-
|
|
37
|
+
return;
|
|
36
38
|
case 'acplist':
|
|
37
39
|
const list = bot.uList(Object.keys(ctx._.prompts || {}).map(
|
|
38
40
|
x => `/${ctx._.prompts[x].command}: ${ctx._.prompts[x].act}`
|
|
39
41
|
));
|
|
40
|
-
await ctx.ok(list || 'Data not found.');
|
|
41
|
-
break;
|
|
42
|
+
return await ctx.ok(list || 'Data not found.');
|
|
42
43
|
case 'acpdetail':
|
|
43
44
|
const details = bot.lines2(Object.keys(ctx._.prompts || {}).map(
|
|
44
45
|
x => bot.lines([
|
|
@@ -46,18 +47,21 @@ const action = async (ctx, next) => {
|
|
|
46
47
|
ctx._.prompts[x].prompt
|
|
47
48
|
])
|
|
48
49
|
));
|
|
49
|
-
await ctx.ok(details || 'Data not found.');
|
|
50
|
-
break;
|
|
50
|
+
return await ctx.ok(details || 'Data not found.');
|
|
51
51
|
case 'clear':
|
|
52
52
|
ctx.clear();
|
|
53
|
-
await next();
|
|
54
53
|
break;
|
|
54
|
+
default:
|
|
55
|
+
const prompt = ctx.session.prompts?.[cmd] || ctx._.prompts?.[cmd]?.prompt;
|
|
56
|
+
!ctx.context && prompt && (ctx.context = { cmd, prompt });
|
|
57
|
+
ctx.context && ctx.clear(ctx.context);
|
|
55
58
|
}
|
|
59
|
+
await next();
|
|
56
60
|
};
|
|
57
61
|
|
|
58
|
-
export const { run, priority, func, help, cmds } = {
|
|
62
|
+
export const { run, priority, func, help, cmds, cmdx } = {
|
|
59
63
|
run: true,
|
|
60
|
-
priority:
|
|
64
|
+
priority: 40,
|
|
61
65
|
func: action,
|
|
62
66
|
help: bot.lines([
|
|
63
67
|
'¶ Maintain custom prompts.',
|
|
@@ -73,4 +77,5 @@ export const { run, priority, func, help, cmds } = {
|
|
|
73
77
|
acpdetail: `Show details of ${ACP}.`,
|
|
74
78
|
clear: 'Clear current AI conversation session and start a new one.',
|
|
75
79
|
},
|
|
80
|
+
cmdx: {},
|
|
76
81
|
};
|
|
@@ -63,6 +63,10 @@ const action = async (ctx, next) => {
|
|
|
63
63
|
await ok();
|
|
64
64
|
// ctx.responses = msgs; // save responses-to-user for next middleware
|
|
65
65
|
ctx.tts = packMsg({ tts: true });
|
|
66
|
+
// match for session rendering
|
|
67
|
+
ctx.selectedAi.map(n => ['response', 'responseRendered'].map(k =>
|
|
68
|
+
ctx.session.latest[n][k] = ctx.session.latest[n][k].replaceAll('`', '')
|
|
69
|
+
));
|
|
66
70
|
await next();
|
|
67
71
|
};
|
|
68
72
|
|
package/skills/50_execute.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const action = async (ctx, next) => {
|
|
3
|
-
const cmd = ctx.cmd?.cmd;
|
|
4
|
-
if (!ctx.context) {
|
|
5
|
-
const prompt = ctx.session.prompts?.[cmd] || ctx._.prompts?.[cmd]?.prompt;
|
|
6
|
-
prompt && (ctx.context = { cmd, prompt });
|
|
7
|
-
}
|
|
8
|
-
ctx.context && ctx.clear(ctx.context);
|
|
9
|
-
await next();
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const { run, priority, func } = {
|
|
13
|
-
run: true,
|
|
14
|
-
priority: 50,
|
|
15
|
-
func: action,
|
|
16
|
-
};
|
|
File without changes
|