wingbot 3.76.9 → 3.76.10
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/package.json +1 -1
- package/src/Request.js +3 -2
- package/src/Tester.js +5 -2
- package/src/transcript/extractText.js +10 -0
package/package.json
CHANGED
package/src/Request.js
CHANGED
|
@@ -1611,7 +1611,7 @@ It looks like the bot isn't connected to class BotApp or the Processor is used w
|
|
|
1611
1611
|
};
|
|
1612
1612
|
}
|
|
1613
1613
|
|
|
1614
|
-
static fileAttachment (senderId, url, type = 'file', timestamp = makeTimestamp()) {
|
|
1614
|
+
static fileAttachment (senderId, url, type = 'file', timestamp = makeTimestamp(), name = null) {
|
|
1615
1615
|
return {
|
|
1616
1616
|
timestamp,
|
|
1617
1617
|
sender: {
|
|
@@ -1621,7 +1621,8 @@ It looks like the bot isn't connected to class BotApp or the Processor is used w
|
|
|
1621
1621
|
attachments: [{
|
|
1622
1622
|
type,
|
|
1623
1623
|
payload: {
|
|
1624
|
-
url
|
|
1624
|
+
url,
|
|
1625
|
+
...(name ? { name } : {})
|
|
1625
1626
|
}
|
|
1626
1627
|
}]
|
|
1627
1628
|
}
|
package/src/Tester.js
CHANGED
|
@@ -474,11 +474,14 @@ class Tester {
|
|
|
474
474
|
*
|
|
475
475
|
* @param {'image'|'audio'|'video'|'file'} type
|
|
476
476
|
* @param {string} [url]
|
|
477
|
+
* @param {string} [name] - original filename of the uploaded file
|
|
477
478
|
* @returns {Promise}
|
|
478
479
|
* @memberOf Tester
|
|
479
480
|
*/
|
|
480
|
-
attachment (type = 'file', url = this.ATTACHMENT_MOCK_URL) {
|
|
481
|
-
return this.processMessage(
|
|
481
|
+
attachment (type = 'file', url = this.ATTACHMENT_MOCK_URL, name = null) {
|
|
482
|
+
return this.processMessage(
|
|
483
|
+
Request.fileAttachment(this.senderId, url, type, undefined, name)
|
|
484
|
+
);
|
|
482
485
|
}
|
|
483
486
|
|
|
484
487
|
/**
|
|
@@ -16,6 +16,16 @@ function extractText (payload) {
|
|
|
16
16
|
return payload.message.text;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// represent user uploaded files as filenames in transcript
|
|
20
|
+
const namedAttachments = (Array.isArray(payload.message?.attachments)
|
|
21
|
+
? payload.message.attachments
|
|
22
|
+
: []
|
|
23
|
+
).filter((a) => a.payload?.url && a.payload?.name);
|
|
24
|
+
|
|
25
|
+
if (namedAttachments.length) {
|
|
26
|
+
return namedAttachments.map((a) => a.payload.name).join(', ');
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
// button message — the orchestrator normalizes a singular `attachment` into
|
|
20
30
|
// a plural `attachments` array before persisting, so accept both shapes;
|
|
21
31
|
// otherwise template messages (e.g. button templates) logged via the
|