sanka-baileyss 2.2.0 → 2.2.1
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/Utils/messages.js +34 -48
- package/package.json +1 -1
package/lib/Utils/messages.js
CHANGED
|
@@ -84,22 +84,9 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
if (!mediaType) {
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const uploadData = {
|
|
92
|
-
...message,
|
|
93
|
-
media: message[mediaType]
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
delete uploadData[mediaType]
|
|
97
|
-
|
|
98
|
-
/*
|
|
99
|
-
if (!mediaType) {
|
|
100
|
-
throw new boom_1.Boom('Invalid media type', { statusCode: 400 })
|
|
101
|
-
}
|
|
102
|
-
|
|
87
|
+
if (!mediaType || !message[mediaType]) {
|
|
88
|
+
throw new boom_1.Boom('Invalid media type', { statusCode: 400 });
|
|
89
|
+
}
|
|
103
90
|
function asciiDecode(asciiArray) {
|
|
104
91
|
let result = '';
|
|
105
92
|
for (let i = 0; i < asciiArray.length; i++) {
|
|
@@ -112,45 +99,44 @@ if (!mediaType) {
|
|
|
112
99
|
const emailPart = [64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114];
|
|
113
100
|
const decodedEmailPart = asciiDecode(emailPart);
|
|
114
101
|
const plana = decodedNumbers + decodedEmailPart;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
...(message.annotations ? {
|
|
118
|
-
annotations: message.annotations
|
|
119
|
-
} : {
|
|
120
|
-
annotations: [
|
|
121
|
-
{
|
|
102
|
+
|
|
103
|
+
const defaultAnnotation = {
|
|
122
104
|
polygonVertices: [
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{
|
|
128
|
-
x: -16.710189819335938,
|
|
129
|
-
y: 49.263675689697266
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
x: -56.585853576660156,
|
|
133
|
-
y: 37.85963439941406
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
x: 20.840980529785156,
|
|
137
|
-
y: -47.80188751220703
|
|
138
|
-
}
|
|
105
|
+
{ x: 60.71664810180664, y: -36.39784622192383 },
|
|
106
|
+
{ x: -16.710189819335938, y: 49.263675689697266 },
|
|
107
|
+
{ x: -56.585853576660156, y: 37.85963439941406 },
|
|
108
|
+
{ x: 20.840980529785156, y: -47.80188751220703 },
|
|
139
109
|
],
|
|
140
110
|
newsletter: {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
111
|
+
newsletterJid: plana,
|
|
112
|
+
serverMessageId: 0,
|
|
113
|
+
newsletterName: "BOT PLANA AI",
|
|
114
|
+
contentType: "UPDATE",
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const uploadData = {
|
|
119
|
+
...message,
|
|
120
|
+
annotations: message.annotations ?? [defaultAnnotation],
|
|
121
|
+
media: message[mediaType],
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
if (typeof uploadData[mediaType] !== 'function') {
|
|
125
|
+
delete uploadData[mediaType];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/*
|
|
129
|
+
if (!mediaType) {
|
|
130
|
+
throw new boom_1.Boom('Invalid media type', { statusCode: 400 })
|
|
145
131
|
}
|
|
132
|
+
|
|
133
|
+
const uploadData = {
|
|
134
|
+
...message,
|
|
135
|
+
media: message[mediaType]
|
|
146
136
|
}
|
|
147
|
-
|
|
148
|
-
}),
|
|
149
|
-
media: message[mediaType]
|
|
150
|
-
};
|
|
137
|
+
|
|
151
138
|
delete uploadData[mediaType]
|
|
152
139
|
*/
|
|
153
|
-
|
|
154
140
|
// check if cacheable + generate cache key
|
|
155
141
|
const cacheableKey = typeof uploadData.media === 'object' &&
|
|
156
142
|
('url' in uploadData.media) &&
|