alemonjs 1.0.2 → 1.0.4
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 +6 -22
- package/bin/main.js +17 -0
- package/lib/alemon/dealmsg.js +66 -18
- package/lib/alemon/puppeteer.js +9 -16
- package/lib/config/index.js +8 -0
- package/lib/config/login.js +87 -0
- package/lib/config/pup.js +75 -0
- package/lib/config/types.js +1 -0
- package/lib/default/login/discord.js +16 -0
- package/lib/default/login/kook.js +5 -0
- package/lib/default/login/ntqq.js +17 -0
- package/lib/default/login/qq.js +16 -0
- package/lib/default/login/villa.js +13 -0
- package/lib/default/mysql.js +7 -0
- package/lib/default/pup.js +15 -0
- package/lib/default/redis.js +6 -0
- package/lib/default/server.js +4 -0
- package/lib/{types.js → default/types.js} +8 -2
- package/lib/define/api.js +23 -0
- package/lib/define/child_process.js +10 -0
- package/lib/define/command.js +22 -0
- package/lib/define/index.js +7 -0
- package/lib/define/main.js +205 -0
- package/lib/define/map.js +47 -0
- package/lib/define/plugin.js +25 -0
- package/lib/define/types.js +1 -0
- package/lib/discord/alemon/message/PUBLIC_GUILD_MESSAGES.js +1 -1
- package/lib/discord/index.js +1 -1
- package/lib/discord/login.js +18 -63
- package/lib/index.js +23 -7
- package/lib/kook/alemon/message/PUBLIC_GUILD_MESSAGES.js +1 -1
- package/lib/kook/index.js +1 -1
- package/lib/kook/login.js +7 -40
- package/lib/ntqq/alemon/message/GROUP_AT_MESSAGE_CREATE.js +1 -1
- package/lib/ntqq/index.js +2 -2
- package/lib/ntqq/login.js +15 -64
- package/lib/ntqq/sdk/wss.js +0 -1
- package/lib/qq/alemon/conversation.js +1 -1
- package/lib/qq/alemon/message/MESSAGE.js +1 -1
- package/lib/qq/index.js +14 -3
- package/lib/qq/login.js +3 -125
- package/lib/villa/alemon/message/MESSAGES.js +1 -1
- package/lib/villa/index.js +1 -1
- package/lib/villa/login.js +11 -52
- package/package.json +62 -60
- package/types/alemon/dealmsg.d.ts +10 -0
- package/types/config/index.d.ts +8 -0
- package/types/config/pup.d.ts +7 -0
- package/types/config/types.d.ts +18 -0
- package/types/default/login/discord.d.ts +8 -0
- package/types/default/login/kook.d.ts +6 -0
- package/types/default/login/ntqq.d.ts +16 -0
- package/types/default/login/qq.d.ts +12 -0
- package/types/default/login/villa.d.ts +14 -0
- package/types/default/mysql.d.ts +8 -0
- package/types/default/pup.d.ts +3 -0
- package/types/default/redis.d.ts +7 -0
- package/types/default/server.d.ts +5 -0
- package/types/default/types.d.ts +300 -0
- package/types/define/api.d.ts +30 -0
- package/types/define/child_process.d.ts +1 -0
- package/types/define/command.d.ts +1 -0
- package/types/define/index.d.ts +7 -0
- package/types/define/main.d.ts +20 -0
- package/types/define/map.d.ts +12 -0
- package/types/define/plugin.d.ts +4 -0
- package/types/define/types.d.ts +111 -0
- package/types/index.d.ts +17 -2
- package/lib/bot.js +0 -98
- package/lib/config.js +0 -25
- package/lib/login.js +0 -115
- package/types/bot.d.ts +0 -15
- package/types/config.d.ts +0 -12
- package/types/types.d.ts +0 -135
- /package/types/{login.d.ts → config/login.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
> 支持 NtQQ、QQ 频道、Discord、米游社大别野、KOOK
|
|
6
6
|
|
|
7
|
-
[☞Alemon 文档](https://alemonjs.com)
|
|
8
|
-
|
|
9
7
|
| 分支 | 类型 | 说明 |
|
|
10
8
|
| ----- | ------ | -------------------- |
|
|
11
9
|
| main | 核心 | 机器实例 |
|
|
@@ -13,35 +11,21 @@
|
|
|
13
11
|
| cli | 脚手架 | 开发模板脚手架 |
|
|
14
12
|
| web | 网站 | 共享平台插件贡献地址 |
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
```shell
|
|
19
|
-
npm init almeonjs@latest -y #安装
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
```shell
|
|
23
|
-
cd alemon-bot #进入
|
|
24
|
-
```
|
|
14
|
+
> 需要配置机器人才可启动
|
|
25
15
|
|
|
26
|
-
|
|
27
|
-
npm run app qq #启动
|
|
28
|
-
```
|
|
16
|
+
文档查看 OPEN[alemonjs.com](https://alemonjs.com)
|
|
29
17
|
|
|
30
|
-
|
|
18
|
+
开发模板 GITEE[create-alemonjs](https://gitee.com/ningmengchongshui/alemon/tree/cli/bin/template)
|
|
31
19
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
参考配置说明进行更改[config](./config.md)
|
|
20
|
+
开发模板 GITHUB[create-alemonjs](https://github.com/ningmengchongshui/alemon/tree/cli/bin/template)
|
|
35
21
|
|
|
36
22
|
### 共享平台
|
|
37
23
|
|
|
38
24
|
> 仓库只做资源收集,对齐安全性不做任何检查,请谨慎选择
|
|
39
25
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Github ☞[贡献资源](https://github.com/ningmengchongshui/alemon/tree/web/docs/root/examples/about/plugins.md)
|
|
26
|
+
贡献资源 OPEN[Gitee](https://gitee.com/ningmengchongshui/alemon/blob/web/docs/about/plugins.md)
|
|
43
27
|
|
|
44
|
-
|
|
28
|
+
贡献资源 OPEN[Github](https://gitee.com/ningmengchongshui/alemon/blob/web/docs/about/plugins.md)
|
|
45
29
|
|
|
46
30
|
> 仅限签署开源协议的仓库、不开源将不做考虑范围内
|
|
47
31
|
|
package/bin/main.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from 'child_process'
|
|
4
|
+
|
|
5
|
+
const ars = process.argv.slice(2)
|
|
6
|
+
|
|
7
|
+
const command = spawn(`npx ts-node alemon.config.ts ${ars}`, {
|
|
8
|
+
shell: true
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
command.stdout.on('data', data => {
|
|
12
|
+
process.stdout.write(data.toString())
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
command.stderr.on('data', data => {
|
|
16
|
+
process.stderr.write(data.toString())
|
|
17
|
+
})
|
package/lib/alemon/dealmsg.js
CHANGED
|
@@ -34,6 +34,21 @@ let addressMenu = join(process.cwd(), route);
|
|
|
34
34
|
* 大正则
|
|
35
35
|
*/
|
|
36
36
|
let mergedRegex;
|
|
37
|
+
let appRegex = /./;
|
|
38
|
+
let appRegexClose;
|
|
39
|
+
/**
|
|
40
|
+
* 插件名匹配
|
|
41
|
+
* @param val
|
|
42
|
+
*/
|
|
43
|
+
export function setAppRegex(val) {
|
|
44
|
+
const { RegexOpen, RegexClose } = val;
|
|
45
|
+
if (RegexOpen) {
|
|
46
|
+
appRegex = RegexOpen;
|
|
47
|
+
}
|
|
48
|
+
if (RegexClose) {
|
|
49
|
+
appRegexClose = RegexClose;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
37
52
|
/**
|
|
38
53
|
* 设置指令json地址
|
|
39
54
|
* @param rt '/public/defset'
|
|
@@ -52,17 +67,32 @@ export function getPluginHelp(AppName) {
|
|
|
52
67
|
}
|
|
53
68
|
/**
|
|
54
69
|
* 创建机器人帮助
|
|
70
|
+
* 存在且得到的app不为[]时才会创建json
|
|
55
71
|
*/
|
|
56
72
|
function createPluginHelp() {
|
|
57
|
-
//
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
// 存在app才创建
|
|
74
|
+
if (Object.values(plugins).length != 0) {
|
|
75
|
+
// 同时key不能是空数组
|
|
76
|
+
let t = false;
|
|
77
|
+
for (const item in plugins) {
|
|
78
|
+
if (plugins[item] && plugins[item].length != 0) {
|
|
79
|
+
t = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (t) {
|
|
83
|
+
// 不存在
|
|
84
|
+
if (!existsSync(addressMenu))
|
|
85
|
+
mkdirSync(addressMenu, { recursive: true });
|
|
86
|
+
// 创建help
|
|
87
|
+
for (const item in plugins) {
|
|
88
|
+
if (plugins[item] && plugins[item].length != 0) {
|
|
89
|
+
const basePath = join(addressMenu, `${item}.json`);
|
|
90
|
+
const jsonData = JSON.stringify(plugins[item], null, 2);
|
|
91
|
+
// 异步创建避免阻塞
|
|
92
|
+
writeFile(basePath, jsonData, 'utf-8');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
66
96
|
}
|
|
67
97
|
}
|
|
68
98
|
/**
|
|
@@ -167,13 +197,34 @@ async function synthesis(AppsObj, appname, belong) {
|
|
|
167
197
|
* @param dir
|
|
168
198
|
*/
|
|
169
199
|
async function loadPlugins(dir) {
|
|
170
|
-
|
|
171
|
-
|
|
200
|
+
/**
|
|
201
|
+
* ********************
|
|
202
|
+
* 没有该文件夹直接返回
|
|
203
|
+
* *******************
|
|
204
|
+
*/
|
|
205
|
+
if (!existsSync(dir)) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
172
208
|
const flies = readdirSync(dir);
|
|
209
|
+
if (flies.length == 0) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const app = flies
|
|
213
|
+
.filter(item => appRegex.test(item))
|
|
214
|
+
.filter(item => {
|
|
215
|
+
// 关闭符合条件的
|
|
216
|
+
if (!appRegexClose) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
if (appRegexClose.test(item)) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
return true;
|
|
223
|
+
});
|
|
173
224
|
/**
|
|
174
225
|
* 识别并执行插件
|
|
175
226
|
*/
|
|
176
|
-
for await (const appname of
|
|
227
|
+
for await (const appname of app) {
|
|
177
228
|
if (existsSync(`${dir}/${appname}/index.ts`)) {
|
|
178
229
|
/**
|
|
179
230
|
* 优先考虑ts
|
|
@@ -356,8 +407,7 @@ export async function InstructionMatching(e) {
|
|
|
356
407
|
return res;
|
|
357
408
|
})
|
|
358
409
|
.catch((err) => {
|
|
359
|
-
console.error(`\n[${data.event}][${data.belong}][${data.AppName}][${data.fncName}][${err}]`);
|
|
360
|
-
console.error(`\n[${data.event}][${data.belong}][${data.AppName}][${data.fncName}][${false}]`);
|
|
410
|
+
console.error(`\n[${data.event}][${data.belong}][${data.AppName}][${data.fncName}][${false}]\n[${err}]`);
|
|
361
411
|
return false;
|
|
362
412
|
});
|
|
363
413
|
// 不是false都直接中断匹配
|
|
@@ -396,8 +446,7 @@ export async function typeMessage(e) {
|
|
|
396
446
|
return res;
|
|
397
447
|
})
|
|
398
448
|
.catch((err) => {
|
|
399
|
-
console.error(err);
|
|
400
|
-
console.error(`\n[${data.event}][${data.belong}][${data.AppName}][${data.fncName}][${false}]`);
|
|
449
|
+
console.error(`\n[${data.event}][${data.belong}][${data.AppName}][${data.fncName}][${false}]\n[${err}]`);
|
|
401
450
|
return false;
|
|
402
451
|
});
|
|
403
452
|
if (res) {
|
|
@@ -417,7 +466,6 @@ export async function typeMessage(e) {
|
|
|
417
466
|
* @param data
|
|
418
467
|
*/
|
|
419
468
|
function logErr(err, data) {
|
|
420
|
-
console.error(err);
|
|
421
|
-
console.error(`\n[${data.event}][${data.belong}][${data.AppName}][${data.fncName}][${false}]`);
|
|
469
|
+
console.error(`\n[${data.event}][${data.belong}][${data.AppName}][${data.fncName}][${false}]\n[${err}]`);
|
|
422
470
|
return;
|
|
423
471
|
}
|
package/lib/alemon/puppeteer.js
CHANGED
|
@@ -54,9 +54,11 @@ export async function pupStartCheck() {
|
|
|
54
54
|
/**
|
|
55
55
|
* 检测是否开启
|
|
56
56
|
*/
|
|
57
|
-
if (isBrowser
|
|
58
|
-
|
|
57
|
+
if (!isBrowser) {
|
|
58
|
+
const T = await startChrom();
|
|
59
|
+
if (!T) {
|
|
59
60
|
return false;
|
|
61
|
+
}
|
|
60
62
|
}
|
|
61
63
|
if (pic <= RestartControl) {
|
|
62
64
|
/**
|
|
@@ -90,18 +92,12 @@ export async function pupStartCheck() {
|
|
|
90
92
|
* @returns
|
|
91
93
|
*/
|
|
92
94
|
export async function screenshotByFile(htmlPath, Options) {
|
|
93
|
-
|
|
95
|
+
const T = await pupStartCheck();
|
|
96
|
+
if (!T) {
|
|
94
97
|
return false;
|
|
98
|
+
}
|
|
95
99
|
const { SOptions, tab = 'body', timeout = 120000 } = Options;
|
|
96
100
|
try {
|
|
97
|
-
/**
|
|
98
|
-
* 开始
|
|
99
|
-
*/
|
|
100
|
-
if (!isBrowser) {
|
|
101
|
-
if (!(await startChrom()))
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
console.info('[puppeteer] start');
|
|
105
101
|
/**
|
|
106
102
|
* 实例化
|
|
107
103
|
*/
|
|
@@ -148,13 +144,10 @@ export async function screenshotByFile(htmlPath, Options) {
|
|
|
148
144
|
* @returns
|
|
149
145
|
*/
|
|
150
146
|
export async function screenshotByUrl(val) {
|
|
151
|
-
|
|
147
|
+
const T = await pupStartCheck();
|
|
148
|
+
if (!T) {
|
|
152
149
|
return false;
|
|
153
|
-
if (!isBrowser) {
|
|
154
|
-
if (!(await startChrom()))
|
|
155
|
-
return false;
|
|
156
150
|
}
|
|
157
|
-
console.info('[puppeteer] start');
|
|
158
151
|
const { url, time, rand, params, tab, cache } = val;
|
|
159
152
|
if (!pageCache[url]) {
|
|
160
153
|
pageCache[url] = await browser.newPage();
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import redis from '../default/redis.js';
|
|
2
|
+
import mysql from '../default/mysql.js';
|
|
3
|
+
import server from '../default/server.js';
|
|
4
|
+
import puppeteer from '../default/pup.js';
|
|
5
|
+
import discord from '../default/login/discord.js';
|
|
6
|
+
import kook from '../default/login/kook.js';
|
|
7
|
+
import villa from '../default/login/villa.js';
|
|
8
|
+
import qq from '../default/login/qq.js';
|
|
9
|
+
import ntqq from '../default/login/ntqq.js';
|
|
10
|
+
/**
|
|
11
|
+
* bot-config
|
|
12
|
+
*/
|
|
13
|
+
const config = {
|
|
14
|
+
redis,
|
|
15
|
+
mysql,
|
|
16
|
+
discord,
|
|
17
|
+
kook,
|
|
18
|
+
villa,
|
|
19
|
+
qq,
|
|
20
|
+
ntqq,
|
|
21
|
+
server,
|
|
22
|
+
puppeteer
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* 初始化配置
|
|
26
|
+
* @param val
|
|
27
|
+
*/
|
|
28
|
+
export function setBotConfig(val) {
|
|
29
|
+
// 分布覆盖
|
|
30
|
+
for (const i in val) {
|
|
31
|
+
// 当且仅当存在同key的时候才会覆盖默认配置
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(config, i)) {
|
|
33
|
+
if (i == 'puppeteer') {
|
|
34
|
+
// pup 不用检查 直接覆盖
|
|
35
|
+
for (const j in val[i]) {
|
|
36
|
+
config[i][j] = val[i][j];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (const j in val[i]) {
|
|
41
|
+
// 当前仅当同属性名的时候才会覆盖默认配置
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(config[i], j)) {
|
|
43
|
+
config[i][j] = val[i][j];
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.info('[alemonjs][存在无效参数]', val[i]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
console.info('[alemonjs][存在无效参数]', val[i]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 设置
|
|
58
|
+
* @param key
|
|
59
|
+
* @param val
|
|
60
|
+
*/
|
|
61
|
+
export function setBotConfigByKey(key, val) {
|
|
62
|
+
if (key == 'puppeteer') {
|
|
63
|
+
// pup 不用检查 直接覆盖
|
|
64
|
+
for (const item in val) {
|
|
65
|
+
config[key][item] = val[item];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
for (const item in val) {
|
|
70
|
+
// 当前仅当同属性名的时候才会覆盖默认配置
|
|
71
|
+
if (Object.prototype.hasOwnProperty.call(config[key], item)) {
|
|
72
|
+
config[key][item] = val[item];
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
console.info('[alemonjs][存在无效参数]', val[item]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 得到配置
|
|
82
|
+
* @param key
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
export function getBotConfigByKey(key) {
|
|
86
|
+
return config[key];
|
|
87
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { arch } from 'os';
|
|
2
|
+
import { existsSync, realpathSync } from 'fs';
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
const isArch = arch();
|
|
5
|
+
const platform = process.platform;
|
|
6
|
+
const win32Edge = 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe';
|
|
7
|
+
// Downloa
|
|
8
|
+
let skipDownload = false;
|
|
9
|
+
// Path
|
|
10
|
+
let executablePath;
|
|
11
|
+
if (process.platform == 'win32' && existsSync(win32Edge)) {
|
|
12
|
+
// win32 Edge
|
|
13
|
+
skipDownload = true;
|
|
14
|
+
executablePath = win32Edge;
|
|
15
|
+
console.info('[Win32 Edge] start');
|
|
16
|
+
}
|
|
17
|
+
else if (platform == 'linux' || platform == 'android') {
|
|
18
|
+
// linux | android
|
|
19
|
+
const chromium = [
|
|
20
|
+
'whereis chrome-browser',
|
|
21
|
+
'whereis chrome',
|
|
22
|
+
'whereis chromium-browser',
|
|
23
|
+
'whereis chromium',
|
|
24
|
+
'whereis firefox'
|
|
25
|
+
];
|
|
26
|
+
// get path
|
|
27
|
+
for (const item of chromium) {
|
|
28
|
+
try {
|
|
29
|
+
const chromiumPath = execSync(item).toString().split(' ')[1]?.trim();
|
|
30
|
+
if (chromiumPath) {
|
|
31
|
+
skipDownload = true;
|
|
32
|
+
executablePath = realpathSync(chromiumPath);
|
|
33
|
+
console.info('[Chromium] start');
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error('Failed to get Chromium path:', error);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// not path
|
|
43
|
+
if (!skipDownload) {
|
|
44
|
+
/**
|
|
45
|
+
* search
|
|
46
|
+
*/
|
|
47
|
+
const arr = [
|
|
48
|
+
'/usr/bin/chromium',
|
|
49
|
+
'/snap/bin/chromium',
|
|
50
|
+
'/usr/bin/chromium-browser'
|
|
51
|
+
];
|
|
52
|
+
for (const item of arr) {
|
|
53
|
+
if (existsSync(item)) {
|
|
54
|
+
skipDownload = true;
|
|
55
|
+
executablePath = item;
|
|
56
|
+
console.info('[Chromium] start');
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// arm64/arrch64
|
|
62
|
+
if (isArch == 'arm64' || isArch == 'aarch64') {
|
|
63
|
+
console.info('[arm64/aarch64] system');
|
|
64
|
+
skipDownload = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @type {import("puppeteer").Configuration}
|
|
69
|
+
*/
|
|
70
|
+
export function getPupPath() {
|
|
71
|
+
return {
|
|
72
|
+
skipDownload,
|
|
73
|
+
executablePath
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GatewayIntentBits } from 'discord.js';
|
|
2
|
+
export default {
|
|
3
|
+
token: '',
|
|
4
|
+
masterID: '',
|
|
5
|
+
password: '',
|
|
6
|
+
intents: [
|
|
7
|
+
GatewayIntentBits.DirectMessageReactions,
|
|
8
|
+
GatewayIntentBits.DirectMessageTyping,
|
|
9
|
+
GatewayIntentBits.DirectMessages,
|
|
10
|
+
GatewayIntentBits.GuildMessageReactions,
|
|
11
|
+
GatewayIntentBits.GuildMessageTyping,
|
|
12
|
+
GatewayIntentBits.GuildMessages,
|
|
13
|
+
GatewayIntentBits.Guilds,
|
|
14
|
+
GatewayIntentBits.MessageContent // 消息内容
|
|
15
|
+
]
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
appID: '',
|
|
3
|
+
token: '',
|
|
4
|
+
secret: '',
|
|
5
|
+
masterID: '',
|
|
6
|
+
password: '',
|
|
7
|
+
intents: [
|
|
8
|
+
'GROUP_AT_MESSAGE_CREATE',
|
|
9
|
+
'C2C_MESSAGE_CREATE'
|
|
10
|
+
],
|
|
11
|
+
shard: [0, 1],
|
|
12
|
+
port: 9090,
|
|
13
|
+
size: 999999,
|
|
14
|
+
img_url: '/api/mys/img',
|
|
15
|
+
IMAGE_DIR: '/data/mys/img',
|
|
16
|
+
http: 'http'
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AvailableIntentsEventsEnum } from 'qq-guild-bot';
|
|
2
|
+
export default {
|
|
3
|
+
appID: '',
|
|
4
|
+
token: '',
|
|
5
|
+
secret: '',
|
|
6
|
+
masterID: '',
|
|
7
|
+
password: '',
|
|
8
|
+
intents: [
|
|
9
|
+
AvailableIntentsEventsEnum.GUILDS,
|
|
10
|
+
AvailableIntentsEventsEnum.PUBLIC_GUILD_MESSAGES,
|
|
11
|
+
AvailableIntentsEventsEnum.DIRECT_MESSAGE,
|
|
12
|
+
AvailableIntentsEventsEnum.GUILD_MEMBERS
|
|
13
|
+
],
|
|
14
|
+
isPrivate: false,
|
|
15
|
+
sandbox: false
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
headless: 'new',
|
|
3
|
+
timeout: 30000,
|
|
4
|
+
args: [
|
|
5
|
+
'--disable-gpu',
|
|
6
|
+
'--disable-dev-shm-usage',
|
|
7
|
+
'--disable-setuid-sandbox',
|
|
8
|
+
'--no-first-run',
|
|
9
|
+
'--no-sandbox',
|
|
10
|
+
'--no-zygote',
|
|
11
|
+
'--single-process'
|
|
12
|
+
],
|
|
13
|
+
skipDownload: true,
|
|
14
|
+
executablePath: 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
|
|
15
|
+
};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* *****
|
|
3
|
-
* ntqq
|
|
3
|
+
* ntqq订阅
|
|
4
4
|
* ****
|
|
5
5
|
*/
|
|
6
6
|
export var NtQQEventsEnum;
|
|
7
7
|
(function (NtQQEventsEnum) {
|
|
8
|
+
/**
|
|
9
|
+
* 群聊消息
|
|
10
|
+
*/
|
|
8
11
|
NtQQEventsEnum["GROUP_AT_MESSAGE_CREATE"] = "GROUP_AT_MESSAGE_CREATE";
|
|
9
|
-
|
|
12
|
+
/**
|
|
13
|
+
* 单聊消息
|
|
14
|
+
*/
|
|
15
|
+
NtQQEventsEnum["C2C_MESSAGE_CREATE"] = "C2C_MESSAGE_CREATE";
|
|
10
16
|
})(NtQQEventsEnum = NtQQEventsEnum || (NtQQEventsEnum = {}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ClientAPIByQQ as ClientByNTQQ } from '../ntqq/sdk/index.js';
|
|
2
|
+
import { Client as ClientByVILLA } from 'mys-villa';
|
|
3
|
+
import { KOOKApiClient as ClientByKOOK } from 'kook-ws';
|
|
4
|
+
/**
|
|
5
|
+
* discord客户端
|
|
6
|
+
*/
|
|
7
|
+
export const ClientDISCORD = {};
|
|
8
|
+
/**
|
|
9
|
+
* qq客户端
|
|
10
|
+
*/
|
|
11
|
+
export const ClientQQ = global.ClientAPIByQQ;
|
|
12
|
+
/**
|
|
13
|
+
* kook客户端
|
|
14
|
+
*/
|
|
15
|
+
export const ClientKOOK = ClientByKOOK;
|
|
16
|
+
/**
|
|
17
|
+
* ntqq客户端
|
|
18
|
+
*/
|
|
19
|
+
export const ClientNTQQ = ClientByNTQQ;
|
|
20
|
+
/**
|
|
21
|
+
* villa客户端
|
|
22
|
+
*/
|
|
23
|
+
export const ClientVILLA = ClientByVILLA;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
export function nodeScripts(name = 'node', file = '', ars = []) {
|
|
3
|
+
const command = spawn(`${name} ${file} ${ars.join(' ')}`, { shell: true });
|
|
4
|
+
command.stdout.on('data', data => {
|
|
5
|
+
process.stdout.write(data.toString());
|
|
6
|
+
});
|
|
7
|
+
command.stderr.on('data', data => {
|
|
8
|
+
process.stderr.write(data.toString());
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mkdirSync } from 'fs';
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
export async function command(cmd) {
|
|
4
|
+
// 错误参数
|
|
5
|
+
if (!cmd)
|
|
6
|
+
process.exit();
|
|
7
|
+
// 锁定位置
|
|
8
|
+
const dirPath = `./`;
|
|
9
|
+
// 没有存在
|
|
10
|
+
mkdirSync(dirPath, { recursive: true });
|
|
11
|
+
console.info('\n');
|
|
12
|
+
try {
|
|
13
|
+
// 切换目录
|
|
14
|
+
process.chdir(dirPath);
|
|
15
|
+
console.info(`[command] ${cmd}`);
|
|
16
|
+
execSync(cmd, { stdio: 'inherit' });
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.info(`${error}`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
}
|