@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.
@@ -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
- url: '/app/getAppAccessToken',
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) {
@@ -68,4 +68,6 @@ export interface Options {
68
68
  port?: string;
69
69
  ws?: string;
70
70
  gatewayURL?: string;
71
+ base_url_gateway?: string;
72
+ base_url_app_access_token?: string;
71
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/qq-bot",
3
- "version": "2.1.0-alpha.30",
3
+ "version": "2.1.0-alpha.31",
4
4
  "description": "阿柠檬qq-bot平台连接",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",