halbot 1993.2.83 → 1993.2.85
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/lib/hal.mjs +11 -8
- package/package.json +1 -1
- package/skills/-8845_thread.mjs +4 -4
- package/skills/20_instant.mjs +5 -10
package/lib/hal.mjs
CHANGED
|
@@ -286,7 +286,7 @@ const memorize = async (ctx) => {
|
|
|
286
286
|
const subconscious = [{
|
|
287
287
|
run: true, priority: -8960, name: 'broca', func: async (ctx, next) => {
|
|
288
288
|
const e = `Event: ${ctx.update.update_id} => ${JSON.stringify(ctx.update)}`;
|
|
289
|
-
process.stdout.write(`[
|
|
289
|
+
process.stdout.write(`[HAL] ${e}\n`);
|
|
290
290
|
log(e);
|
|
291
291
|
ctx.done = [];
|
|
292
292
|
ctx.collected = [];
|
|
@@ -437,7 +437,9 @@ const subconscious = [{
|
|
|
437
437
|
ctx.entities = [
|
|
438
438
|
...(ctx.m.entities || []).map(e => ({ ...e, text: ctx.m.text })),
|
|
439
439
|
...(ctx.m.caption_entities || []).map(e => ({ ...e, text: ctx.m.caption })),
|
|
440
|
-
...(ctx.m.reply_to_message?.entities || []).
|
|
440
|
+
...(ctx.m.reply_to_message?.entities || []).filter(
|
|
441
|
+
x => x?.type !== bot_command
|
|
442
|
+
).map(e => ({ ...e, text: ctx.m.reply_to_message.text })),
|
|
441
443
|
].map(e => ({
|
|
442
444
|
...e, matched: e.text.substring(e.offset, e.offset + e.length),
|
|
443
445
|
...e.type === 'text_link' ? { type: 'url', matched: e.url } : {},
|
|
@@ -449,7 +451,8 @@ const subconscious = [{
|
|
|
449
451
|
case bot_command: target = e.matched.split('@')[1]; break;
|
|
450
452
|
}
|
|
451
453
|
return target === ctx.botInfo.username;
|
|
452
|
-
}) || ctx.m.reply_to_message?.from?.username === ctx.botInfo.username
|
|
454
|
+
}) || ctx.m.reply_to_message?.from?.username === ctx.botInfo.username
|
|
455
|
+
|| ctx.type === 'callback_query')
|
|
453
456
|
&& (ctx.chatType = MENTION);
|
|
454
457
|
(((ctx.txt || ctx.m.voice || ctx.m.poll || ctx.m.data || ctx.m.document
|
|
455
458
|
|| ctx.m.photo || ctx.m.sticker || ctx.m.video_note || ctx.m.video
|
|
@@ -554,7 +557,7 @@ const subconscious = [{
|
|
|
554
557
|
}
|
|
555
558
|
await ctx.ok(resp, { md });
|
|
556
559
|
}, help: bot.lines([
|
|
557
|
-
'Basic behaviors for debug only.',
|
|
560
|
+
'¶ Basic behaviors for debug only.',
|
|
558
561
|
]), cmds: {
|
|
559
562
|
thethreelaws: `Isaac Asimov's [Three Laws of Robotics](https://en.wikipedia.org/wiki/Three_Laws_of_Robotics)`,
|
|
560
563
|
ultimateanswer: '[The Answer to the Ultimate Question of Life, The Universe, and Everything](https://bit.ly/43wDhR3).',
|
|
@@ -814,7 +817,7 @@ const subconscious = [{
|
|
|
814
817
|
}
|
|
815
818
|
await ctx.ok(lines2(help), { md: true });
|
|
816
819
|
}, help: bot.lines([
|
|
817
|
-
'Basic syntax of this document:',
|
|
820
|
+
'¶ Basic syntax of this document:',
|
|
818
821
|
'Scheme for commands: /`COMMAND`: `DESCRIPTION`',
|
|
819
822
|
'Scheme for options: `OPTION`(`SHORT`), `TYPE`(`DEFAULT`): `DESCRIPTION`',
|
|
820
823
|
]), cmds: {
|
|
@@ -853,7 +856,7 @@ const subconscious = [{
|
|
|
853
856
|
break;
|
|
854
857
|
}
|
|
855
858
|
}, help: bot.lines([
|
|
856
|
-
'Configure the bot by UNIX/Linux CLI style.',
|
|
859
|
+
'¶ Configure the bot by UNIX/Linux CLI style.',
|
|
857
860
|
'Using [node:util.parseArgs](https://nodejs.org/docs/latest-v21.x/api/util.html#utilparseargsconfig) to parse arguments.',
|
|
858
861
|
]), cmds: {
|
|
859
862
|
toggle: 'Toggle configurations. Only works for boolean values.',
|
|
@@ -927,7 +930,7 @@ const subconscious = [{
|
|
|
927
930
|
})));
|
|
928
931
|
result.length || await ctx.er('No more records.');
|
|
929
932
|
}, help: bot.lines([
|
|
930
|
-
'Search history.',
|
|
933
|
+
'¶ Search history.',
|
|
931
934
|
'Example 1: /search Answer to the Ultimate Question',
|
|
932
935
|
'Example 2: /search Answer to the Ultimate Question --skip=10',
|
|
933
936
|
]), cmds: {
|
|
@@ -938,7 +941,7 @@ const subconscious = [{
|
|
|
938
941
|
await ctx.shouldSpeech();
|
|
939
942
|
await next();
|
|
940
943
|
}, help: bot.lines([
|
|
941
|
-
'When enabled, the bot will speak out the answer if available.',
|
|
944
|
+
'¶ When enabled, the bot will speak out the answer if available.',
|
|
942
945
|
'Example 1: /set --tts on',
|
|
943
946
|
'Example 2: /set --tts off',
|
|
944
947
|
]), args: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halbot",
|
|
3
3
|
"description": "Just another `ChatGPT` / `Gemini` / `Claude` / `Azure` / `Jina` / `Ollama` Telegram bob, which is simple design, easy to use, extendable and fun.",
|
|
4
|
-
"version": "1993.2.
|
|
4
|
+
"version": "1993.2.85",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
package/skills/-8845_thread.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { alan,
|
|
1
|
+
import { alan, hal, uoid, utilitas } from '../index.mjs';
|
|
2
2
|
|
|
3
3
|
const [EMIJI_FINISH, END, NEW, THREAD] = ['☑️', '❎', '✨', '🧵'];
|
|
4
4
|
|
|
@@ -6,9 +6,9 @@ const [CREATED, SWITCHED] = [
|
|
|
6
6
|
`${NEW} Thread created: `, `${EMIJI_FINISH} Thread switched: `
|
|
7
7
|
];
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// https://stackoverflow.com/questions/69924954/an-error-is-issued-when-opening-the-telebot-keyboard
|
|
10
10
|
const keyboards = [[
|
|
11
|
-
{ text: `/ai ${
|
|
11
|
+
{ text: `/ai ${hal.EMOJI_BOT}` },
|
|
12
12
|
{ text: `/new ${NEW}` },
|
|
13
13
|
{ text: `/end ${END}` },
|
|
14
14
|
{ text: `/list ${THREAD}` },
|
|
@@ -173,7 +173,7 @@ export const { name, run, priority, func, help, cmdx } = {
|
|
|
173
173
|
run: true,
|
|
174
174
|
priority: -8845,
|
|
175
175
|
func: action,
|
|
176
|
-
help: 'Thread management.',
|
|
176
|
+
help: '¶ Thread management.',
|
|
177
177
|
cmdx: {
|
|
178
178
|
clear: 'Clear current thread.',
|
|
179
179
|
end: 'End current thread.',
|
package/skills/20_instant.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { alan, bot, utilitas } from '../index.mjs';
|
|
|
3
3
|
const action = async (ctx, next) => {
|
|
4
4
|
const ais = await alan.getAi(null, { all: true });
|
|
5
5
|
const allAi = ais.map(x => x.id);
|
|
6
|
-
switch (ctx.cmd
|
|
6
|
+
switch (ctx.cmd?.cmd) {
|
|
7
7
|
case 'all':
|
|
8
8
|
ctx.selectedAi = allAi;
|
|
9
9
|
ctx.hello(ctx.cmd.args);
|
|
@@ -53,14 +53,9 @@ export const { name, run, priority, func, help, cmds } = {
|
|
|
53
53
|
priority: 20,
|
|
54
54
|
func: action,
|
|
55
55
|
help: bot.lines([
|
|
56
|
-
'Use an AI
|
|
56
|
+
'¶ Use an AI model `temporary` without touching your settings.',
|
|
57
|
+
'Example 1: /[AI_ID] Say hello to [AI_ID]!',
|
|
58
|
+
'Example 2: /all Say hello to all AIs!',
|
|
57
59
|
]),
|
|
58
|
-
|
|
59
|
-
all: 'Use all AI engines simultaneously: /all Say hello to all AIs!',
|
|
60
|
-
gemini: 'Use ♊️ Gemini temporary: /gemini Say hello to Gemini!',
|
|
61
|
-
chatgpt: 'Use ⚛️ ChatGPT temporary: /chatgpt Say hello to ChatGPT!',
|
|
62
|
-
claude: 'Use ✴️ Claude temporary: /claude Say hello to Claude!',
|
|
63
|
-
azure: 'Use ☁️ Azure temporary: /azure Say hello to Azure!',
|
|
64
|
-
ollama: 'Use 🦙 Ollama temporary: /ollama Say hello to Ollama!',
|
|
65
|
-
},
|
|
60
|
+
cmdx: {},
|
|
66
61
|
};
|