wx2tg-puppet 2.1.8 → 2.2.0
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/action/common.js +6 -0
- package/dist/core/Message.js +5 -3
- package/package.json +1 -1
package/dist/action/common.js
CHANGED
|
@@ -9,6 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
12
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
16
|
exports.revoke = exports.quote = exports.say = void 0;
|
|
14
17
|
const file_box_1 = require("file-box");
|
|
@@ -22,6 +25,7 @@ const VOICE_1 = require("../core/VOICE");
|
|
|
22
25
|
const ToolsApi_1 = require("../api/ToolsApi");
|
|
23
26
|
const Message_1 = require("../core/Message");
|
|
24
27
|
const audioUtil_1 = require("../utils/audioUtil");
|
|
28
|
+
const fs_1 = __importDefault(require("fs"));
|
|
25
29
|
// 检查是否是 Contact 类组成的数组
|
|
26
30
|
function isArrayOfContact(arr) {
|
|
27
31
|
// 先判断是否是数组
|
|
@@ -197,6 +201,8 @@ const say = (content, toWxid, ats) => __awaiter(void 0, void 0, void 0, function
|
|
|
197
201
|
const fbResult = file_box_1.FileBox.fromFile(fileName + '.silk');
|
|
198
202
|
content.voiceBase64 = yield fbResult.toBase64();
|
|
199
203
|
content.type = 4;
|
|
204
|
+
fs_1.default.unlinkSync(fileName + '.mp3');
|
|
205
|
+
fs_1.default.unlinkSync(fileName + '.silk');
|
|
200
206
|
}
|
|
201
207
|
const res = yield MsgApi_1.msgApi.SendVoice({
|
|
202
208
|
"Base64": content.voiceBase64,
|
package/dist/core/Message.js
CHANGED
|
@@ -46,7 +46,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.ResponseMsg = exports.Message = void 0;
|
|
49
|
-
const message_service_1 = require("../services/message.service");
|
|
50
49
|
const MessageType_1 = require("../types/MessageType");
|
|
51
50
|
const Contact_1 = require("./Contact");
|
|
52
51
|
const Room_1 = require("./Room");
|
|
@@ -93,7 +92,7 @@ function retryDownload(downloadFn) {
|
|
|
93
92
|
class Message {
|
|
94
93
|
constructor(msg) {
|
|
95
94
|
this.msg = msg;
|
|
96
|
-
|
|
95
|
+
// messageService.upsertByMsgId(msg.MsgId, msg);
|
|
97
96
|
this.newMsgId = msg.NewMsgId;
|
|
98
97
|
this.fromId = msg.FromUserName;
|
|
99
98
|
this._pushContent = msg.Content;
|
|
@@ -538,7 +537,10 @@ class Message {
|
|
|
538
537
|
const converter = new audioUtil_1.SilkToMp3Converter();
|
|
539
538
|
yield converter.convertToMp3(silkFilePath, mp3FilePath);
|
|
540
539
|
fs.unlinkSync(silkFilePath);
|
|
541
|
-
|
|
540
|
+
const buffer = fs.readFileSync(mp3FilePath);
|
|
541
|
+
const fileBox = file_box_1.FileBox.fromBuffer(buffer, `${this.msg.MsgId}.mp3`);
|
|
542
|
+
fs.unlinkSync(mp3FilePath);
|
|
543
|
+
return fileBox;
|
|
542
544
|
}
|
|
543
545
|
else if (this.type() === MessageType_1.MessageType.Emoji) {
|
|
544
546
|
const xml = this.msg.Content;
|