nishiki-bail 1.1.21 → 1.1.22
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/lib/Defaults/index.js +7 -0
- package/lib/Utils/messages-media.js +812 -704
- package/lib/Utils/messages.js +6 -3
- package/package.json +1 -1
package/lib/Utils/messages.js
CHANGED
|
@@ -101,19 +101,22 @@ export const prepareWAMessageMedia = async (message, options) => {
|
|
|
101
101
|
logger?.info({ key: cacheableKey }, 'Preparing raw media for newsletter');
|
|
102
102
|
const { filePath, fileSha256, fileLength } = await getRawMediaUploadData(uploadData.media, options.mediaTypeOverride || mediaType, logger);
|
|
103
103
|
const fileSha256B64 = fileSha256.toString('base64');
|
|
104
|
-
const { mediaUrl, directPath } = await options.upload(filePath, {
|
|
104
|
+
const { mediaUrl, directPath, thumbnailDirectPath, thumbnailSha256 } = await options.upload(filePath, {
|
|
105
105
|
fileEncSha256B64: fileSha256B64,
|
|
106
106
|
mediaType: mediaType,
|
|
107
|
-
timeoutMs: options.mediaUploadTimeoutMs
|
|
107
|
+
timeoutMs: options.mediaUploadTimeoutMs,
|
|
108
|
+
newsletter: isNewsletter
|
|
108
109
|
});
|
|
109
110
|
await fs.unlink(filePath);
|
|
110
111
|
const obj = WAProto.Message.fromObject({
|
|
111
112
|
// todo: add more support here
|
|
112
113
|
[`${mediaType}Message`]: MessageTypeProto[mediaType].fromObject({
|
|
113
|
-
url: mediaUrl,
|
|
114
|
+
url: mediaUrl || directPath,
|
|
114
115
|
directPath,
|
|
115
116
|
fileSha256,
|
|
116
117
|
fileLength,
|
|
118
|
+
thumbnailDirectPath,
|
|
119
|
+
thumbnailSha256,
|
|
117
120
|
...uploadData,
|
|
118
121
|
media: undefined
|
|
119
122
|
})
|