-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathformat_output.js
67 lines (66 loc) · 2.74 KB
/
format_output.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
"use strict"
exports.outputMessage = (users, winObj) => {
return {
response_type: "in_channel",
"text": `
${winObj.battle_winner !== 'tie' ? ':trophy: *' + winObj.battle_winner + '* :trophy: is a winner!' : "It's a tie!" }
`,
"mrkdwn": true,
"attachments": [
{
"fallback": `Data for @${users[0].username}:`,
"text": `Data for @${users[0].username}:`,
"fields": [
{
"title": "Stars (All repos)",
"value": `${winObj.star_winner === users[0].username ? ':sports_medal:' : ''} ${users[0].stars}`,
"short": true
},
{
"title": "Forks (All repos)",
"value": `${winObj.fork_winner === users[0].username ? ':sports_medal:' : ''} ${users[0].forks}`,
"short": true
},
{
"title": "Watchers (All repos)",
"value": `${winObj.watch_winner === users[0].username ? ':sports_medal:' : ''} ${users[0].watches}`,
"short": true
},
{
"title": "Followers",
"value": `${winObj.follows_winner === users[0].username ? ':sports_medal:' : ''} ${users[0].followers}`,
"short": true
}
],
"color": `${winObj.battle_winner === users[0].username ? '#36a64f' : '#F35A00'}`
},
{
"fallback": `Data for @${users[1].username}:`,
"text": `Data for @${users[1].username}:`,
"fields": [
{
"title": "Stars (All repos)",
"value": `${winObj.star_winner === users[1].username ? ':sports_medal:' : ''} ${users[1].stars}`,
"short": true
},
{
"title": "Forks (All repos)",
"value": `${winObj.fork_winner === users[1].username ? ':sports_medal:' : ''} ${users[1].forks}`,
"short": true
},
{
"title": "Watchers (All repos)",
"value": `${winObj.watch_winner === users[1].username ? ':sports_medal:' : ''} ${users[1].watches}`,
"short": true
},
{
"title": "Followers",
"value": `${winObj.follows_winner === users[1].username ? ':sports_medal:' : ''} ${users[1].followers}`,
"short": true
}
],
"color": `${winObj.battle_winner === users[1].username ? '#36a64f' : '#F35A00'}`
}
]
};
}