alemonjs 1.3.0 → 1.3.2
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/LICENSE +21 -21
- package/README.md +110 -110
- package/config/tsconfig.json +36 -40
- package/dist/config/types.d.ts +0 -2
- package/dist/core/main.d.ts +0 -3
- package/dist/core/utils/index.d.ts +0 -1
- package/dist/define/types.d.ts +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +41 -365
- package/dist/platform/ntqq/alemon/controller.d.ts +5 -0
- package/dist/platform/ntqq/sdk/api.d.ts +28 -32
- package/package.json +87 -99
- package/.puppeteerrc.cjs +0 -67
- package/dist/core/utils/component.d.ts +0 -25
- package/dist/core/utils/link.d.ts +0 -1
- package/dist/core/utils/module.d.ts +0 -1
- package/dist/core/utils/picture.d.ts +0 -7
- package/dist/core/utils/puppeteer.d.ts +0 -32
- package/dist/main.css +0 -8
- package/dist/require.d.ts +0 -1
- package/dist/url.d.ts +0 -2
- package/env.d.ts +0 -129
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2013-present, Yuxi (Evan) You
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013-present, Yuxi (Evan) You
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
# AlemonJS [https://alemonjs.com](https://alemonjs.com)
|
|
2
|
-
|
|
3
|
-
<div align="center">
|
|
4
|
-
<a
|
|
5
|
-
href="https://alemonjs.com/"
|
|
6
|
-
target="_blank"
|
|
7
|
-
rel="noopener noreferrer">
|
|
8
|
-
<img
|
|
9
|
-
width="256"
|
|
10
|
-
height="128"
|
|
11
|
-
src="https://alemonjs.com/img/alemon.jpg"
|
|
12
|
-
alt="AlemonJS LOGO"
|
|
13
|
-
>
|
|
14
|
-
</a>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<div align="center">
|
|
18
|
-
|
|
19
|
-
跨平台开发的事件驱动机器人 | 支持 QQ (群&频道)、KOOK、Discord
|
|
20
|
-
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
### Ecosystem
|
|
24
|
-
|
|
25
|
-
| Project | Status | Description |
|
|
26
|
-
| ----------------- | ---------------------------------------------------- | --------------- |
|
|
27
|
-
| [alemonjs] | [![alemonjs-status]][alemonjs-package] | 标准应用解析器 |
|
|
28
|
-
| [create-alemonjs] | [![create-alemonjs-status]][create-alemonjs-package] | 模板创建脚手架 |
|
|
29
|
-
| [alemon-ffmpeg] | [![alemon-ffmpeg-status]][alemon-ffmpeg-package] | ffmpeg 自动下载 |
|
|
30
|
-
|
|
31
|
-
[alemonjs]: https://github.com/ningmengchongshui/alemonjs
|
|
32
|
-
[alemonjs-status]: https://img.shields.io/npm/v/alemonjs.svg
|
|
33
|
-
[alemonjs-package]: https://www.npmjs.com/package/alemonjs
|
|
34
|
-
[create-alemonjs]: https://github.com/ningmengchongshui/alemonjs/tree/create-alemonjs
|
|
35
|
-
[create-alemonjs-status]: https://img.shields.io/npm/v/create-alemonjs.svg
|
|
36
|
-
[create-alemonjs-package]: https://www.npmjs.com/package/create-alemonjs
|
|
37
|
-
[alemon-ffmpeg]: https://github.com/kongxiangyiren/alemon-ffmpeg
|
|
38
|
-
[alemon-ffmpeg-status]: https://img.shields.io/npm/v/alemon-ffmpeg.svg
|
|
39
|
-
[alemon-ffmpeg-package]: https://www.npmjs.com/package/alemon-ffmpeg
|
|
40
|
-
|
|
41
|
-
### Quick Start
|
|
42
|
-
|
|
43
|
-
可直接执行脚手架 并快速启动程序
|
|
44
|
-
|
|
45
|
-
```sh
|
|
46
|
-
npm install pnpm -g
|
|
47
|
-
pnpm create alemonjs@latest -y
|
|
48
|
-
cd alemonb
|
|
49
|
-
npm install
|
|
50
|
-
npm run dev
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
连接平台需要正确配置登录
|
|
54
|
-
|
|
55
|
-
`alemon.login.ts`
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
import { defineConfig } from 'alemonjs'
|
|
59
|
-
export default defineConfig({
|
|
60
|
-
// 配置名 test
|
|
61
|
-
test: {
|
|
62
|
-
// qq平台配置
|
|
63
|
-
qq: {
|
|
64
|
-
appID: 'your app id',
|
|
65
|
-
token: 'your token'
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
// 配置名 pro
|
|
69
|
-
pro: {
|
|
70
|
-
// kook平台配置
|
|
71
|
-
kook: {}
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
> npm run [脚本名] [配置名] [平台名]
|
|
77
|
-
|
|
78
|
-
启动时带上匹配规则机器人正确启动
|
|
79
|
-
|
|
80
|
-
```sh
|
|
81
|
-
npm run dev test qq
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Development Examples
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
import { createApp, Events, Messages } from 'alemonjs'
|
|
88
|
-
// 监听事件
|
|
89
|
-
const event = new Events()
|
|
90
|
-
event.response('MEMBERS', async e => {
|
|
91
|
-
if (/^你好$/.test(e.msg)) e.reply('你好呀')
|
|
92
|
-
})
|
|
93
|
-
event.response('MEMBERS', async e => {
|
|
94
|
-
console.log('成员', e.user_name, '加入')
|
|
95
|
-
})
|
|
96
|
-
// 响应消息
|
|
97
|
-
const message = new Messages()
|
|
98
|
-
message.response(/^最近怎么样/, async e => {
|
|
99
|
-
e.reply('很好')
|
|
100
|
-
})
|
|
101
|
-
// 构建应用
|
|
102
|
-
const app = createApp(import.meta.url)
|
|
103
|
-
app.on(event.ok)
|
|
104
|
-
app.use(message.ok)
|
|
105
|
-
app.mount()
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Community
|
|
109
|
-
|
|
110
|
-
QQ Group 806943302
|
|
1
|
+
# AlemonJS [https://alemonjs.com](https://alemonjs.com)
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a
|
|
5
|
+
href="https://alemonjs.com/"
|
|
6
|
+
target="_blank"
|
|
7
|
+
rel="noopener noreferrer">
|
|
8
|
+
<img
|
|
9
|
+
width="256"
|
|
10
|
+
height="128"
|
|
11
|
+
src="https://alemonjs.com/img/alemon.jpg"
|
|
12
|
+
alt="AlemonJS LOGO"
|
|
13
|
+
>
|
|
14
|
+
</a>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div align="center">
|
|
18
|
+
|
|
19
|
+
跨平台开发的事件驱动机器人 | 支持 QQ (群&频道)、KOOK、Discord
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
### Ecosystem
|
|
24
|
+
|
|
25
|
+
| Project | Status | Description |
|
|
26
|
+
| ----------------- | ---------------------------------------------------- | --------------- |
|
|
27
|
+
| [alemonjs] | [![alemonjs-status]][alemonjs-package] | 标准应用解析器 |
|
|
28
|
+
| [create-alemonjs] | [![create-alemonjs-status]][create-alemonjs-package] | 模板创建脚手架 |
|
|
29
|
+
| [alemon-ffmpeg] | [![alemon-ffmpeg-status]][alemon-ffmpeg-package] | ffmpeg 自动下载 |
|
|
30
|
+
|
|
31
|
+
[alemonjs]: https://github.com/ningmengchongshui/alemonjs
|
|
32
|
+
[alemonjs-status]: https://img.shields.io/npm/v/alemonjs.svg
|
|
33
|
+
[alemonjs-package]: https://www.npmjs.com/package/alemonjs
|
|
34
|
+
[create-alemonjs]: https://github.com/ningmengchongshui/alemonjs/tree/create-alemonjs
|
|
35
|
+
[create-alemonjs-status]: https://img.shields.io/npm/v/create-alemonjs.svg
|
|
36
|
+
[create-alemonjs-package]: https://www.npmjs.com/package/create-alemonjs
|
|
37
|
+
[alemon-ffmpeg]: https://github.com/kongxiangyiren/alemon-ffmpeg
|
|
38
|
+
[alemon-ffmpeg-status]: https://img.shields.io/npm/v/alemon-ffmpeg.svg
|
|
39
|
+
[alemon-ffmpeg-package]: https://www.npmjs.com/package/alemon-ffmpeg
|
|
40
|
+
|
|
41
|
+
### Quick Start
|
|
42
|
+
|
|
43
|
+
可直接执行脚手架 并快速启动程序
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install pnpm -g
|
|
47
|
+
pnpm create alemonjs@latest -y
|
|
48
|
+
cd alemonb
|
|
49
|
+
npm install
|
|
50
|
+
npm run dev
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
连接平台需要正确配置登录
|
|
54
|
+
|
|
55
|
+
`alemon.login.ts`
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { defineConfig } from 'alemonjs'
|
|
59
|
+
export default defineConfig({
|
|
60
|
+
// 配置名 test
|
|
61
|
+
test: {
|
|
62
|
+
// qq平台配置
|
|
63
|
+
qq: {
|
|
64
|
+
appID: 'your app id',
|
|
65
|
+
token: 'your token'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
// 配置名 pro
|
|
69
|
+
pro: {
|
|
70
|
+
// kook平台配置
|
|
71
|
+
kook: {}
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> npm run [脚本名] [配置名] [平台名]
|
|
77
|
+
|
|
78
|
+
启动时带上匹配规则机器人正确启动
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
npm run dev test qq
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Development Examples
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { createApp, Events, Messages } from 'alemonjs'
|
|
88
|
+
// 监听事件
|
|
89
|
+
const event = new Events()
|
|
90
|
+
event.response('MEMBERS', async e => {
|
|
91
|
+
if (/^你好$/.test(e.msg)) e.reply('你好呀')
|
|
92
|
+
})
|
|
93
|
+
event.response('MEMBERS', async e => {
|
|
94
|
+
console.log('成员', e.user_name, '加入')
|
|
95
|
+
})
|
|
96
|
+
// 响应消息
|
|
97
|
+
const message = new Messages()
|
|
98
|
+
message.response(/^最近怎么样/, async e => {
|
|
99
|
+
e.reply('很好')
|
|
100
|
+
})
|
|
101
|
+
// 构建应用
|
|
102
|
+
const app = createApp(import.meta.url)
|
|
103
|
+
app.on(event.ok)
|
|
104
|
+
app.use(message.ok)
|
|
105
|
+
app.mount()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Community
|
|
109
|
+
|
|
110
|
+
QQ Group 806943302
|
package/config/tsconfig.json
CHANGED
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
/*
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"transpileOnly": true,
|
|
38
|
-
"experimentalSpecifierResolution": "node"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"noImplicitAny": false,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"preserveConstEnums": true,
|
|
9
|
+
"ignoreDeprecations": "5.0",
|
|
10
|
+
"removeComments": true,
|
|
11
|
+
"jsx": "react",
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"allowJs": false,
|
|
15
|
+
"suppressImplicitAnyIndexErrors": true,
|
|
16
|
+
"typeRoots": ["node_modules/@types"],
|
|
17
|
+
/* */
|
|
18
|
+
"useDefineForClassFields": true,
|
|
19
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
/* Bundler mode */
|
|
22
|
+
"resolveJsonModule": true,
|
|
23
|
+
"isolatedModules": true,
|
|
24
|
+
/* Linting */
|
|
25
|
+
// "strict": true, 严格模式
|
|
26
|
+
"noUnusedLocals": true,
|
|
27
|
+
"noUnusedParameters": true,
|
|
28
|
+
"noFallthroughCasesInSwitch": true,
|
|
29
|
+
"forceConsistentCasingInFileNames": true
|
|
30
|
+
},
|
|
31
|
+
"ts-node": {
|
|
32
|
+
"esm": true,
|
|
33
|
+
"transpileOnly": true,
|
|
34
|
+
"experimentalSpecifierResolution": "node"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type PuppeteerLaunchOptions } from 'puppeteer';
|
|
2
1
|
import { type EmailOptions } from '../email/types.js';
|
|
3
2
|
import { type FileOptions } from '../file/index.js';
|
|
4
3
|
import { type KOOKOptions } from '../platform/kook/sdk/wss.types.js';
|
|
@@ -10,7 +9,6 @@ export interface BotConfigType {
|
|
|
10
9
|
kook: KOOKOptions;
|
|
11
10
|
qq: QQOptions;
|
|
12
11
|
file: FileOptions;
|
|
13
|
-
puppeteer: PuppeteerLaunchOptions;
|
|
14
12
|
ntqq: NTQQOptions;
|
|
15
13
|
discord: DISOCRDOptions;
|
|
16
14
|
email: EmailOptions;
|
package/dist/core/main.d.ts
CHANGED
|
@@ -10,7 +10,4 @@ export * from './config.js';
|
|
|
10
10
|
export * from './utils/index.js';
|
|
11
11
|
export * from './koa/main.js';
|
|
12
12
|
export * from './processor/read.js';
|
|
13
|
-
export * from './utils/component.js';
|
|
14
|
-
export * from './utils/module.js';
|
|
15
|
-
export * from './utils/picture.js';
|
|
16
13
|
export * from './func.js';
|
package/dist/define/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PuppeteerLaunchOptions } from 'puppeteer';
|
|
2
1
|
import { LoginOptions, PlatformsItemType } from '../default/types.js';
|
|
3
2
|
import { FileOptions } from '../file/types.js';
|
|
4
3
|
import { ApplicationProcessingOpsion, type ServerOptions } from '../core/index.js';
|
|
@@ -22,7 +21,6 @@ export interface AlemonOptions {
|
|
|
22
21
|
server?: ServerOptions;
|
|
23
22
|
file?: FileOptions;
|
|
24
23
|
pupStart?: false;
|
|
25
|
-
puppeteer?: PuppeteerLaunchOptions;
|
|
26
24
|
env?: DotenvConfigOptions;
|
|
27
25
|
email?: EmailOptions;
|
|
28
26
|
}
|
package/dist/index.d.ts
CHANGED