-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslack.js
100 lines (90 loc) · 2.47 KB
/
slack.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
var moment = require("moment");
var slack = {
// build up the response for a rental object
buildGithubUserResponse: function(user) {
console.log(user);
var attachment = {
title: `Github Profile for ${user.name}`,
title_link: user.html_url,
color: '#2C3E50',
fields: [],
image_url: user.avatar_url
};
attachment.fields.push({
title: 'Company',
value: user.company || user.name,
short: true,
});
if (user.email) {
attachment.fields.push({
title: 'Email',
value: user.email,
short: true,
});
}
if (user.bio) {
attachment.fields.push({
title: 'Bio',
value: user.bio,
short: true,
});
}
if (user.blog) {
attachment.fields.push({
title: 'Blog',
value: user.blog,
short: true,
});
}
attachment.fields.push({
title: 'Location',
value: user.location,
short: true,
});
attachment.fields.push({
title: 'Public Repos',
value: user.public_repos,
short: true,
});
attachment.fields.push({
title: 'Public Gists',
value: user.public_gists,
short: true,
});
attachment.fields.push({
title: 'Followers',
value: user.followers,
short: true,
});
attachment.fields.push({
title: 'Following',
value: user.following,
short: true,
});
return attachment;
},
replyBugDialog(bot, message, options = {}) {
bot.replyAcknowledge();
var dialog = bot.createDialog(
'Submit a bug report',
'bug-report',
'Submit'
).addText('Title','title', options.title)
.addSelect('Severity','severity','low',[
{label: 'Low - Important but not urgent', value:'low'},
{label: 'Medium - Important, semi urgent', value:'medium'},
{label: 'High - Important, Urgent - money involved', value: 'high'},
{label: 'Critical - Notifies on-call engineers - site down', value: 'critical'}
])
.addSelect('App','app','outdoorsy',[
{label: 'Outdoorsy',value:'outdoorsy'},
{label:' Wheelbase',value:'wheelbase'},
{label: 'Admin Portal', value: 'admin'},
{label: 'iOS App', value: 'ios'},
{label: 'Other', value: 'other'}
])
.addTextarea('Description','description',options.description,{placeholder: 'Explain the bug here'});
bot.replyWithDialog(message, dialog.asObject());
}
};
module.exports = slack;