@alemonjs/kook 0.2.0 → 0.2.1

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.d.ts CHANGED
@@ -2,7 +2,8 @@ import * as alemonjs from 'alemonjs';
2
2
  import { KOOKClient } from './sdk/platform/kook/sdk/wss.js';
3
3
 
4
4
  type Client = typeof KOOKClient.prototype;
5
+ declare const platform = "gui";
5
6
  declare const client: Client;
6
7
  declare const _default: () => alemonjs.ClientAPI;
7
8
 
8
- export { type Client, client, _default as default };
9
+ export { type Client, client, _default as default, platform };
package/lib/index.js CHANGED
@@ -10,7 +10,15 @@ import 'form-data';
10
10
  import './sdk/platform/kook/sdk/typings.js';
11
11
  import { KOOKClient } from './sdk/platform/kook/sdk/wss.js';
12
12
 
13
- const client = global.client;
13
+ const platform = 'gui';
14
+ const client = new Proxy({}, {
15
+ get: (_, prop) => {
16
+ if (prop in global.client) {
17
+ return global.client[prop];
18
+ }
19
+ return undefined;
20
+ }
21
+ });
14
22
  var index = defineBot(() => {
15
23
  const value = getConfigValue();
16
24
  const config = value?.kook;
@@ -20,7 +28,6 @@ var index = defineBot(() => {
20
28
  const client = new KOOKClient({
21
29
  token: config.token
22
30
  });
23
- const Platform = 'kook';
24
31
  // 连接
25
32
  client.connect();
26
33
  client.on('MESSAGES_DIRECT', async (event) => {
@@ -50,13 +57,13 @@ var index = defineBot(() => {
50
57
  };
51
58
  const UserId = event.author_id;
52
59
  const UserKey = useUserHashKey({
53
- Platform,
60
+ Platform: platform,
54
61
  UserId
55
62
  });
56
63
  // 定义消
57
64
  const e = {
58
65
  // 事件类型
59
- Platform: Platform,
66
+ Platform: platform,
60
67
  // 用户Id
61
68
  UserId: UserId,
62
69
  UserKey,
@@ -127,13 +134,13 @@ var index = defineBot(() => {
127
134
  };
128
135
  const UserId = event.author_id;
129
136
  const UserKey = useUserHashKey({
130
- Platform,
137
+ Platform: platform,
131
138
  UserId
132
139
  });
133
140
  // 定义消
134
141
  const e = {
135
142
  // 事件类型
136
- Platform: Platform,
143
+ Platform: platform,
137
144
  //
138
145
  GuildId: event.extra.guild_id,
139
146
  ChannelId: event.target_id,
@@ -251,7 +258,7 @@ var index = defineBot(() => {
251
258
  UserId: item.role_id,
252
259
  UserName: item.name,
253
260
  UserKey: useUserHashKey({
254
- Platform,
261
+ Platform: platform,
255
262
  UserId: item.role_id
256
263
  }),
257
264
  IsMaster: false,
@@ -268,7 +275,7 @@ var index = defineBot(() => {
268
275
  UserId: item.id,
269
276
  UserName: item.username,
270
277
  UserKey: useUserHashKey({
271
- Platform,
278
+ Platform: platform,
272
279
  UserId: item.role_id
273
280
  }),
274
281
  IsMaster: false,
@@ -282,4 +289,4 @@ var index = defineBot(() => {
282
289
  };
283
290
  });
284
291
 
285
- export { client, index as default };
292
+ export { client, index as default, platform };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/kook",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "kook-bot",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",