@alemonjs/discord 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 +2 -1
- package/lib/index.js +12 -5
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { DCClient } from './sdk/platform/discord/sdk/wss.js';
|
|
|
3
3
|
|
|
4
4
|
type Client = typeof DCClient.prototype;
|
|
5
5
|
declare const client: Client;
|
|
6
|
+
declare const platform = "discord";
|
|
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
|
@@ -9,7 +9,15 @@ import 'file-type';
|
|
|
9
9
|
import 'form-data';
|
|
10
10
|
import { DCClient } from './sdk/platform/discord/sdk/wss.js';
|
|
11
11
|
|
|
12
|
-
const client =
|
|
12
|
+
const client = new Proxy({}, {
|
|
13
|
+
get: (_, prop) => {
|
|
14
|
+
if (prop in global.client) {
|
|
15
|
+
return global.client[prop];
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const platform = 'discord';
|
|
13
21
|
var index = defineBot(() => {
|
|
14
22
|
const value = getConfigValue();
|
|
15
23
|
const config = value?.discord;
|
|
@@ -19,7 +27,6 @@ var index = defineBot(() => {
|
|
|
19
27
|
const client = new DCClient({
|
|
20
28
|
token: config.token
|
|
21
29
|
});
|
|
22
|
-
const Platform = 'discord';
|
|
23
30
|
// 连接
|
|
24
31
|
client.connect();
|
|
25
32
|
// 监听消息
|
|
@@ -44,7 +51,7 @@ var index = defineBot(() => {
|
|
|
44
51
|
}
|
|
45
52
|
const UserId = event.author.id;
|
|
46
53
|
const UserKey = useUserHashKey({
|
|
47
|
-
Platform:
|
|
54
|
+
Platform: platform,
|
|
48
55
|
UserId: UserId
|
|
49
56
|
});
|
|
50
57
|
let url = null;
|
|
@@ -73,7 +80,7 @@ var index = defineBot(() => {
|
|
|
73
80
|
// 定义消
|
|
74
81
|
const e = {
|
|
75
82
|
// 事件类型
|
|
76
|
-
Platform:
|
|
83
|
+
Platform: platform,
|
|
77
84
|
// guild
|
|
78
85
|
GuildId: event.guild_id,
|
|
79
86
|
ChannelId: event.channel_id,
|
|
@@ -210,4 +217,4 @@ var index = defineBot(() => {
|
|
|
210
217
|
};
|
|
211
218
|
});
|
|
212
219
|
|
|
213
|
-
export { client, index as default };
|
|
220
|
+
export { client, index as default, platform };
|