3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-25 12:12:35 +01:00

Update documentation; contract if statement

This commit is contained in:
Douglas Gardner 2013-01-30 12:21:46 +00:00
parent 0a63518b62
commit 251d69194b
3 changed files with 10 additions and 24 deletions

View File

@ -1,23 +1,13 @@
## Link ## Rain
Retrieves page titles. Quietly judges your choice of climate.
### Description ### Description
This module stores the last posted link in each channel, and provides a command It's a well documented fact that looking out of the window is sometimes far too much effort. However, sometimes you just need toknow how wet it is outside: this module queries for the precipitation level, and tells you when you need a raincoat.
for retrieving the title of a given link or the last posted link in the channel.
### Configuration
#### autoTitle: false
If this is set to true, the bot will automatically post the titles of links as
they are posted in the channel.
### Commands ### Commands
#### ~title [link] #### ~rain
If called with a link, the bot will attempt to find and return the title of that Polls the rainfall in the last hour, and returns an appropriate string.
page. If called without a link, the bot will attempt the same on the last link
which was posted in the current channel.
#### ~ud [headword]
Returns the first [Urban Dictionary](http://www.urbandictionary.com) definition for the headword provided.

View File

@ -1,6 +1,5 @@
{ {
"autoTitle": false,
"dependencies": [ "command" ], "dependencies": [ "command" ],
"ignorable": true, "ignorable": true,
"help": "http://github.com/reality/depressionbot/blob/master/modules/link/README.md" "help": "http://github.com/reality/depressionbot/blob/master/modules/rain/README.md"
} }

View File

@ -1,7 +1,6 @@
/** /**
* Module Name: Link * Module Name: Rain
* Description: Stores recent channel links, with commands to retrieve * Description: Quietly judges your choice of climate.
* information about links.
*/ */
var request = require('request'), var request = require('request'),
_ = require('underscore')._; _ = require('underscore')._;
@ -12,10 +11,8 @@ var rain = function(dbot) {
var precip = event.params[1]; var precip = event.params[1];
var score = 2 * Math.pow(precip,0.5); var score = 2 * Math.pow(precip,0.5);
score = Math.ceil(score); score = Math.ceil(score);
if (score > 10) e if (score > 10) { score = 11; }
score = 11; event.reply(dbot.t("rain-"+score));
}
event.reply(dbot.t("rain-"+score) + " [ " + score + "]");
} }
}; };