wx2tg-puppet 2.1.1 → 2.1.2

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.
@@ -97,7 +97,7 @@ export declare class Message {
97
97
  /**
98
98
  * Check if a message mentions self.
99
99
  */
100
- mentionSelf(): boolean;
100
+ mentionSelf(): Promise<boolean>;
101
101
  /**
102
102
  * Forward the received message.
103
103
  */
@@ -557,12 +557,15 @@ class Message {
557
557
  * Check if a message mentions self.
558
558
  */
559
559
  mentionSelf() {
560
- if (!this.msg.RoomId || !this.msg.MsgSource) {
561
- return false;
562
- }
563
- const result = Message.getXmlToJson(this.msg.MsgSource);
564
- const atUserList = result.msgsource.atuserlist;
565
- return atUserList === null || atUserList === void 0 ? void 0 : atUserList.split(',').includes(this.msg.FromUserName);
560
+ return __awaiter(this, void 0, void 0, function* () {
561
+ if (!this.msg.RoomId || !this.msg.MsgSource) {
562
+ return false;
563
+ }
564
+ const result = Message.getXmlToJson(this.msg.MsgSource);
565
+ const atUserList = result.msgsource.atuserlist;
566
+ const config = yield config_service_1.configService.get();
567
+ return atUserList === null || atUserList === void 0 ? void 0 : atUserList.split(',').includes(config === null || config === void 0 ? void 0 : config.wxid);
568
+ });
566
569
  }
567
570
  /**
568
571
  * Forward the received message.
package/dist/test.js CHANGED
@@ -20,6 +20,7 @@ const _1 = require(".");
20
20
  });
21
21
  yield wxBot.start();
22
22
  wxBot.on('message', (message) => __awaiter(void 0, void 0, void 0, function* () {
23
+ console.log(yield message.mentionSelf());
23
24
  console.log('收到消息', message.text());
24
25
  console.log('消息类型', message.type());
25
26
  if (message.type() === 'image') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wx2tg-puppet",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [