|
|
@@ -47,16 +47,18 @@ SlackHistory.prototype.prepareMessage = function(ev, targetId) {
|
|
|
}
|
|
|
|
|
|
SlackHistory.prototype.messageFactory = function(ev, ts) {
|
|
|
- let img;
|
|
|
- if (ev["file"] && ev["file"]["mimetype"].indexOf("image/") >= 0)
|
|
|
- img = ev["file"]["thumb_360"] || ev["file"]["url_private"] || ev["file"]["permalink"] || undefined;
|
|
|
- if (img) {
|
|
|
- if (!ev["attachments"])
|
|
|
- ev["attachments"] = [];
|
|
|
- ev["attachments"].push({
|
|
|
- "image_url": img
|
|
|
- });
|
|
|
- }
|
|
|
+ ev["files"] && ev["files"].forEach(f => {
|
|
|
+ if (f["mimetype"].indexOf("image/") >= 0) {
|
|
|
+ let imgUrl = f["thumb_360"] || f["url_private"] || f["permalink"];
|
|
|
+ if (imgUrl) {
|
|
|
+ if (!ev["attachments"])
|
|
|
+ ev["attachments"] = [];
|
|
|
+ ev["attachments"].push({
|
|
|
+ "image_url": imgUrl
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
if (!ev["user"]) {
|
|
|
if (ev["bot_id"])
|
|
|
ev["user"] = ev["bot_id"];
|