This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
forked from leibovic/fennecbot
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
167 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
let { choose, combine, reduce, percentage, whole_number } = require("../randomtext"); | ||
|
||
var opener = [ | ||
"RED ALERT:", | ||
"Here's the deal:", | ||
"Well,", | ||
"What do you know?", | ||
"The usual:", | ||
"How odd -", | ||
"Surprise!", | ||
"fyi", | ||
"in case you missed it,", | ||
"you should probably be aware that", | ||
"unchanged -", | ||
"hard to complain:" | ||
]; | ||
|
||
var platform = [ | ||
'ARM32', | ||
'ARM64', | ||
'android', | ||
'windows', | ||
'mac', | ||
'linux64', | ||
'linux32', | ||
'cortex-m4', | ||
'haiku', | ||
'redox', | ||
] | ||
|
||
function builder() { | ||
return 'the ' + choose(platform) + ' builder'; | ||
} | ||
|
||
var tech = [ | ||
'AWS', | ||
'macstadium', | ||
'github', | ||
builder, | ||
'larsbors', | ||
'homu', | ||
'crates.io', | ||
'servo.org', | ||
'reviewable', | ||
'TravisCI', | ||
'appveyor', | ||
'buildbot', | ||
'irccloud', | ||
'bors', | ||
'cloudflare', | ||
'pypi', | ||
'hg.mozilla.org' | ||
]; | ||
|
||
var problem = [ | ||
"stopped responding", | ||
"can't be pinged since", | ||
"started installing a system upgrade", | ||
"had to be restarted", | ||
"no longer accepts SSH connections since", | ||
"stopped running tests", | ||
"is under a DDoS attack since", | ||
"ran out of disk space", | ||
"began renegotiating our contract", | ||
"locked me out", | ||
"enabled 2fa", | ||
]; | ||
|
||
function duration() { | ||
var units = [ | ||
"milliseconds", | ||
"seconds", | ||
"minutes", | ||
"hours", | ||
"days", | ||
"weeks", | ||
"months" | ||
]; | ||
return whole_number + ' ' + choose(units); | ||
} | ||
|
||
var comparison = [ | ||
"above", | ||
"below" | ||
]; | ||
|
||
var patterns = [ | ||
[tech, problem, duration, "ago"], | ||
["no problems detected"], | ||
[tech, "is", "running", percentage, comparison, "capacity"], | ||
[tech, "is", "taking", whole_number, "times", "longer", "than", "usual"], | ||
["only", whole_number, "interruptions", "for", tech, "so", "far"], | ||
[tech, "is", "under", "heavy", "load"], | ||
["no", "issues", "with", tech, "in", duration], | ||
[tech, "was", "taken", "down", "for", "maintenance", duration, "ago"], | ||
["switching", "to", tech, "was", "a", "good", "choice"], | ||
["it", "has", "been", duration, "since", "the", "last", "incident"] | ||
]; | ||
|
||
var ending = [ | ||
"", | ||
".", | ||
"...", | ||
"!", | ||
"!!", | ||
" :/", | ||
" :<", | ||
" :(", | ||
"; so far so good!", | ||
]; | ||
|
||
function report() { | ||
var pattern = choose(patterns); | ||
var combined = combine(pattern); | ||
if (Math.random() > 0.5) { | ||
combined = choose(opener) + ' ' + combined; | ||
} | ||
return combined + choose(ending); | ||
} | ||
|
||
exports.report = report; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
function reduce(item) { | ||
if (Array.isArray(item)) { | ||
return reduce(choose(item)); | ||
} | ||
if (typeof item === "function") { | ||
return reduce(item()); | ||
} | ||
return item; | ||
} | ||
|
||
function combine(list) { | ||
if (!Array.isArray(list)) { | ||
list = [list]; | ||
} | ||
var combined = ""; | ||
for (var i = 0; i < list.length; i++) { | ||
combined += reduce(list[i]) + ' '; | ||
} | ||
return combined.slice(0, combined.length - 1); | ||
} | ||
|
||
function choose(list) { | ||
return list[Math.floor(Math.random() * list.length)]; | ||
} | ||
|
||
function whole_number() { | ||
return Math.floor(Math.random() * 100); | ||
} | ||
|
||
function percentage() { | ||
return whole_number() + "%"; | ||
} | ||
|
||
exports.reduce = reduce; | ||
exports.choose = choose; | ||
exports.combine = combine; | ||
exports.whole_number = whole_number; | ||
exports.percentage = percentage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters