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.
- package/dist/core/Message.d.ts +1 -1
- package/dist/core/Message.js +9 -6
- package/dist/test.js +1 -0
- package/package.json +1 -1
package/dist/core/Message.d.ts
CHANGED
package/dist/core/Message.js
CHANGED
|
@@ -557,12 +557,15 @@ class Message {
|
|
|
557
557
|
* Check if a message mentions self.
|
|
558
558
|
*/
|
|
559
559
|
mentionSelf() {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
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') {
|