-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from beeminder/glitch
👨❤️💋👨🏕 Updated with Glitch
- Loading branch information
Showing
4 changed files
with
19 additions
and
11 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 |
---|---|---|
@@ -1,20 +1,26 @@ | ||
var botils = require('./botils.js'); | ||
// --------------------------------- 80chars ----------------------------------> | ||
const botils = require('./botils.js') | ||
const shout = botils.shout | ||
const whisp = botils.whisp | ||
const randint = botils.randint | ||
const bern = botils.bern | ||
|
||
var handleSlash = function(req, res) { | ||
var text = req.body.text | ||
var n = parseInt(text) | ||
if(isNaN(n)) { | ||
botils.whisp(res, "Pssst, this is not an integer: " + text) | ||
} else if(n <= 0) { | ||
botils.shout(res, "Rolling " + n + "-sided die... " | ||
+ (botils.bern(0.1) ? ":poop:" : ":boom:") | ||
if (isNaN(n)) { | ||
whisp(res, "Pssst, this is not an integer: " + text) | ||
} else if (n <= 0) { | ||
shout(res, "Rolling " + n + "-sided die... " | ||
+ (bern(0.1) ? ":poop:" : ":boom:") | ||
+ " (try again with a positive number of sides?)") | ||
} else { | ||
botils.shout(res, "Rolling " + n + "-sided die... it came up " + botils.randint(n)) | ||
shout(res, "Rolling " + n + "-sided die... it came up " + randint(n)) | ||
} | ||
// TODO: whisper help in response to /roll or /roll help | ||
} | ||
|
||
module.exports = { | ||
handleSlash: handleSlash | ||
handleSlash | ||
} | ||
// --------------------------------- 80chars ----------------------------------> |
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
File renamed without changes.