halbot 1989.6.7 → 1989.6.9
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/README.md +49 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,9 +15,22 @@ Features
|
|
|
15
15
|
|
|
16
16
|
## How to use
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
### Config
|
|
19
|
+
|
|
20
|
+
Make the `halbot` json config file and put it in this path `~/.halbot.json`.
|
|
21
|
+
|
|
22
|
+
#### Basic config demo
|
|
19
23
|
|
|
20
24
|
```json
|
|
25
|
+
{
|
|
26
|
+
"telegramToken": "[[Telegram Bot API Token]]",
|
|
27
|
+
"chatGptKey": "[[ChatGPT API Key]]",
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### All supported configuration fields
|
|
32
|
+
|
|
33
|
+
```js
|
|
21
34
|
{
|
|
22
35
|
// REQUIRED, string.
|
|
23
36
|
"telegramToken": "[[Telegram Bot API Token]]",
|
|
@@ -35,6 +48,9 @@ Make the `halbot` json config file and put it in this path `~/.halbot.json`:
|
|
|
35
48
|
// To restrict the bot to PRIVATE, set chat/group/channel ids in this array.
|
|
36
49
|
"private": ["[[CHAT_ID]]", "[[GROUP_ID]]", "[[CHANNEL_ID]]", ...],
|
|
37
50
|
// OPTIONAL, string.
|
|
51
|
+
// Set this field if you want to use a `magic word` to authenticate the bot.
|
|
52
|
+
"magicWord": "[[Your Magic Word here]]",
|
|
53
|
+
// OPTIONAL, string.
|
|
38
54
|
// Use a HOME GROUP to authentication users.
|
|
39
55
|
// Anyone in this group can access the bot.
|
|
40
56
|
"homeGroup": "[[GROUP_ID]]",
|
|
@@ -47,19 +63,48 @@ Make the `halbot` json config file and put it in this path `~/.halbot.json`:
|
|
|
47
63
|
}
|
|
48
64
|
```
|
|
49
65
|
|
|
50
|
-
|
|
66
|
+
### Run it
|
|
67
|
+
|
|
68
|
+
Run it in peace of mind.
|
|
51
69
|
|
|
52
70
|
```bash
|
|
53
71
|
$ npx halbot
|
|
54
72
|
```
|
|
55
73
|
|
|
56
|
-
|
|
74
|
+
### Integrate to your project
|
|
57
75
|
|
|
58
76
|
```bash
|
|
59
77
|
$ npm i halbot
|
|
60
78
|
```
|
|
61
79
|
|
|
62
80
|
```js
|
|
63
|
-
|
|
81
|
+
import halbot from 'halbot';
|
|
82
|
+
|
|
83
|
+
const config = {
|
|
84
|
+
// ...[[ALL THE CONFIG FIELDS SUPPORTED ABOVE]]],
|
|
85
|
+
|
|
86
|
+
// OPTIONAL, function.
|
|
87
|
+
// Your own authentication logic.
|
|
88
|
+
// return true if the user is authenticated.
|
|
89
|
+
// return false if the user is not authenticated.
|
|
90
|
+
auth: async (ctx) => {
|
|
91
|
+
// ctx is the `telegraf` context object: https://telegraf.js.org/#context-class
|
|
92
|
+
// It has been extended: https://github.com/Leask/utilitas/blob/master/lib/bot.mjs
|
|
93
|
+
return true;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
// OPTIONAL, object (key renderd as name) or array (name ignored).
|
|
97
|
+
ai: {
|
|
98
|
+
[[aiNameA]]: [[aiClientA]]
|
|
99
|
+
[[aiNameB]]: [[aiClientB]],
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
// OPTIONAL, your own speech-to-text and text-to-speech engine.
|
|
103
|
+
speech: {
|
|
104
|
+
stt: [[sttClient]],
|
|
105
|
+
tts: [[ttsClient]]]],
|
|
106
|
+
},
|
|
107
|
+
};
|
|
64
108
|
|
|
109
|
+
await halbot(config);
|
|
65
110
|
```
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "halbot",
|
|
3
3
|
"description": "Just another ChatGPT/Bing Telegram bob.",
|
|
4
|
-
"version": "1989.6.
|
|
4
|
+
"version": "1989.6.9",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/Leask/halbot",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=18.x"
|
|
10
10
|
},
|
|
11
|
-
"main": "index.
|
|
11
|
+
"main": "index.mjs",
|
|
12
12
|
"bin": {
|
|
13
13
|
"halbot": "bin/halbot.mjs"
|
|
14
14
|
},
|