forked from D2KLab/music-chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslack_cards.js
207 lines (196 loc) · 7.19 KB
/
slack_cards.js
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/* SLACK CARDS */
module.exports.getBioCard = function getBioCard(fullname, birthPlace, birthDate, deathPlace, deathDate, imageURL, bio) {
var imageURLHTTPDropped = imageURL.split("://")[1];
var bioAttachment = {
"attachments": [{
"pretext": "This is what I found:",
"fallback": "New message from DOREMUS Bot!",
"title": fullname,
"image_url": "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": [{
"fallback": "New message from DOREMUS Bot!",
"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,
"fallback": "New message from DOREMUS Bot!",
"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.getHelpCard = function getHelpCard(language) {
var helpAttachment;
if (language === 'en') {
helpAttachment = {
"attachments": [{
"title": "Some things you can ask me:",
"fallback": "New message from DOREMUS Bot!",
"fields": [{
"title": "Give me 3 works composed by Bach",
"value": "You can find the WORKS with your preferred filters.",
"short": false
}, {
"title": "Give me 2 works for violin, clarinet and piano",
"value": "Not only by artist but also by multiple instruments!",
"short": false
}, {
"title": "Tell me 5 sonatas written between 1782 and 1821",
"value": "And even more: genre and composition year.",
"short": false
}, {
"title": "Find one artist, born between 1752 and 1772, who wrotes more works for clarinet",
"value": "You can find the ARTISTS with your preferred filters",
"short": false
}, {
"title": "What do you know about Beethoven?",
"value": "Once you know the name of an artist, you can get the bio.",
"short": false
}, {
"title": "... now give me 5 of his works, written for clarinet",
"value": "Hey, I remember when we are talking about an artist!",
"short": false
}, {
"title": "Tell me one event in Paris in the next month!",
"value": "I'm also good at discovering EVENTS in your favourite places",
"short": false
}],
"color": "#4283f4"
}]
}
} else if (language === 'fr') {
helpAttachment = {
"attachments": [{
"title": "Tu me peux demander:",
"fallback": "Nouveau message de DOREMUS Bot!",
"fields": [{
"title": "Donne-moi deux oeuvres de Bach",
"value": "Tu peux trouver les oeuvres avec tes filtres favoris.",
"short": false
}, {
"title": "Donne-moi deux oeuvres pour violin, clarinette et piano",
"value": "Aussi avec plusieurs instruments!",
"short": false
}, {
"title": "Trouve-moi un compositeur qui a écrit plus oeuvres pour clarinette",
"value": "Tu peux trouver les compositeurs avec des filtres!",
"short": false
}, {
"title": "Parle-moi de Beethoven",
"value": "Tu peux obtenir le bio d'un compositeur",
"short": false
}, {
"title": "... alors donne-moi deux de ses aria pour violin et clarinette",
"value": "Hey, je me souviens qu'on parle d'un compositeur!",
"short": false
}, {
"title": "Proposes-moi un évènement le mois prochain",
"value": "Je suis aussi capable de trouver des performances de musique!",
"short": false
}],
"color": "#4283f4"
}]
};
}
return helpAttachment;
};
module.exports.getPerformanceCard = function getPerformanceCard(title, subtitle, placeName, actorsName, date) {
var performanceAttachment = {
"attachments": [{
"title": title,
"text": subtitle,
"fallback": "New message from DOREMUS Bot!",
"fields": [{
"title": "Where",
"value": placeName,
"short": true
}, {
"title": "When",
"value": date,
"short": true
}, {
"title": "Actors",
"value": actorsName,
"short": false
}],
"color": "#f4b042"
}]
};
return performanceAttachment;
};