@alemonjs/qq-bot 0.0.6 → 0.0.8

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.
Files changed (2) hide show
  1. package/lib/index.js +6 -4
  2. package/package.json +4 -6
package/lib/index.js CHANGED
@@ -5,7 +5,9 @@ import { GROUP_AT_MESSAGE_CREATE, C2C_MESSAGE_CREATE, DIRECT_MESSAGE_CREATE, AT_
5
5
  const client = new Proxy({}, {
6
6
  get: (_, prop) => {
7
7
  if (prop in global.client) {
8
- return global.client[prop];
8
+ const original = global.client[prop];
9
+ // 防止函数内this丢失
10
+ return typeof original === 'function' ? original.bind(global.client) : original;
9
11
  }
10
12
  return undefined;
11
13
  }
@@ -182,7 +184,7 @@ var index = defineBot(() => {
182
184
  IsBot: event.author?.bot,
183
185
  // message
184
186
  MessageId: event.id,
185
- MessageText: msg,
187
+ MessageText: msg?.trim(),
186
188
  OpenId: event.guild_id,
187
189
  CreateAt: Date.now(),
188
190
  //
@@ -241,7 +243,7 @@ var index = defineBot(() => {
241
243
  IsBot: event.author?.bot,
242
244
  // message
243
245
  MessageId: event.id,
244
- MessageText: msg,
246
+ MessageText: msg?.trim(),
245
247
  OpenId: event.guild_id,
246
248
  CreateAt: Date.now(),
247
249
  //
@@ -326,7 +328,7 @@ var index = defineBot(() => {
326
328
  IsBot: false,
327
329
  // message
328
330
  MessageId: event.id,
329
- MessageText: msg,
331
+ MessageText: msg?.trim(),
330
332
  OpenId: event.guild_id,
331
333
  CreateAt: Date.now(),
332
334
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/qq-bot",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "qq-bot",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",
@@ -36,13 +36,11 @@
36
36
  ".": {
37
37
  "import": "./lib/index.js",
38
38
  "types": "./lib/index.d.ts"
39
- }
39
+ },
40
+ "./package": "./package.json"
40
41
  },
41
42
  "keywords": [
42
- "alemonjs",
43
- "qq-bot",
44
- "bot",
45
- "chat-bot"
43
+ "alemonjs"
46
44
  ],
47
45
  "publishConfig": {
48
46
  "registry": "https://registry.npmjs.org",