@alemonjs/qq-bot 2.1.0-alpha.30 → 2.1.0-alpha.31
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/index.websoket.js +4 -1
- package/lib/sdk/api.js +18 -10
- package/lib/sdk/typing.d.ts +2 -0
- package/package.json +1 -1
package/lib/index.websoket.js
CHANGED
|
@@ -47,7 +47,10 @@ const start = () => {
|
|
|
47
47
|
is_private: config?.is_private ?? false,
|
|
48
48
|
sandbox: config?.sandbox ?? false,
|
|
49
49
|
shard: config?.shard ?? [0, 1],
|
|
50
|
-
mode: config?.mode ?? 'group'
|
|
50
|
+
mode: config?.mode ?? 'group',
|
|
51
|
+
gatewayURL: config?.gatewayURL,
|
|
52
|
+
base_url_gateway: config?.base_url_gateway,
|
|
53
|
+
base_url_app_access_token: config?.base_url_app_access_token
|
|
51
54
|
});
|
|
52
55
|
void client.connect(config?.gatewayURL);
|
|
53
56
|
register(client);
|
package/lib/sdk/api.js
CHANGED
|
@@ -12,12 +12,19 @@ class QQBotAPI {
|
|
|
12
12
|
getAuthentication() {
|
|
13
13
|
const app_id = config.get('app_id');
|
|
14
14
|
const secret = config.get('secret');
|
|
15
|
+
const baseUrlAppAccessToken = config.get('base_url_app_access_token');
|
|
16
|
+
const params = {
|
|
17
|
+
url: '/app/getAppAccessToken'
|
|
18
|
+
};
|
|
19
|
+
if (baseUrlAppAccessToken) {
|
|
20
|
+
params.baseURL = baseUrlAppAccessToken;
|
|
21
|
+
}
|
|
15
22
|
const service = axios.create({
|
|
16
23
|
baseURL: BOTS_API_RUL,
|
|
17
24
|
timeout: 20000
|
|
18
25
|
});
|
|
19
26
|
return createAxiosInstance(service, {
|
|
20
|
-
|
|
27
|
+
...params,
|
|
21
28
|
method: 'post',
|
|
22
29
|
data: {
|
|
23
30
|
appId: `${app_id}`,
|
|
@@ -53,20 +60,21 @@ class QQBotAPI {
|
|
|
53
60
|
}
|
|
54
61
|
gateway() {
|
|
55
62
|
const mode = config.get('mode');
|
|
63
|
+
const baseUrlGateway = config.get('base_url_gateway');
|
|
64
|
+
const params = {
|
|
65
|
+
url: '/gateway'
|
|
66
|
+
};
|
|
67
|
+
if (baseUrlGateway) {
|
|
68
|
+
params.baseURL = baseUrlGateway;
|
|
69
|
+
}
|
|
56
70
|
if (mode === 'group') {
|
|
57
|
-
return this.groupService(
|
|
58
|
-
url: '/gateway'
|
|
59
|
-
});
|
|
71
|
+
return this.groupService(params);
|
|
60
72
|
}
|
|
61
73
|
else if (mode === 'guild') {
|
|
62
|
-
return this.guildServer(
|
|
63
|
-
url: '/gateway'
|
|
64
|
-
});
|
|
74
|
+
return this.guildServer(params);
|
|
65
75
|
}
|
|
66
76
|
else {
|
|
67
|
-
return this.groupService(
|
|
68
|
-
url: '/gateway'
|
|
69
|
-
});
|
|
77
|
+
return this.groupService(params);
|
|
70
78
|
}
|
|
71
79
|
}
|
|
72
80
|
usersOpenMessages(openid, data) {
|
package/lib/sdk/typing.d.ts
CHANGED