halbot 1990.1.7 → 1990.1.8

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.7",
4
+ "version": "1990.1.8",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/halbot",
7
7
  "type": "module",
@@ -36,6 +36,6 @@
36
36
  "ioredis": "^5.3.1",
37
37
  "mysql2": "^3.2.0",
38
38
  "telegraf": "^4.12.2",
39
- "utilitas": "^1992.4.70"
39
+ "utilitas": "^1993.0.4"
40
40
  }
41
41
  }
@@ -5,7 +5,7 @@ let configuredAi;
5
5
  const action = async (ctx, next) => {
6
6
  ctx.firstAi = (configuredAi = Object.keys(ctx._.ai))[0];
7
7
  switch (ctx.session.config?.ai) {
8
- case '.': ctx.selectedAi = [ctx.firstAi]; break;
8
+ case '': ctx.selectedAi = [ctx.firstAi]; break;
9
9
  case '@': ctx.selectedAi = configuredAi; break;
10
10
  default: ctx.selectedAi = [configuredAi.includes(ctx.session.config?.ai)
11
11
  ? ctx.session.config?.ai : ctx.firstAi];
@@ -14,14 +14,14 @@ const action = async (ctx, next) => {
14
14
  ctx.isDefaultAi = name => name === ctx.firstAi;
15
15
  ctx.clear = () => (ctx.selectedAi || []).map(n => {
16
16
  ctx._.ai[n].clear(ctx.chatId);
17
- ctx.text = ctx._.hello;
17
+ ctx.hello();
18
18
  });
19
19
  await next();
20
20
  };
21
21
 
22
22
  const validate = val => {
23
23
  assert(configuredAi, 'Preparing data for this option. Please try later.');
24
- for (let name of [...configuredAi, '.', '@']) {
24
+ for (let name of [...configuredAi, '', '@']) {
25
25
  if (utilitas.insensitiveCompare(val, name)) { return name; }
26
26
  }
27
27
  utilitas.throwError('No AI engine matched.');
@@ -32,20 +32,29 @@ export const { run, priority, func, help, args } = {
32
32
  priority: 10,
33
33
  func: action,
34
34
  help: bot.lines([
35
+ 'Set initial prompt to the AI engine.',
35
36
  'Select between AI engines.',
36
- 'Set `ai`=`.` to use default AI engine.',
37
- 'Set `ai`=`@` to use all AI engines simultaneously.',
38
- 'Example 1: /set --ai ChatGPT',
39
- 'Example 2: /set --ai Bing',
40
- 'Example 3: /set --ai .',
41
- 'Example 4: /set --ai @',
42
- 'Example 5: /set --render on',
43
- 'Example 6: /set --render off',
37
+ 'Tweak output rendering.',
38
+ "Tips 1: Set `hello ''` to reset to default initial prompt.",
39
+ "Tips 2: Set `ai ''` to use default AI engine.",
40
+ 'Tips 3: Set `ai @` to use all AI engines simultaneously.',
41
+ "Example 1: /set --hello 'Bonjour!'",
42
+ "Example 1: /set --hello ''",
43
+ 'Example 2: /set --ai ChatGPT',
44
+ 'Example 3: /set --ai Bing',
45
+ "Example 4: /set --ai ''",
46
+ 'Example 5: /set --ai @',
47
+ 'Example 6: /set --render on',
48
+ 'Example 7: /set --render off',
44
49
  ]),
45
50
  args: {
51
+ hello: {
52
+ type: 'string', short: 'h', default: 'Hello!',
53
+ desc: 'Your initial prompt to the AI engine.',
54
+ },
46
55
  ai: {
47
56
  type: 'string', short: 'a', default: '',
48
- desc: "`(ChatGPT, Bing, ., @)` Select AI engine.",
57
+ desc: "`(ChatGPT, Bing, '', @)` Select AI engine.",
49
58
  validate,
50
59
  },
51
60
  render: {
@@ -6,17 +6,17 @@ const action = async (ctx, next) => {
6
6
  case 'all':
7
7
  ctx.selectedAi = allAi;
8
8
  ctx.multiAi = ctx.selectedAi.length > 1;
9
- ctx.text = ctx.cmd.args || ctx._.hello;
9
+ ctx.hello(ctx.cmd.args);
10
10
  break;
11
11
  case 'bing':
12
12
  assert(utilitas.insensitiveHas(allAi, 'bing'), 'Bing is not available.');
13
13
  ctx.selectedAi = ['Bing'];
14
- ctx.text = ctx.cmd.args || ctx._.hello;
14
+ ctx.hello(ctx.cmd.args);
15
15
  break;
16
16
  case 'chatgpt':
17
17
  assert(utilitas.insensitiveHas(allAi, 'chatgpt'), 'ChatGPT is not available.');
18
18
  ctx.selectedAi = ['ChatGPT'];
19
- ctx.text = ctx.cmd.args || ctx._.hello;
19
+ ctx.hello(ctx.cmd.args);
20
20
  break;
21
21
  }
22
22
  await next();
File without changes