-
Notifications
You must be signed in to change notification settings - Fork 11
/
facebook_cards.js
72 lines (67 loc) · 2.22 KB
/
facebook_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
/* FACEBOOK CARDS */
module.exports.getBioCard = function getBioCard(artist, fullname, birthPlace, birthDate, deathPlace, deathDate, imageURL, bio) {
var imageURLHTTPDropped = imageURL.split("://")[1]
var bioAttachment = {
'type': 'template',
'payload': {
'template_type': 'generic',
'elements': [{
'title': fullname,
'image_url': "https://rsz.io/" + imageURLHTTPDropped + "?mode=crop&width=150&height=150",
'subtitle': 'Born in: ' + birthPlace +
'\nBirth date: ' + birthDate +
'\nDeath in :' + deathPlace +
'\nDeath date: ' + deathPlace,
'buttons': [{
'type': 'postback',
'title': 'Get bio',
'payload': artist
}]
}, ]
}
};
return bioAttachment;
}
module.exports.getPerformanceCard = function getPerformanceCard(title, subtitle, placeName, actorsName, date) {
var performanceAttachment = {
"type": "template",
"payload": {
"template_type": "list",
"top_element_style": "compact",
"elements": [{
"title": title,
"subtitle": subtitle
}, {
"title": "Where",
"subtitle": placeName
}, {
"title": "When",
"subtitle": date
}, {
"title": "Actors",
"subtitle": actorsName
}]
}
}
return performanceAttachment;
}
module.exports.getWorkCard = function getWorkCard(title, artist, year, genre, comment, key) {
var workAttachment = {
"type": "template",
"payload": {
"template_type": "list",
"top_element_style": "compact",
"elements": [{
"title": title,
"subtitle": "by " + artist
}, {
"title": "Details",
"subtitle": "Year: " + year + "\nGenre: " + genre + "\nKey: " + key
}, {
"title": "Comment",
"subtitle": comment
}]
}
}
return workAttachment;
}