alemonjs 1.0.39 → 1.0.40
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/lib/config/login.js +6 -6
- package/lib/core/apps.js +4 -4
- package/lib/core/dealmsg.js +9 -9
- package/lib/core/puppeteer.js +15 -15
- package/lib/core/qrcode.js +2 -2
- package/lib/core/screenshot.js +3 -3
- package/lib/default/types.js +1 -16
- package/lib/define/command.js +1 -1
- package/lib/define/main.js +4 -1
- package/lib/define/map.js +4 -4
- package/lib/koa/client.js +4 -4
- package/lib/koa/img.js +2 -2
- package/lib/kook/alemon/conversation.js +2 -2
- package/lib/kook/index.js +1 -1
- package/lib/kook/kook.js +1 -1
- package/lib/kook/login.js +2 -2
- package/lib/kook/sdk/ws.js +12 -12
- package/lib/log/event.js +2 -2
- package/lib/log/user.js +2 -2
- package/lib/login.js +1 -1
- package/lib/ntqq/alemon/message/C2C_MESSAGE_CREATE.js +3 -3
- package/lib/ntqq/alemon/message/GROUP_AT_MESSAGE_CREATE.js +3 -3
- package/lib/ntqq/index.js +1 -1
- package/lib/ntqq/login.js +5 -5
- package/lib/ntqq/ntqq.js +17 -1
- package/lib/ntqq/sdk/wss.js +12 -12
- package/lib/qq/alemon/conversation.js +10 -13
- package/lib/qq/alemon/e.js +4 -4
- package/lib/qq/alemon/message/DIRECT_MESSAGE.js +2 -2
- package/lib/qq/alemon/message/GUILD_MEMBERS.js +2 -2
- package/lib/qq/login.js +2 -2
- package/lib/qq/qq.js +1 -1
- package/lib/qq/sdk/wss.js +5 -5
- package/lib/run.js +2 -2
- package/lib/villa/alemon/conversation.js +1 -1
- package/lib/villa/alemon/message/e.js +4 -4
- package/lib/villa/index.js +1 -1
- package/lib/villa/login.js +2 -2
- package/lib/villa/sdk/client.js +9 -9
- package/lib/villa/sdk/hs.js +1 -1
- package/lib/villa/villa.js +1 -1
- package/package.json +1 -1
- package/run.js +2 -2
- package/types/config/types.d.ts +9 -6
- package/types/default/types.d.ts +27 -157
- package/types/define/types.d.ts +7 -3
- package/types/kook/kook.d.ts +20 -2
- package/types/ntqq/ntqq.d.ts +72 -4
- package/types/qq/qq.d.ts +44 -2
- package/types/villa/villa.d.ts +52 -2
- package/lib/default/typings.js +0 -1
- package/lib/ntqq/sdk/types.js +0 -1
- package/types/default/typings.d.ts +0 -50
- package/types/ntqq/sdk/types.d.ts +0 -11
package/lib/ntqq/login.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setBotConfigByKey, getBotConfigByKey } from '../config/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { NTQQEventsEnum } from './ntqq.js';
|
|
3
3
|
/**
|
|
4
4
|
* 登录配置
|
|
5
5
|
* @param Bcf
|
|
@@ -12,14 +12,14 @@ export async function checkRobotByQQ() {
|
|
|
12
12
|
(config.token ?? '') !== '') {
|
|
13
13
|
if (!config.intents) {
|
|
14
14
|
config.intents = [
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
NTQQEventsEnum.GROUP_AT_MESSAGE_CREATE,
|
|
16
|
+
NTQQEventsEnum.C2C_MESSAGE_CREATE
|
|
17
17
|
];
|
|
18
18
|
}
|
|
19
19
|
setBotConfigByKey('ntqq', config);
|
|
20
20
|
return true;
|
|
21
21
|
}
|
|
22
|
-
console.error('
|
|
23
|
-
console.error('
|
|
22
|
+
console.error('login', '-----------------------');
|
|
23
|
+
console.error('login', 'NTQQ config err');
|
|
24
24
|
return false;
|
|
25
25
|
}
|
package/lib/ntqq/ntqq.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* *****
|
|
3
|
+
* ntqq订阅
|
|
4
|
+
* ****
|
|
5
|
+
*/
|
|
6
|
+
export var NTQQEventsEnum;
|
|
7
|
+
(function (NTQQEventsEnum) {
|
|
8
|
+
/**
|
|
9
|
+
* 群聊消息
|
|
10
|
+
*/
|
|
11
|
+
NTQQEventsEnum["GROUP_AT_MESSAGE_CREATE"] = "GROUP_AT_MESSAGE_CREATE";
|
|
12
|
+
/**
|
|
13
|
+
* 单聊消息
|
|
14
|
+
*/
|
|
15
|
+
NTQQEventsEnum["C2C_MESSAGE_CREATE"] = "C2C_MESSAGE_CREATE";
|
|
16
|
+
})(NTQQEventsEnum = NTQQEventsEnum || (NTQQEventsEnum = {}));
|
|
17
|
+
export const defineNtqq = {
|
|
2
18
|
appID: '',
|
|
3
19
|
token: '',
|
|
4
20
|
secret: '',
|
package/lib/ntqq/sdk/wss.js
CHANGED
|
@@ -15,11 +15,11 @@ export async function getGatewayUrl() {
|
|
|
15
15
|
return response.url;
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
|
-
console.error('
|
|
18
|
+
console.error('http err:', null);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
|
-
console.error('
|
|
22
|
+
console.error('token err:', error.message);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
let reconnectAttempts = 0; // 重新连接计数器
|
|
@@ -36,10 +36,10 @@ export async function createClient(call, shard = [0, 1]) {
|
|
|
36
36
|
// 重新连接的逻辑
|
|
37
37
|
const reconnect = async () => {
|
|
38
38
|
if (reconnectAttempts >= 5) {
|
|
39
|
-
console.info('
|
|
39
|
+
console.info('The maximum number of reconnections has been reached, cancel reconnection');
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
console.info('
|
|
42
|
+
console.info('reconnecting...');
|
|
43
43
|
// 延迟一段时间后发起重新连接
|
|
44
44
|
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
45
45
|
// 调用createClient函数重新建立连接
|
|
@@ -49,7 +49,7 @@ export async function createClient(call, shard = [0, 1]) {
|
|
|
49
49
|
if (gatewayUrl) {
|
|
50
50
|
const ws = new WebSocket(gatewayUrl);
|
|
51
51
|
ws.on('open', () => {
|
|
52
|
-
console.info('
|
|
52
|
+
console.info('token ok');
|
|
53
53
|
});
|
|
54
54
|
/**
|
|
55
55
|
* 标记是否已连接
|
|
@@ -98,19 +98,19 @@ export async function createClient(call, shard = [0, 1]) {
|
|
|
98
98
|
}
|
|
99
99
|
// Resumed Event,恢复连接成功
|
|
100
100
|
if (t === 'RESUMED') {
|
|
101
|
-
console.info('
|
|
101
|
+
console.info('restore connection');
|
|
102
102
|
// 重制次数
|
|
103
103
|
reconnectAttempts = 0;
|
|
104
104
|
}
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
case 6: {
|
|
108
|
-
console.info('
|
|
108
|
+
console.info('connection attempt', message);
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
case 7: {
|
|
112
112
|
// 执行重新连接
|
|
113
|
-
console.info('
|
|
113
|
+
console.info('reconnect', message);
|
|
114
114
|
// 取消鉴权发送
|
|
115
115
|
if (power) {
|
|
116
116
|
clearInterval(power);
|
|
@@ -119,7 +119,7 @@ export async function createClient(call, shard = [0, 1]) {
|
|
|
119
119
|
break;
|
|
120
120
|
}
|
|
121
121
|
case 9: {
|
|
122
|
-
console.info('
|
|
122
|
+
console.info('parameter error', message);
|
|
123
123
|
break;
|
|
124
124
|
}
|
|
125
125
|
case 10: {
|
|
@@ -148,16 +148,16 @@ export async function createClient(call, shard = [0, 1]) {
|
|
|
148
148
|
}
|
|
149
149
|
case 11: {
|
|
150
150
|
// OpCode 11 Heartbeat ACK 消息,心跳发送成功
|
|
151
|
-
console.info('
|
|
151
|
+
console.info('heartbeat transmission', message);
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
154
|
case 12: {
|
|
155
|
-
console.info('
|
|
155
|
+
console.info('platform data', message);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
ws.on('close', () => {
|
|
160
|
-
console.info('[
|
|
160
|
+
console.info('[ws] close');
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -23,7 +23,7 @@ export const createConversationByQQ = ws => {
|
|
|
23
23
|
ws.on(SessionEvents.READY, async (data) => {
|
|
24
24
|
const cfg = getBotConfigByKey('qq');
|
|
25
25
|
if (cfg.sandbox)
|
|
26
|
-
console.info('
|
|
26
|
+
console.info('ready', data);
|
|
27
27
|
const robot = data.msg;
|
|
28
28
|
const bot = {
|
|
29
29
|
id: robot.user.id,
|
|
@@ -81,59 +81,56 @@ export const createConversationByQQ = ws => {
|
|
|
81
81
|
* 审核事件监听
|
|
82
82
|
*/
|
|
83
83
|
ws.on(AvailableIntentsEventsEnum.AUDIO_ACTION, AUDIO_ACTION);
|
|
84
|
-
console.info('
|
|
84
|
+
console.info('qq', 'Welcome back', bot.name);
|
|
85
85
|
});
|
|
86
86
|
/**
|
|
87
87
|
* 权限错误
|
|
88
88
|
*/
|
|
89
89
|
ws.on(SessionEvents.ERROR, (one) => {
|
|
90
|
-
console.error('
|
|
90
|
+
console.error('err', one);
|
|
91
91
|
});
|
|
92
92
|
/**
|
|
93
93
|
* 超长断连
|
|
94
94
|
*/
|
|
95
95
|
ws.on(SessionEvents.DEAD, (one) => {
|
|
96
|
-
console.error('
|
|
97
|
-
console.error('[AlemonJS]', '请确认配置!');
|
|
98
|
-
console.error('[AlemonJS]', '账户密码是否正确?');
|
|
99
|
-
console.error('[AlemonJS]', '域事件是否匹配?');
|
|
96
|
+
console.error('dead', one);
|
|
100
97
|
});
|
|
101
98
|
/**
|
|
102
99
|
* 关闭
|
|
103
100
|
*/
|
|
104
101
|
ws.on(SessionEvents.CLOSED, (one) => {
|
|
105
|
-
console.error('
|
|
102
|
+
console.error('close', one);
|
|
106
103
|
});
|
|
107
104
|
/**
|
|
108
105
|
* 断开连接
|
|
109
106
|
*/
|
|
110
107
|
ws.on(SessionEvents.DISCONNECT, (one) => {
|
|
111
|
-
console.error('
|
|
108
|
+
console.error('disconnect', one);
|
|
112
109
|
});
|
|
113
110
|
/**
|
|
114
111
|
* 无效会话
|
|
115
112
|
*/
|
|
116
113
|
ws.on(SessionEvents.INVALID_SESSION, (one) => {
|
|
117
|
-
console.error('
|
|
114
|
+
console.error('invalid session', one);
|
|
118
115
|
});
|
|
119
116
|
/**
|
|
120
117
|
* 再连接
|
|
121
118
|
*/
|
|
122
119
|
ws.on(SessionEvents.RECONNECT, (one) => {
|
|
123
|
-
console.error('
|
|
120
|
+
console.error('reconnect', one);
|
|
124
121
|
});
|
|
125
122
|
/**
|
|
126
123
|
* 重新开始
|
|
127
124
|
*/
|
|
128
125
|
ws.on(SessionEvents.RESUMED, (one) => {
|
|
129
|
-
console.error('
|
|
126
|
+
console.error('resumed', one);
|
|
130
127
|
});
|
|
131
128
|
/**
|
|
132
129
|
* WS断连
|
|
133
130
|
*/
|
|
134
131
|
ws.on(SessionEvents.EVENT_WS, async (one) => {
|
|
135
132
|
if (one.eventType == 'DISCONNECT') {
|
|
136
|
-
console.info('
|
|
133
|
+
console.info('ws disconnect', one);
|
|
137
134
|
}
|
|
138
135
|
});
|
|
139
136
|
};
|
package/lib/qq/alemon/e.js
CHANGED
|
@@ -5,7 +5,7 @@ export const now_e = {
|
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
7
|
replyCard: async (obj) => {
|
|
8
|
-
console.info('
|
|
8
|
+
console.info('to be implemented');
|
|
9
9
|
return false;
|
|
10
10
|
},
|
|
11
11
|
/**
|
|
@@ -15,7 +15,7 @@ export const now_e = {
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
replyByMid: async (mid, msg) => {
|
|
18
|
-
console.info('
|
|
18
|
+
console.info('to be implemented');
|
|
19
19
|
return false;
|
|
20
20
|
},
|
|
21
21
|
/**
|
|
@@ -25,7 +25,7 @@ export const now_e = {
|
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
27
|
replyEmoji: async (mid, boj) => {
|
|
28
|
-
console.info('
|
|
28
|
+
console.info('to be implemented');
|
|
29
29
|
return false;
|
|
30
30
|
},
|
|
31
31
|
/**
|
|
@@ -35,7 +35,7 @@ export const now_e = {
|
|
|
35
35
|
* @returns
|
|
36
36
|
*/
|
|
37
37
|
deleteEmoji: async (mid, boj) => {
|
|
38
|
-
console.info('
|
|
38
|
+
console.info('to be implemented');
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
};
|
|
@@ -146,7 +146,7 @@ async function directMessage(e, event) {
|
|
|
146
146
|
* @returns
|
|
147
147
|
*/
|
|
148
148
|
e.replyEmoji = async (mid, boj) => {
|
|
149
|
-
console.info('
|
|
149
|
+
console.info('temporarily unavailable');
|
|
150
150
|
return false;
|
|
151
151
|
};
|
|
152
152
|
/**
|
|
@@ -156,7 +156,7 @@ async function directMessage(e, event) {
|
|
|
156
156
|
* @returns
|
|
157
157
|
*/
|
|
158
158
|
e.deleteEmoji = async (mid, boj) => {
|
|
159
|
-
console.info('
|
|
159
|
+
console.info('temporarily unavailable');
|
|
160
160
|
return false;
|
|
161
161
|
};
|
|
162
162
|
e.msg_txt = event.msg.content;
|
|
@@ -41,11 +41,11 @@ export const GUILD_MEMBERS = async (event) => {
|
|
|
41
41
|
})
|
|
42
42
|
.catch(error);
|
|
43
43
|
if (typeof ChannelsData == 'boolean') {
|
|
44
|
-
console.info(
|
|
44
|
+
console.info(`[${Eevent}] [${eventType}] ${false}`);
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
47
|
if (ChannelsData.length == 0) {
|
|
48
|
-
console.info(
|
|
48
|
+
console.info(`[${Eevent}] [${eventType}] ${false}`);
|
|
49
49
|
return false;
|
|
50
50
|
}
|
|
51
51
|
const ChannelData = ChannelsData.find(item => item.type === 0);
|
package/lib/qq/login.js
CHANGED
|
@@ -21,7 +21,7 @@ export async function checkRobotByQQ() {
|
|
|
21
21
|
setBotConfigByKey('qq', config);
|
|
22
22
|
return true;
|
|
23
23
|
}
|
|
24
|
-
console.error('
|
|
25
|
-
console.error('
|
|
24
|
+
console.error('login', '-----------------------');
|
|
25
|
+
console.error('login', 'QQ config err');
|
|
26
26
|
return false;
|
|
27
27
|
}
|
package/lib/qq/qq.js
CHANGED
package/lib/qq/sdk/wss.js
CHANGED
|
@@ -15,11 +15,11 @@ export async function getGatewayUrl() {
|
|
|
15
15
|
return response.url;
|
|
16
16
|
}
|
|
17
17
|
else {
|
|
18
|
-
console.error('
|
|
18
|
+
console.error('http err:', null);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
|
-
console.error('
|
|
22
|
+
console.error('token err:', error.message);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
@@ -35,7 +35,7 @@ export async function createClient(callBack) {
|
|
|
35
35
|
if (gatewayUrl) {
|
|
36
36
|
const ws = new WebSocket(gatewayUrl);
|
|
37
37
|
ws.on('open', () => {
|
|
38
|
-
console.info('
|
|
38
|
+
console.info('token ok');
|
|
39
39
|
});
|
|
40
40
|
/**
|
|
41
41
|
* 标记是否已连接
|
|
@@ -116,7 +116,7 @@ export async function createClient(callBack) {
|
|
|
116
116
|
}
|
|
117
117
|
case 11: {
|
|
118
118
|
// OpCode 11 Heartbeat ACK 消息,心跳发送成功
|
|
119
|
-
console.info('
|
|
119
|
+
console.info('heartbeat transmission');
|
|
120
120
|
break;
|
|
121
121
|
}
|
|
122
122
|
case 12: {
|
|
@@ -125,7 +125,7 @@ export async function createClient(callBack) {
|
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
ws.on('close', () => {
|
|
128
|
-
console.error('
|
|
128
|
+
console.error('ws close');
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
}
|
package/lib/run.js
CHANGED
|
@@ -11,13 +11,13 @@ export function commandRun(ars) {
|
|
|
11
11
|
const argsWithoutFiles = msg.replace(/(\S+\.js|\S+\.ts)/g, '');
|
|
12
12
|
for (const item of files) {
|
|
13
13
|
if (!existsSync(join(process.cwd(), item))) {
|
|
14
|
-
console.info('
|
|
14
|
+
console.info('no file', item);
|
|
15
15
|
continue;
|
|
16
16
|
}
|
|
17
17
|
const isTypeScript = item.endsWith('.ts');
|
|
18
18
|
const command = isTypeScript ? 'npx ts-node' : 'node';
|
|
19
19
|
const cmd = `${command} ${item} ${argsWithoutFiles}`;
|
|
20
|
-
console.info(
|
|
20
|
+
console.info(cmd);
|
|
21
21
|
const childProcess = spawn(cmd, { shell: true });
|
|
22
22
|
childProcess.stdout.on('data', data => {
|
|
23
23
|
process.stdout.write(data.toString());
|
|
@@ -5,7 +5,7 @@ export const now_e = {
|
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
7
|
replyCard: async (arr) => {
|
|
8
|
-
console.info('
|
|
8
|
+
console.info('to be implemented');
|
|
9
9
|
return false;
|
|
10
10
|
},
|
|
11
11
|
/**
|
|
@@ -15,7 +15,7 @@ export const now_e = {
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
replyByMid: async (mid, msg) => {
|
|
18
|
-
console.info('
|
|
18
|
+
console.info('to be implemented');
|
|
19
19
|
return false;
|
|
20
20
|
},
|
|
21
21
|
/**
|
|
@@ -25,7 +25,7 @@ export const now_e = {
|
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
27
|
replyEmoji: async (mid, boj) => {
|
|
28
|
-
console.info('
|
|
28
|
+
console.info('to be implemented');
|
|
29
29
|
return false;
|
|
30
30
|
},
|
|
31
31
|
/**
|
|
@@ -35,7 +35,7 @@ export const now_e = {
|
|
|
35
35
|
* @returns
|
|
36
36
|
*/
|
|
37
37
|
deleteEmoji: async (mid, boj) => {
|
|
38
|
-
console.info('
|
|
38
|
+
console.info('to be implemented');
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
};
|
package/lib/villa/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export async function createAlemonByVilla() {
|
|
|
20
20
|
callback_port: cfg.port ?? 8080,
|
|
21
21
|
callback_url: cfg.url ?? '/api/mys/callback'
|
|
22
22
|
}, callBackByVilla, async () => {
|
|
23
|
-
console.info('
|
|
23
|
+
console.info('VILLA Welcome back');
|
|
24
24
|
});
|
|
25
25
|
return true;
|
|
26
26
|
}
|
package/lib/villa/login.js
CHANGED
|
@@ -15,7 +15,7 @@ export async function checkRobotByVilla() {
|
|
|
15
15
|
setBotConfigByKey('villa', config);
|
|
16
16
|
return true;
|
|
17
17
|
}
|
|
18
|
-
console.error('
|
|
19
|
-
console.error('
|
|
18
|
+
console.error('login', '-----------------------');
|
|
19
|
+
console.error('login', 'VILLA config err');
|
|
20
20
|
return false;
|
|
21
21
|
}
|
package/lib/villa/sdk/client.js
CHANGED
|
@@ -39,11 +39,11 @@ export function createClient({ bot_id, bot_secret, callback_url = '/api/mys/call
|
|
|
39
39
|
/**
|
|
40
40
|
* 处理完毕后返回响应
|
|
41
41
|
*/
|
|
42
|
-
ctx.body = { message: '
|
|
42
|
+
ctx.body = { message: 'error callback', retcode: 0 };
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
await callBack(event).catch(err => {
|
|
46
|
-
console.error('
|
|
46
|
+
console.error('callback error');
|
|
47
47
|
console.error(err);
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -52,11 +52,11 @@ export function createClient({ bot_id, bot_secret, callback_url = '/api/mys/call
|
|
|
52
52
|
/**
|
|
53
53
|
* 处理完毕后返回响应
|
|
54
54
|
*/
|
|
55
|
-
ctx.body = { message: '
|
|
55
|
+
ctx.body = { message: 'execution error', retcode: 0 };
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
// 处理完毕后返回响应
|
|
59
|
-
ctx.body = { message: '
|
|
59
|
+
ctx.body = { message: 'processing completed', retcode: 0 };
|
|
60
60
|
});
|
|
61
61
|
/**
|
|
62
62
|
* 将路由注册到应用
|
|
@@ -72,17 +72,17 @@ export function createClient({ bot_id, bot_secret, callback_url = '/api/mys/call
|
|
|
72
72
|
*/
|
|
73
73
|
function handlePortConflict(err) {
|
|
74
74
|
if (err.code === 'EADDRINUSE') {
|
|
75
|
-
console.error(
|
|
75
|
+
console.error(`port ${currentPort} occupied, attempting to start a new port...`);
|
|
76
76
|
currentPort++;
|
|
77
77
|
size++;
|
|
78
78
|
if (size >= 10) {
|
|
79
|
-
console.error('
|
|
79
|
+
console.error('find port err');
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
createApp(currentPort);
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
85
|
-
console.error('
|
|
85
|
+
console.error('an error occurred while starting the application', err);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
@@ -110,10 +110,10 @@ export function createClient({ bot_id, bot_secret, callback_url = '/api/mys/call
|
|
|
110
110
|
// 获取ip4
|
|
111
111
|
const ip = await getIP();
|
|
112
112
|
if (ip) {
|
|
113
|
-
console.info('
|
|
113
|
+
console.info('villa open', `http://${ip}:${port ?? 8080}${callback_url ?? '/api/mys/callback'}`);
|
|
114
114
|
}
|
|
115
115
|
else {
|
|
116
|
-
console.error('
|
|
116
|
+
console.error('vllia no public ip');
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
})
|
package/lib/villa/sdk/hs.js
CHANGED
package/lib/villa/villa.js
CHANGED
package/package.json
CHANGED
package/run.js
CHANGED
|
@@ -11,13 +11,13 @@ export function commandRun(ars) {
|
|
|
11
11
|
const argsWithoutFiles = msg.replace(/(\S+\.js|\S+\.ts)/g, '')
|
|
12
12
|
for (const item of files) {
|
|
13
13
|
if (!existsSync(join(process.cwd(), item))) {
|
|
14
|
-
console.log('
|
|
14
|
+
console.log('no file', item)
|
|
15
15
|
continue
|
|
16
16
|
}
|
|
17
17
|
const isTypeScript = item.endsWith('.ts')
|
|
18
18
|
const command = isTypeScript ? 'npx ts-node' : 'node'
|
|
19
19
|
const cmd = `${command} ${item} ${argsWithoutFiles}`
|
|
20
|
-
console.log(
|
|
20
|
+
console.log(cmd)
|
|
21
21
|
const childProcess = spawn(cmd, { shell: true })
|
|
22
22
|
childProcess.stdout.on('data', data => {
|
|
23
23
|
process.stdout.write(data.toString())
|
package/types/config/types.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { PuppeteerLaunchOptions } from 'puppeteer';
|
|
2
|
-
import {
|
|
3
|
-
import { MysqlOptions, RedisOptions } from '../default/typings.js';
|
|
2
|
+
import { MysqlOptions, RedisOptions } from '../default/types.js';
|
|
4
3
|
import { ServerOptions } from '../koa/types.js';
|
|
4
|
+
import { KOOKOptions } from '../kook/kook.js';
|
|
5
|
+
import { VILLAOptions } from '../villa/villa.js';
|
|
6
|
+
import { QQOptions } from '../qq/qq.js';
|
|
7
|
+
import { NTQQOptions } from '../ntqq/ntqq.js';
|
|
5
8
|
/**
|
|
6
9
|
* ******
|
|
7
10
|
* config
|
|
@@ -10,10 +13,10 @@ import { ServerOptions } from '../koa/types.js';
|
|
|
10
13
|
export interface ConfigType {
|
|
11
14
|
redis: RedisOptions;
|
|
12
15
|
mysql: MysqlOptions;
|
|
13
|
-
kook:
|
|
14
|
-
villa:
|
|
15
|
-
qq:
|
|
16
|
+
kook: KOOKOptions;
|
|
17
|
+
villa: VILLAOptions;
|
|
18
|
+
qq: QQOptions;
|
|
16
19
|
server: ServerOptions;
|
|
17
20
|
puppeteer: PuppeteerLaunchOptions;
|
|
18
|
-
ntqq:
|
|
21
|
+
ntqq: NTQQOptions;
|
|
19
22
|
}
|