-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathwebchat_cards.js
More file actions
127 lines (119 loc) · 3.52 KB
/
webchat_cards.js
File metadata and controls
127 lines (119 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* WEBCHAT CARDS */
module.exports.getBioCard = function getBioCard(fullname, birthPlace, birthDate, deathPlace, deathDate, imageURL, bio) {
var imageURLHTTPDropped = imageURL.split("://")[1]
var bioAttachment = {
"attachments": [{
"text": "This is what I found:",
"title": fullname,
"files": [{
"image": "https://rsz.io/" + imageURLHTTPDropped + "?mode=crop&width=150&height=150",
}],
"fields": [{
"title": "Born in",
"value": birthPlace,
"short": true
}, {
"title": "Birth date",
"value": birthDate,
"short": true
}, {
"title": "Dead in",
"value": deathPlace,
"short": true
}, {
"title": "Death date",
"value": deathDate,
"short": true
}, {
"title": "Bio",
"value": bio,
"short": false
}],
"color": "good"
}]
}
return bioAttachment;
}
module.exports.getArtistCard = function getArtistCard(fullname, birthPlace, birthDate, deathPlace, deathDate, count) {
var artistAttachment = {
"attachments": [{
"title": fullname,
"fields": [{
"title": "Born in",
"value": birthPlace,
"short": true
}, {
"title": "Birth date",
"value": birthDate,
"short": true
}, {
"title": "Dead in",
"value": deathPlace,
"short": true
}, {
"title": "Death date",
"value": deathDate,
"short": true
}, {
"title": "Number of works",
"value": count,
"short": true
}],
"color": "good"
}]
}
return artistAttachment;
}
module.exports.getWorkCard = function getWorkCard(title, artist, year, genre, comment, key) {
var workAttachment = {
"attachments": [{
"title": title,
"fields": [{
"title": "Composer",
"value": artist,
"short": true
}, {
"title": "Year",
"value": year,
"short": true
}, {
"title": "Genre",
"value": genre,
"short": true
}, {
"title": "Key",
"value": key,
"short": true
}, {
"title": "Comment",
"value": comment,
"short": false
}],
"color": "#4283f4"
}]
}
return workAttachment;
}
module.exports.getPerformanceCard = function getPerformanceCard(title, subtitle, placeName, actorsName, date) {
var performanceAttachment = {
"attachments": [{
"title": title,
"text": subtitle,
"fields": [{
"title": "Where",
"value": placeName,
"short": true
}, {
"title": "When",
"value": date,
"short": true
}, {
"title": "Actors",
"value": actorsName,
"short": false
}],
"color": "#f4b042"
}]
}
return performanceAttachment;
}