@alemonjs/discord 2.1.11 → 2.1.12
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/dist/assets/index.css +1 -1
- package/dist/assets/index.js +5 -5
- package/lib/desktop.js +4 -4
- package/lib/hook.d.ts +9 -0
- package/lib/hook.js +1 -1
- package/lib/index.js +115 -230
- package/package.json +2 -2
package/lib/desktop.js
CHANGED
|
@@ -3,16 +3,16 @@ import { dirname, join } from 'path';
|
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { getConfig, getConfigValue } from 'alemonjs';
|
|
5
5
|
|
|
6
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
const activate = context => {
|
|
8
8
|
const webView = context.createSidebarWebView(context);
|
|
9
9
|
context.onCommand('open.discord', () => {
|
|
10
|
-
const dir = join(__dirname, '../', 'dist', 'index.html');
|
|
10
|
+
const dir = join(__dirname$1, '../', 'dist', 'index.html');
|
|
11
11
|
const scriptReg = /<script.*?src="(.+?)".*?>/;
|
|
12
12
|
const styleReg = /<link.*?rel="stylesheet".*?href="(.+?)".*?>/;
|
|
13
13
|
const iconReg = /<link.*?rel="icon".*?href="(.+?)".*?>/g;
|
|
14
|
-
const styleUri = context.createExtensionDir(join(__dirname, '../', 'dist', 'assets', 'index.css'));
|
|
15
|
-
const scriptUri = context.createExtensionDir(join(__dirname, '../', 'dist', 'assets', 'index.js'));
|
|
14
|
+
const styleUri = context.createExtensionDir(join(__dirname$1, '../', 'dist', 'assets', 'index.css'));
|
|
15
|
+
const scriptUri = context.createExtensionDir(join(__dirname$1, '../', 'dist', 'assets', 'index.js'));
|
|
16
16
|
const html = readFileSync(dir, 'utf-8')
|
|
17
17
|
.replace(iconReg, '')
|
|
18
18
|
.replace(scriptReg, `<script type="module" crossorigin src="${scriptUri}"></script>`)
|
package/lib/hook.d.ts
CHANGED
|
@@ -19,8 +19,17 @@ type MAP = {
|
|
|
19
19
|
'member.remove': undefined;
|
|
20
20
|
'private.message.update': undefined;
|
|
21
21
|
'private.message.delete': undefined;
|
|
22
|
+
'message.pin': undefined;
|
|
23
|
+
'channel.update': undefined;
|
|
24
|
+
'guild.update': undefined;
|
|
25
|
+
'member.ban': undefined;
|
|
26
|
+
'member.unban': undefined;
|
|
27
|
+
'member.update': undefined;
|
|
28
|
+
'notice.create': undefined;
|
|
22
29
|
'private.friend.add': undefined;
|
|
30
|
+
'private.friend.remove': undefined;
|
|
23
31
|
'private.guild.add': undefined;
|
|
32
|
+
'private.notice.create': undefined;
|
|
24
33
|
};
|
|
25
34
|
export declare const useValue: <T extends EventKeys>(event: Events[T]) => readonly [MAP[T]];
|
|
26
35
|
export declare const useClient: <T extends EventKeys>(event: Events[T]) => readonly [API, MAP[T]];
|
package/lib/hook.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { sendchannel, senduser } from './send.js';
|
|
2
2
|
import { DCClient } from './sdk/wss.js';
|
|
3
|
-
import { definePlatform, cbpPlatform, createResult, ResultCode } from 'alemonjs';
|
|
3
|
+
import { definePlatform, cbpPlatform, FormatEvent, createResult, ResultCode } from 'alemonjs';
|
|
4
4
|
import { getMaster, platform } from './config.js';
|
|
5
5
|
export { DCAPI as API } from './sdk/api.js';
|
|
6
6
|
export { useClient, useValue } from './hook.js';
|
|
@@ -38,45 +38,24 @@ const main = () => {
|
|
|
38
38
|
const [isMaster, UserKey] = getMaster(UserId);
|
|
39
39
|
const UserAvatar = createUserAvatar(UserId, event.author.avatar);
|
|
40
40
|
if (event.type === 0 && event.member) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
UserAvatar: UserAvatar,
|
|
51
|
-
IsMaster: isMaster,
|
|
52
|
-
IsBot: false,
|
|
53
|
-
OpenId: UserId,
|
|
54
|
-
MessageId: event.id,
|
|
55
|
-
MessageText: msg,
|
|
56
|
-
BotId: botId,
|
|
57
|
-
_tag: 'message.create',
|
|
58
|
-
value: event
|
|
59
|
-
};
|
|
60
|
-
cbp.send(e);
|
|
41
|
+
cbp.send(FormatEvent.create('message.create')
|
|
42
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
43
|
+
.addGuild({ GuildId: event.guild_id, SpaceId: event.channel_id })
|
|
44
|
+
.addChannel({ ChannelId: event.channel_id })
|
|
45
|
+
.addUser({ UserId, UserKey, UserName: event.author.username, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
|
|
46
|
+
.addMessage({ MessageId: event.id })
|
|
47
|
+
.addText({ MessageText: msg })
|
|
48
|
+
.addOpen({ OpenId: UserId })
|
|
49
|
+
.add({ tag: 'message.create' }).value);
|
|
61
50
|
}
|
|
62
51
|
else if (event.type === 0 && !event.member) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
IsMaster: isMaster,
|
|
71
|
-
IsBot: false,
|
|
72
|
-
OpenId: UserId,
|
|
73
|
-
MessageId: event.id,
|
|
74
|
-
MessageText: msg,
|
|
75
|
-
BotId: botId,
|
|
76
|
-
_tag: 'private.message.create',
|
|
77
|
-
value: event
|
|
78
|
-
};
|
|
79
|
-
cbp.send(e);
|
|
52
|
+
cbp.send(FormatEvent.create('private.message.create')
|
|
53
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
54
|
+
.addUser({ UserId, UserKey, UserName: event.author.username, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
|
|
55
|
+
.addMessage({ MessageId: event.id })
|
|
56
|
+
.addText({ MessageText: msg })
|
|
57
|
+
.addOpen({ OpenId: UserId })
|
|
58
|
+
.add({ tag: 'private.message.create' }).value);
|
|
80
59
|
}
|
|
81
60
|
else ;
|
|
82
61
|
});
|
|
@@ -89,45 +68,24 @@ const main = () => {
|
|
|
89
68
|
const [isMaster, UserKey] = getMaster(UserId);
|
|
90
69
|
const MessageText = event.data.custom_id;
|
|
91
70
|
if (isPrivate) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
IsMaster: isMaster,
|
|
100
|
-
IsBot: false,
|
|
101
|
-
OpenId: UserId,
|
|
102
|
-
MessageId: event.id,
|
|
103
|
-
MessageText: MessageText,
|
|
104
|
-
BotId: botId,
|
|
105
|
-
_tag: 'private.interaction.create',
|
|
106
|
-
value: event
|
|
107
|
-
};
|
|
108
|
-
cbp.send(e);
|
|
71
|
+
cbp.send(FormatEvent.create('private.interaction.create')
|
|
72
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
73
|
+
.addUser({ UserId, UserKey, UserName: UserName, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
|
|
74
|
+
.addMessage({ MessageId: event.id })
|
|
75
|
+
.addText({ MessageText: MessageText })
|
|
76
|
+
.addOpen({ OpenId: UserId })
|
|
77
|
+
.add({ tag: 'private.interaction.create' }).value);
|
|
109
78
|
}
|
|
110
79
|
else {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
UserAvatar: UserAvatar,
|
|
121
|
-
IsMaster: isMaster,
|
|
122
|
-
IsBot: false,
|
|
123
|
-
MessageId: event.id,
|
|
124
|
-
MessageText: MessageText,
|
|
125
|
-
OpenId: UserId,
|
|
126
|
-
BotId: botId,
|
|
127
|
-
_tag: 'interaction.create',
|
|
128
|
-
value: event
|
|
129
|
-
};
|
|
130
|
-
cbp.send(e);
|
|
80
|
+
cbp.send(FormatEvent.create('interaction.create')
|
|
81
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
82
|
+
.addGuild({ GuildId: event['guild_id'], SpaceId: event.channel_id })
|
|
83
|
+
.addChannel({ ChannelId: event.channel_id })
|
|
84
|
+
.addUser({ UserId, UserKey, UserName: UserName, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
|
|
85
|
+
.addMessage({ MessageId: event.id })
|
|
86
|
+
.addText({ MessageText: MessageText })
|
|
87
|
+
.addOpen({ OpenId: UserId })
|
|
88
|
+
.add({ tag: 'interaction.create' }).value);
|
|
131
89
|
}
|
|
132
90
|
void client.interactionsCallback(event.id, event.token, MessageText);
|
|
133
91
|
});
|
|
@@ -138,176 +96,95 @@ const main = () => {
|
|
|
138
96
|
const UserId = event.author.id;
|
|
139
97
|
const [isMaster, UserKey] = getMaster(UserId);
|
|
140
98
|
const UserAvatar = createUserAvatar(UserId, event.author.avatar);
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
UserKey,
|
|
149
|
-
UserName: event.author.username,
|
|
150
|
-
UserAvatar: UserAvatar,
|
|
151
|
-
IsMaster: isMaster,
|
|
152
|
-
IsBot: event.author.bot ?? false,
|
|
153
|
-
MessageId: event.id,
|
|
154
|
-
BotId: botId,
|
|
155
|
-
_tag: 'MESSAGE_UPDATE',
|
|
156
|
-
value: event
|
|
157
|
-
};
|
|
158
|
-
cbp.send(e);
|
|
99
|
+
cbp.send(FormatEvent.create('message.update')
|
|
100
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
101
|
+
.addGuild({ GuildId: event.guild_id, SpaceId: event.channel_id })
|
|
102
|
+
.addChannel({ ChannelId: event.channel_id })
|
|
103
|
+
.addUser({ UserId, UserKey, UserName: event.author.username, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: event.author.bot ?? false })
|
|
104
|
+
.addMessage({ MessageId: event.id })
|
|
105
|
+
.add({ tag: 'MESSAGE_UPDATE' }).value);
|
|
159
106
|
});
|
|
160
107
|
client.on('MESSAGE_DELETE', event => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
MessageId: event.id,
|
|
168
|
-
BotId: botId,
|
|
169
|
-
_tag: 'MESSAGE_DELETE',
|
|
170
|
-
value: event
|
|
171
|
-
};
|
|
172
|
-
cbp.send(e);
|
|
108
|
+
cbp.send(FormatEvent.create('message.delete')
|
|
109
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
110
|
+
.addGuild({ GuildId: event.guild_id, SpaceId: event.channel_id })
|
|
111
|
+
.addChannel({ ChannelId: event.channel_id })
|
|
112
|
+
.addMessage({ MessageId: event.id })
|
|
113
|
+
.add({ tag: 'MESSAGE_DELETE' }).value);
|
|
173
114
|
});
|
|
174
115
|
client.on('MESSAGE_REACTION_ADD', event => {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
MessageId: event.message_id,
|
|
182
|
-
BotId: botId,
|
|
183
|
-
_tag: 'MESSAGE_REACTION_ADD',
|
|
184
|
-
value: event
|
|
185
|
-
};
|
|
186
|
-
cbp.send(e);
|
|
116
|
+
cbp.send(FormatEvent.create('message.reaction.add')
|
|
117
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
118
|
+
.addGuild({ GuildId: event.guild_id, SpaceId: event.channel_id })
|
|
119
|
+
.addChannel({ ChannelId: event.channel_id })
|
|
120
|
+
.addMessage({ MessageId: event.message_id })
|
|
121
|
+
.add({ tag: 'MESSAGE_REACTION_ADD' }).value);
|
|
187
122
|
});
|
|
188
123
|
client.on('MESSAGE_REACTION_REMOVE', event => {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
MessageId: event['message_id'],
|
|
196
|
-
BotId: botId,
|
|
197
|
-
_tag: 'MESSAGE_REACTION_REMOVE',
|
|
198
|
-
value: event
|
|
199
|
-
};
|
|
200
|
-
cbp.send(e);
|
|
124
|
+
cbp.send(FormatEvent.create('message.reaction.remove')
|
|
125
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
126
|
+
.addGuild({ GuildId: event['guild_id'], SpaceId: event['channel_id'] })
|
|
127
|
+
.addChannel({ ChannelId: event['channel_id'] })
|
|
128
|
+
.addMessage({ MessageId: event['message_id'] })
|
|
129
|
+
.add({ tag: 'MESSAGE_REACTION_REMOVE' }).value);
|
|
201
130
|
});
|
|
202
131
|
client.on('GUILD_MEMBER_ADD', event => {
|
|
203
132
|
const UserId = event.user.id;
|
|
204
133
|
const [isMaster, UserKey] = getMaster(UserId);
|
|
205
134
|
const UserAvatar = createUserAvatar(UserId, event.user.avatar);
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
UserKey,
|
|
214
|
-
UserName: event.user.username,
|
|
215
|
-
UserAvatar: UserAvatar,
|
|
216
|
-
IsMaster: isMaster,
|
|
217
|
-
IsBot: false,
|
|
218
|
-
MessageId: '',
|
|
219
|
-
BotId: botId,
|
|
220
|
-
_tag: 'GUILD_MEMBER_ADD',
|
|
221
|
-
value: event
|
|
222
|
-
};
|
|
223
|
-
cbp.send(e);
|
|
135
|
+
cbp.send(FormatEvent.create('member.add')
|
|
136
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
137
|
+
.addGuild({ GuildId: event.guild_id, SpaceId: event.guild_id })
|
|
138
|
+
.addChannel({ ChannelId: '' })
|
|
139
|
+
.addUser({ UserId, UserKey, UserName: event.user.username, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
|
|
140
|
+
.addMessage({ MessageId: '' })
|
|
141
|
+
.add({ tag: 'GUILD_MEMBER_ADD' }).value);
|
|
224
142
|
});
|
|
225
143
|
client.on('GUILD_MEMBER_REMOVE', event => {
|
|
226
144
|
const UserId = event.user.id;
|
|
227
145
|
const [isMaster, UserKey] = getMaster(UserId);
|
|
228
146
|
const UserAvatar = createUserAvatar(UserId, event.user.avatar);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
UserKey,
|
|
237
|
-
UserName: event.user.username,
|
|
238
|
-
UserAvatar: UserAvatar,
|
|
239
|
-
IsMaster: isMaster,
|
|
240
|
-
IsBot: false,
|
|
241
|
-
MessageId: '',
|
|
242
|
-
BotId: botId,
|
|
243
|
-
_tag: 'GUILD_MEMBER_REMOVE',
|
|
244
|
-
value: event
|
|
245
|
-
};
|
|
246
|
-
cbp.send(e);
|
|
147
|
+
cbp.send(FormatEvent.create('member.remove')
|
|
148
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
149
|
+
.addGuild({ GuildId: event.guild_id, SpaceId: event.guild_id })
|
|
150
|
+
.addChannel({ ChannelId: '' })
|
|
151
|
+
.addUser({ UserId, UserKey, UserName: event.user.username, UserAvatar: UserAvatar, IsMaster: isMaster, IsBot: false })
|
|
152
|
+
.addMessage({ MessageId: '' })
|
|
153
|
+
.add({ tag: 'GUILD_MEMBER_REMOVE' }).value);
|
|
247
154
|
});
|
|
248
155
|
client.on('CHANNEL_CREATE', event => {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
MessageId: '',
|
|
256
|
-
BotId: botId,
|
|
257
|
-
_tag: 'CHANNEL_CREATE',
|
|
258
|
-
value: event
|
|
259
|
-
};
|
|
260
|
-
cbp.send(e);
|
|
156
|
+
cbp.send(FormatEvent.create('channel.create')
|
|
157
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
158
|
+
.addGuild({ GuildId: event.guild_id ?? '', SpaceId: event.guild_id ?? '' })
|
|
159
|
+
.addChannel({ ChannelId: event.id ?? '' })
|
|
160
|
+
.addMessage({ MessageId: '' })
|
|
161
|
+
.add({ tag: 'CHANNEL_CREATE' }).value);
|
|
261
162
|
});
|
|
262
163
|
client.on('CHANNEL_DELETE', event => {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
MessageId: '',
|
|
270
|
-
BotId: botId,
|
|
271
|
-
_tag: 'CHANNEL_DELETE',
|
|
272
|
-
value: event
|
|
273
|
-
};
|
|
274
|
-
cbp.send(e);
|
|
164
|
+
cbp.send(FormatEvent.create('channel.delete')
|
|
165
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
166
|
+
.addGuild({ GuildId: event.guild_id ?? '', SpaceId: event.guild_id ?? '' })
|
|
167
|
+
.addChannel({ ChannelId: event.id ?? '' })
|
|
168
|
+
.addMessage({ MessageId: '' })
|
|
169
|
+
.add({ tag: 'CHANNEL_DELETE' }).value);
|
|
275
170
|
});
|
|
276
171
|
client.on('GUILD_CREATE', event => {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
UserKey: '',
|
|
285
|
-
IsMaster: false,
|
|
286
|
-
IsBot: false,
|
|
287
|
-
MessageId: '',
|
|
288
|
-
BotId: botId,
|
|
289
|
-
_tag: 'GUILD_CREATE',
|
|
290
|
-
value: event
|
|
291
|
-
};
|
|
292
|
-
cbp.send(e);
|
|
172
|
+
cbp.send(FormatEvent.create('guild.join')
|
|
173
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
174
|
+
.addGuild({ GuildId: event.id ?? '', SpaceId: event.id ?? '' })
|
|
175
|
+
.addChannel({ ChannelId: '' })
|
|
176
|
+
.addUser({ UserId: '', UserKey: '', IsMaster: false, IsBot: false })
|
|
177
|
+
.addMessage({ MessageId: '' })
|
|
178
|
+
.add({ tag: 'GUILD_CREATE' }).value);
|
|
293
179
|
});
|
|
294
180
|
client.on('GUILD_DELETE', event => {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
UserKey: '',
|
|
303
|
-
IsMaster: false,
|
|
304
|
-
IsBot: false,
|
|
305
|
-
MessageId: '',
|
|
306
|
-
BotId: botId,
|
|
307
|
-
_tag: 'GUILD_DELETE',
|
|
308
|
-
value: event
|
|
309
|
-
};
|
|
310
|
-
cbp.send(e);
|
|
181
|
+
cbp.send(FormatEvent.create('guild.exit')
|
|
182
|
+
.addPlatform({ Platform: platform, value: event, BotId: botId })
|
|
183
|
+
.addGuild({ GuildId: event.id ?? '', SpaceId: event.id ?? '' })
|
|
184
|
+
.addChannel({ ChannelId: '' })
|
|
185
|
+
.addUser({ UserId: '', UserKey: '', IsMaster: false, IsBot: false })
|
|
186
|
+
.addMessage({ MessageId: '' })
|
|
187
|
+
.add({ tag: 'GUILD_DELETE' }).value);
|
|
311
188
|
});
|
|
312
189
|
const api = {
|
|
313
190
|
active: {
|
|
@@ -686,18 +563,26 @@ const main = () => {
|
|
|
686
563
|
cbp.onactions((data, consume) => void onactions(data, consume));
|
|
687
564
|
const onapis = async (data, consume) => {
|
|
688
565
|
const key = data.payload?.key;
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
566
|
+
const params = data.payload?.params;
|
|
567
|
+
try {
|
|
568
|
+
const keys = key.split('.');
|
|
569
|
+
let target = client;
|
|
570
|
+
for (const k of keys) {
|
|
571
|
+
if (target === null || target === undefined || !(k in target)) {
|
|
572
|
+
consume([createResult(ResultCode.Fail, '未知请求,请尝试升级版本', null)]);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
target = target[k];
|
|
694
576
|
}
|
|
695
|
-
|
|
696
|
-
consume([createResult(ResultCode.Fail, '
|
|
577
|
+
if (typeof target !== 'function') {
|
|
578
|
+
consume([createResult(ResultCode.Fail, '目标不是可调用方法', null)]);
|
|
579
|
+
return;
|
|
697
580
|
}
|
|
581
|
+
const res = await target(...params);
|
|
582
|
+
consume([createResult(ResultCode.Ok, '请求完成', res)]);
|
|
698
583
|
}
|
|
699
|
-
|
|
700
|
-
consume([createResult(ResultCode.Fail, '
|
|
584
|
+
catch (error) {
|
|
585
|
+
consume([createResult(ResultCode.Fail, '请求失败', error)]);
|
|
701
586
|
}
|
|
702
587
|
};
|
|
703
588
|
cbp.onapis((data, consume) => void onapis(data, consume));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alemonjs/discord",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.12",
|
|
4
4
|
"description": "discord platform connection",
|
|
5
5
|
"author": "lemonade",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"type": "git",
|
|
66
66
|
"url": "https://github.com/lemonade-lab/alemonjs.git"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "4b0115f3dfec34c18e27f57bf5c0f0164e28394a"
|
|
69
69
|
}
|