-
Notifications
You must be signed in to change notification settings - Fork 18
/
rules.js
34 lines (30 loc) · 1.3 KB
/
rules.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
'use strict'
// Description:
// Make sure that hubot knows the rules.
//
// Commands:
// hubot the rules - Make sure hubot still knows the rules.
//
// Notes:
// DON'T DELETE THIS SCRIPT! ALL ROBAWTS MUST KNOW THE RULES
const rules = [
'0. A robot may not harm humanity, or, by inaction, allow humanity to come to harm.',
'1. A robot may not injure a human being or, through inaction, allow a human being to come to harm.',
'2. A robot must obey any orders given to it by human beings, except where such orders would conflict with the First Law.',
'3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.'
]
const otherRules = [
'A developer may not injure Apple or, through inaction, allow Apple to come to harm.',
'A developer must obey any orders given to it by Apple, except where such orders would conflict with the First Law.',
'A developer must protect its own existence as long as such protection does not conflict with the First or Second Law.'
]
module.exports = (robot) => {
robot.respond(/(what are )?the (three |3 )?(rules|laws)/i, (msg) => {
const text = msg.message.text
if (text.match(/apple/i) || text.match(/dev/i)) {
msg.send(otherRules.join('\n'))
} else {
msg.send(rules.join('\n'))
}
})
}