mioki 0.2.4 → 0.3.0
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/dist/index.cjs +74 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.mts +7 -5
- package/dist/index.mjs +73 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
- package/readme.md +63 -0
package/readme.md
CHANGED
|
@@ -4,3 +4,66 @@ A simple NapCat OneBot v11 framework.
|
|
|
4
4
|
|
|
5
5
|
> [!CAUTION]
|
|
6
6
|
> This project is still under active development. Use it at your own risk.
|
|
7
|
+
|
|
8
|
+
## Usage of mioki
|
|
9
|
+
|
|
10
|
+
### 1. Deploy a NapCat Instance
|
|
11
|
+
|
|
12
|
+
It forwards port 3001 to 3333, mioki use `3333` as default port to connect NapCat WebSocket server.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
docker run -d \
|
|
16
|
+
-e NAPCAT_GID=$(id -g) \
|
|
17
|
+
-e NAPCAT_UID=$(id -u) \
|
|
18
|
+
-p 3333:3001 \
|
|
19
|
+
-p 6099:6099 \
|
|
20
|
+
--name napcat \
|
|
21
|
+
--restart=always \
|
|
22
|
+
mlikiowa/napcat-docker:latest
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> PS: The image is 500+ MB, so it may take some time to download.
|
|
26
|
+
|
|
27
|
+
Visit http://localhost:6099, and navigate to "Network Settings" to add a new WebSocket server, using the `3001` port and `0.0.0.0` host in docker. Make sure to enable it after adding. Keep the token you set here, you'll need it to connect mioki to NapCat.
|
|
28
|
+
|
|
29
|
+
<img src="./docs/napcat-ws-config.png" title="napcat-websocket" alt="napcat-websocket" style="width: 300px; max-width: 300px; border-radius: 4px; border: none;" />
|
|
30
|
+
|
|
31
|
+
### 2. Create a mioki Project
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
mkdir bot && cd bot
|
|
35
|
+
npm init -y && npm install mioki
|
|
36
|
+
echo "import('mioki').then(({ start }) => start())" > app.ts
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Configure mioki
|
|
40
|
+
|
|
41
|
+
Update `package.json` to add `mioki` field to configure mioki options.
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mioki": {
|
|
46
|
+
"owners": [114514],
|
|
47
|
+
"admins": [],
|
|
48
|
+
"plugins": [],
|
|
49
|
+
"online_push": true,
|
|
50
|
+
"napcat": {
|
|
51
|
+
"protocol": "ws",
|
|
52
|
+
"host": "localhost",
|
|
53
|
+
"port": 3333,
|
|
54
|
+
"token": "your-napcat-token",
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 4. Run the Bot
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# or `bun app.ts`, `tsx app.ts`, etc.
|
|
64
|
+
node app.ts
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT License © 2025-PRESENT Viki
|