wechaty-web-panel 1.6.73 → 1.6.75

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.
@@ -19,20 +19,6 @@ export namespace packageJson {
19
19
  release: string;
20
20
  "release:dry": string;
21
21
  };
22
- const keywords: string[];
23
- namespace author {
24
- const name_1: string;
25
- export { name_1 as name };
26
- export const url: string;
27
- export const email: string;
28
- }
29
- namespace repository {
30
- const type_1: string;
31
- export { type_1 as type };
32
- const url_1: string;
33
- export { url_1 as url };
34
- }
35
- const license: string;
36
22
  const devDependencies: {
37
23
  "@chatie/semver": string;
38
24
  "@chatie/tsconfig": string;
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
6
6
  */
7
7
  exports.packageJson = {
8
8
  "name": "wechaty-web-panel",
9
- "version": "1.6.73",
9
+ "version": "1.6.75",
10
10
  "description": "智能微秘书插件",
11
11
  "exports": {
12
12
  ".": {
@@ -25,42 +25,13 @@ exports.packageJson = {
25
25
  "release": "verpub publish",
26
26
  "release:dry": "verpub --dry-run"
27
27
  },
28
- "keywords": [
29
- "定时发送",
30
- "微秘书",
31
- "智能机器人",
32
- "微信每日说",
33
- "每日说",
34
- "群消息同步",
35
- "企微机器人",
36
- "fastGPT",
37
- "Dify",
38
- "Wechaty",
39
- "wechatEveryDay",
40
- "wechaty",
41
- "wechaty-plugin",
42
- "chatGPT",
43
- "openai",
44
- "chatBot",
45
- "openGPT"
46
- ],
47
- "author": {
48
- "name": "Leo_chen",
49
- "url": "http://www.xkboke.com",
50
- "email": "leo.gengchen@foxmail.com"
51
- },
52
- "repository": {
53
- "type": "git",
54
- "url": "https://github.com/leochen-g/wechaty-web-panel"
55
- },
56
- "license": "MIT",
57
28
  "devDependencies": {
58
29
  "@chatie/semver": "^0.4.7",
59
30
  "@chatie/tsconfig": "^4.6.3",
60
31
  "@grpc/grpc-js": "1.9.14",
61
- "@juzi/wechaty": "^1.0.99",
62
- "@juzi/wechaty-puppet": "^1.0.90",
63
- "@juzi/wechaty-puppet-service": "^1.0.100",
32
+ "@juzi/wechaty": "^1.0.108",
33
+ "@juzi/wechaty-puppet": "^1.0.100",
34
+ "@juzi/wechaty-puppet-service": "^1.0.105",
64
35
  "babel-eslint": "^10.1.0",
65
36
  "eslint": "^7.4.0",
66
37
  "eslint-config-prettier": "^6.11.0",
@@ -221,12 +221,16 @@ async function initMqtt(that) {
221
221
  }
222
222
  else if (content.target === 'refreshCode') {
223
223
  console.log('强制更新二维码');
224
- await this.refreshQrCode();
224
+ await that.refreshQrCode();
225
225
  }
226
226
  else if (content.target === 'getNewQrCode') {
227
227
  console.log('获取最新二维码');
228
228
  (0, on_scan_js_1.resetScanTime)();
229
229
  }
230
+ else if (content.target === 'logout') {
231
+ console.log('退出登录');
232
+ that.logout();
233
+ }
230
234
  else if (content.target === 'verifyCode') {
231
235
  console.log('触发了输入验证码事件');
232
236
  if (global_js_1.default.getVerifyId() === global_js_1.default.getQrKey()) {
@@ -311,17 +311,41 @@ async function getCustomConfig({ name, id, room, roomId, roomName, type }) {
311
311
  });
312
312
  if (type) {
313
313
  if (item.onlyId) {
314
+ if (item?.allowRoomMembers && item?.allowRoomMembers.length) {
315
+ const allowRoomMembersIds = item.allowRoomMembers.map(mItem => mItem.id);
316
+ const res = item.type === 'room' && targetIds.includes(roomId) && item.botConfig[type] && item.openChat && allowRoomMembersIds.includes(id);
317
+ return res;
318
+ }
314
319
  return item.type === 'room' && targetIds.includes(roomId) && item.botConfig[type] && item.openChat;
315
320
  }
316
321
  else {
322
+ if (item?.allowRoomMembers && item?.allowRoomMembers.length) {
323
+ const allowRoomMembersIds = item.allowRoomMembers.map(mItem => mItem.id);
324
+ const allowRoomMembersNames = item.allowRoomMembers.map(mItem => mItem.name);
325
+ const res = item.type === 'room' && (targetNames.includes(roomName) && item.botConfig[type] && item.openChat || targetIds.includes(roomId) && item.botConfig[type] && item.openChat) && (allowRoomMembersIds.includes(id) || allowRoomMembersNames.includes(name));
326
+ return res;
327
+ }
317
328
  return item.type === 'room' && (targetNames.includes(roomName) && item.botConfig[type] && item.openChat || targetIds.includes(roomId) && item.botConfig[type] && item.openChat);
318
329
  }
319
330
  }
320
331
  else {
321
332
  if (item.onlyId) {
333
+ if (item?.allowRoomMembers && item?.allowRoomMembers.length) {
334
+ const allowRoomMembersIds = item.allowRoomMembers.map(mItem => mItem.id);
335
+ const res = item.type === 'room' && targetIds.includes(roomId) && allowRoomMembersIds.includes(id);
336
+ console.log('校验是否为允许的群成员:', res);
337
+ return res;
338
+ }
322
339
  return item.type === 'room' && targetIds.includes(roomId);
323
340
  }
324
341
  else {
342
+ if (item?.allowRoomMembers && item?.allowRoomMembers.length) {
343
+ const allowRoomMembersIds = item.allowRoomMembers.map(mItem => mItem.id);
344
+ const allowRoomMembersNames = item.allowRoomMembers.map(mItem => mItem.name);
345
+ const res = item.type === 'room' && (targetNames.includes(roomName) || targetIds.includes(roomId)) && (allowRoomMembersIds.includes(id) || allowRoomMembersNames.includes(name));
346
+ console.log('校验是否为允许的群成员:', res);
347
+ return res;
348
+ }
325
349
  return item.type === 'room' && (targetNames.includes(roomName) || targetIds.includes(roomId));
326
350
  }
327
351
  }
@@ -371,7 +395,9 @@ async function customChat({ msg, name, id, config, isMention, room, userAlias, u
371
395
  if ((isRoom && finalConfig.needAt === 1 && isMention) || isRoom && !finalConfig.needAt || !isRoom) {
372
396
  const keyword = finalConfig?.keywords.find((item) => msg.includes(item));
373
397
  if (keyword || !finalConfig?.keywords.length) {
374
- msg = keyword ? msg.replace(keyword, '') : msg;
398
+ if (!!finalConfig?.replaceKeyword) {
399
+ msg = keyword ? msg.replace(keyword, '') : msg;
400
+ }
375
401
  if (finalConfig.limitNum > 0 && finalConfig.limitNum <= finalConfig.usedNum) {
376
402
  return [{ type: 1, content: finalConfig.rechargeTip || '' }];
377
403
  }
@@ -19,20 +19,6 @@ export namespace packageJson {
19
19
  release: string;
20
20
  "release:dry": string;
21
21
  };
22
- const keywords: string[];
23
- namespace author {
24
- const name_1: string;
25
- export { name_1 as name };
26
- export const url: string;
27
- export const email: string;
28
- }
29
- namespace repository {
30
- const type_1: string;
31
- export { type_1 as type };
32
- const url_1: string;
33
- export { url_1 as url };
34
- }
35
- const license: string;
36
22
  const devDependencies: {
37
23
  "@chatie/semver": string;
38
24
  "@chatie/tsconfig": string;
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const packageJson = {
5
5
  "name": "wechaty-web-panel",
6
- "version": "1.6.73",
6
+ "version": "1.6.75",
7
7
  "description": "智能微秘书插件",
8
8
  "exports": {
9
9
  ".": {
@@ -22,42 +22,13 @@ export const packageJson = {
22
22
  "release": "verpub publish",
23
23
  "release:dry": "verpub --dry-run"
24
24
  },
25
- "keywords": [
26
- "定时发送",
27
- "微秘书",
28
- "智能机器人",
29
- "微信每日说",
30
- "每日说",
31
- "群消息同步",
32
- "企微机器人",
33
- "fastGPT",
34
- "Dify",
35
- "Wechaty",
36
- "wechatEveryDay",
37
- "wechaty",
38
- "wechaty-plugin",
39
- "chatGPT",
40
- "openai",
41
- "chatBot",
42
- "openGPT"
43
- ],
44
- "author": {
45
- "name": "Leo_chen",
46
- "url": "http://www.xkboke.com",
47
- "email": "leo.gengchen@foxmail.com"
48
- },
49
- "repository": {
50
- "type": "git",
51
- "url": "https://github.com/leochen-g/wechaty-web-panel"
52
- },
53
- "license": "MIT",
54
25
  "devDependencies": {
55
26
  "@chatie/semver": "^0.4.7",
56
27
  "@chatie/tsconfig": "^4.6.3",
57
28
  "@grpc/grpc-js": "1.9.14",
58
- "@juzi/wechaty": "^1.0.99",
59
- "@juzi/wechaty-puppet": "^1.0.90",
60
- "@juzi/wechaty-puppet-service": "^1.0.100",
29
+ "@juzi/wechaty": "^1.0.108",
30
+ "@juzi/wechaty-puppet": "^1.0.100",
31
+ "@juzi/wechaty-puppet-service": "^1.0.105",
61
32
  "babel-eslint": "^10.1.0",
62
33
  "eslint": "^7.4.0",
63
34
  "eslint-config-prettier": "^6.11.0",
@@ -192,12 +192,16 @@ async function initMqtt(that) {
192
192
  }
193
193
  else if (content.target === 'refreshCode') {
194
194
  console.log('强制更新二维码');
195
- await this.refreshQrCode();
195
+ await that.refreshQrCode();
196
196
  }
197
197
  else if (content.target === 'getNewQrCode') {
198
198
  console.log('获取最新二维码');
199
199
  resetScanTime();
200
200
  }
201
+ else if (content.target === 'logout') {
202
+ console.log('退出登录');
203
+ that.logout();
204
+ }
201
205
  else if (content.target === 'verifyCode') {
202
206
  console.log('触发了输入验证码事件');
203
207
  if (globalConfig.getVerifyId() === globalConfig.getQrKey()) {
@@ -295,17 +295,41 @@ async function getCustomConfig({ name, id, room, roomId, roomName, type }) {
295
295
  });
296
296
  if (type) {
297
297
  if (item.onlyId) {
298
+ if (item?.allowRoomMembers && item?.allowRoomMembers.length) {
299
+ const allowRoomMembersIds = item.allowRoomMembers.map(mItem => mItem.id);
300
+ const res = item.type === 'room' && targetIds.includes(roomId) && item.botConfig[type] && item.openChat && allowRoomMembersIds.includes(id);
301
+ return res;
302
+ }
298
303
  return item.type === 'room' && targetIds.includes(roomId) && item.botConfig[type] && item.openChat;
299
304
  }
300
305
  else {
306
+ if (item?.allowRoomMembers && item?.allowRoomMembers.length) {
307
+ const allowRoomMembersIds = item.allowRoomMembers.map(mItem => mItem.id);
308
+ const allowRoomMembersNames = item.allowRoomMembers.map(mItem => mItem.name);
309
+ const res = item.type === 'room' && (targetNames.includes(roomName) && item.botConfig[type] && item.openChat || targetIds.includes(roomId) && item.botConfig[type] && item.openChat) && (allowRoomMembersIds.includes(id) || allowRoomMembersNames.includes(name));
310
+ return res;
311
+ }
301
312
  return item.type === 'room' && (targetNames.includes(roomName) && item.botConfig[type] && item.openChat || targetIds.includes(roomId) && item.botConfig[type] && item.openChat);
302
313
  }
303
314
  }
304
315
  else {
305
316
  if (item.onlyId) {
317
+ if (item?.allowRoomMembers && item?.allowRoomMembers.length) {
318
+ const allowRoomMembersIds = item.allowRoomMembers.map(mItem => mItem.id);
319
+ const res = item.type === 'room' && targetIds.includes(roomId) && allowRoomMembersIds.includes(id);
320
+ console.log('校验是否为允许的群成员:', res);
321
+ return res;
322
+ }
306
323
  return item.type === 'room' && targetIds.includes(roomId);
307
324
  }
308
325
  else {
326
+ if (item?.allowRoomMembers && item?.allowRoomMembers.length) {
327
+ const allowRoomMembersIds = item.allowRoomMembers.map(mItem => mItem.id);
328
+ const allowRoomMembersNames = item.allowRoomMembers.map(mItem => mItem.name);
329
+ const res = item.type === 'room' && (targetNames.includes(roomName) || targetIds.includes(roomId)) && (allowRoomMembersIds.includes(id) || allowRoomMembersNames.includes(name));
330
+ console.log('校验是否为允许的群成员:', res);
331
+ return res;
332
+ }
309
333
  return item.type === 'room' && (targetNames.includes(roomName) || targetIds.includes(roomId));
310
334
  }
311
335
  }
@@ -354,7 +378,9 @@ async function customChat({ msg, name, id, config, isMention, room, userAlias, u
354
378
  if ((isRoom && finalConfig.needAt === 1 && isMention) || isRoom && !finalConfig.needAt || !isRoom) {
355
379
  const keyword = finalConfig?.keywords.find((item) => msg.includes(item));
356
380
  if (keyword || !finalConfig?.keywords.length) {
357
- msg = keyword ? msg.replace(keyword, '') : msg;
381
+ if (!!finalConfig?.replaceKeyword) {
382
+ msg = keyword ? msg.replace(keyword, '') : msg;
383
+ }
358
384
  if (finalConfig.limitNum > 0 && finalConfig.limitNum <= finalConfig.usedNum) {
359
385
  return [{ type: 1, content: finalConfig.rechargeTip || '' }];
360
386
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechaty-web-panel",
3
- "version": "1.6.73",
3
+ "version": "1.6.75",
4
4
  "description": "智能微秘书插件",
5
5
  "exports": {
6
6
  ".": {
@@ -19,42 +19,13 @@
19
19
  "release": "verpub publish",
20
20
  "release:dry": "verpub --dry-run"
21
21
  },
22
- "keywords": [
23
- "定时发送",
24
- "微秘书",
25
- "智能机器人",
26
- "微信每日说",
27
- "每日说",
28
- "群消息同步",
29
- "企微机器人",
30
- "fastGPT",
31
- "Dify",
32
- "Wechaty",
33
- "wechatEveryDay",
34
- "wechaty",
35
- "wechaty-plugin",
36
- "chatGPT",
37
- "openai",
38
- "chatBot",
39
- "openGPT"
40
- ],
41
- "author": {
42
- "name": "Leo_chen",
43
- "url": "http://www.xkboke.com",
44
- "email": "leo.gengchen@foxmail.com"
45
- },
46
- "repository": {
47
- "type": "git",
48
- "url": "https://github.com/leochen-g/wechaty-web-panel"
49
- },
50
- "license": "MIT",
51
22
  "devDependencies": {
52
23
  "@chatie/semver": "^0.4.7",
53
24
  "@chatie/tsconfig": "^4.6.3",
54
25
  "@grpc/grpc-js": "1.9.14",
55
- "@juzi/wechaty": "^1.0.99",
56
- "@juzi/wechaty-puppet": "^1.0.90",
57
- "@juzi/wechaty-puppet-service": "^1.0.100",
26
+ "@juzi/wechaty": "^1.0.108",
27
+ "@juzi/wechaty-puppet": "^1.0.100",
28
+ "@juzi/wechaty-puppet-service": "^1.0.105",
58
29
  "babel-eslint": "^10.1.0",
59
30
  "eslint": "^7.4.0",
60
31
  "eslint-config-prettier": "^6.11.0",