@alemonjs/bubble 2.1.9 → 2.1.11

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/index.html CHANGED
@@ -1,10 +1,10 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en" id="__gui">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>AlemonJS</title>
7
+ <title>ALemonJS</title>
8
8
  <script type="module" crossorigin src="/assets/index.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index.css">
10
10
  </head>
package/lib/index.js CHANGED
@@ -44,7 +44,13 @@ const main = () => {
44
44
  const [isMaster, UserKey] = getMaster(UserId);
45
45
  const UserAvatar = createUserAvatar(UserId, event?.author?.avatar);
46
46
  cbp.send(FormatEvent.create('message.create')
47
- .addPlatform({ Platform: platform, value: event, BotId: botId })
47
+ .addPlatform({
48
+ Platform: platform,
49
+ value: event,
50
+ BotId: botId,
51
+ IsAtMe: atUsers.some(item => item.id === botId),
52
+ IsPrivate: false
53
+ })
48
54
  .addGuild({ GuildId: String(event.channelId || ''), SpaceId: String(event.channelId || '') })
49
55
  .addChannel({ ChannelId: String(event.channelId || '') })
50
56
  .addUser({ UserId, UserKey, UserName: event?.author?.username, UserAvatar, IsMaster: isMaster, IsBot: false })
@@ -58,7 +64,7 @@ const main = () => {
58
64
  const [isMaster, UserKey] = getMaster(UserId);
59
65
  const UserAvatar = createUserAvatar(UserId, event?.author?.avatar);
60
66
  cbp.send(FormatEvent.create('private.message.create')
61
- .addPlatform({ Platform: platform, value: event, BotId: botId })
67
+ .addPlatform({ Platform: platform, value: event, BotId: botId, IsAtMe: false, IsPrivate: true })
62
68
  .addUser({ UserId, UserKey, UserName: event?.author?.username, UserAvatar, IsMaster: isMaster, IsBot: false })
63
69
  .addMessage({ MessageId: String(event.id) })
64
70
  .addText({ MessageText: event.content })
@@ -267,19 +273,21 @@ const main = () => {
267
273
  const params = data.payload?.params;
268
274
  try {
269
275
  const keys = key.split('.');
276
+ let parent = null;
270
277
  let target = client;
271
278
  for (const k of keys) {
272
279
  if (target === null || target === undefined || !(k in target)) {
273
280
  consume([createResult(ResultCode.Fail, '未知请求,请尝试升级版本', null)]);
274
281
  return;
275
282
  }
283
+ parent = target;
276
284
  target = target[k];
277
285
  }
278
286
  if (typeof target !== 'function') {
279
287
  consume([createResult(ResultCode.Fail, '目标不是可调用方法', null)]);
280
288
  return;
281
289
  }
282
- const res = await target(...params);
290
+ const res = await target.call(parent, ...params);
283
291
  consume([createResult(ResultCode.Ok, '请求完成', res)]);
284
292
  }
285
293
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/bubble",
3
- "version": "2.1.9",
3
+ "version": "2.1.11",
4
4
  "description": "bubble platform",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",
@@ -62,5 +62,5 @@
62
62
  "type": "git",
63
63
  "url": "https://github.com/lemonade-lab/alemonjs.git"
64
64
  },
65
- "gitHead": "4b0115f3dfec34c18e27f57bf5c0f0164e28394a"
65
+ "gitHead": "7dab16a2167bbdf5706931b67e7eab2fc67835d6"
66
66
  }