From 0a63518b624bb8ec123ff17aaba8e8f58baf8f96 Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Wed, 30 Jan 2013 12:12:10 +0000 Subject: [PATCH] Add beginnings of a reworked ~isitraining --- modules/rain/README.md | 23 +++++++++++++++++++++++ modules/rain/config.json | 6 ++++++ modules/rain/rain.js | 29 +++++++++++++++++++++++++++++ modules/rain/strings.json | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 modules/rain/README.md create mode 100644 modules/rain/config.json create mode 100644 modules/rain/rain.js create mode 100644 modules/rain/strings.json diff --git a/modules/rain/README.md b/modules/rain/README.md new file mode 100644 index 0000000..24c52d0 --- /dev/null +++ b/modules/rain/README.md @@ -0,0 +1,23 @@ +## Link + +Retrieves page titles. + +### Description + +This module stores the last posted link in each channel, and provides a command +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 + +#### ~title [link] +If called with a link, the bot will attempt to find and return the title of that +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. diff --git a/modules/rain/config.json b/modules/rain/config.json new file mode 100644 index 0000000..9c3dc3e --- /dev/null +++ b/modules/rain/config.json @@ -0,0 +1,6 @@ +{ + "autoTitle": false, + "dependencies": [ "command" ], + "ignorable": true, + "help": "http://github.com/reality/depressionbot/blob/master/modules/link/README.md" +} diff --git a/modules/rain/rain.js b/modules/rain/rain.js new file mode 100644 index 0000000..55104d1 --- /dev/null +++ b/modules/rain/rain.js @@ -0,0 +1,29 @@ +/** + * Module Name: Link + * Description: Stores recent channel links, with commands to retrieve + * information about links. + */ +var request = require('request'), + _ = require('underscore')._; + +var rain = function(dbot) { + var commands = { + '~rain': function(event) { + var precip = event.params[1]; + var score = 2 * Math.pow(precip,0.5); + score = Math.ceil(score); + if (score > 10) e + score = 11; + } + event.reply(dbot.t("rain-"+score) + " [ " + score + "]"); + } + }; + + this.commands = commands; + this.on = 'PRIVMSG'; + +}; + +exports.fetch = function(dbot) { + return new rain(dbot); +}; diff --git a/modules/rain/strings.json b/modules/rain/strings.json new file mode 100644 index 0000000..5100e0b --- /dev/null +++ b/modules/rain/strings.json @@ -0,0 +1,38 @@ + { + "rain-0": { + "english" : "It's not raining." + }, + "rain-1": { + "english" : "It's raining." + }, + "rain-2": { + "english" : "It's raining rather a lot." + }, + "rain-3": { + "english" : "It's raining shitloads." + }, + "rain-4": { + "english" : "It's raining fucktons." + }, + "rain-5": { + "english" : "It's raining whales (in Wales)!" + }, + "rain-6": { + "english" : "IT'S SO FUCKING WET OUT HERE MAN" + }, + "rain-7": { + "english" : "I AM SO MOIST RIGHT NOW" + }, + "rain-8": { + "english" : "You used a #3 pencil instead of #2, didn't you?" + }, + "rain-9": { + "english" : "WELCOME TO ATLANTIS" + }, + "rain-10": { + "english" : "GET INSIDE" + }, + "rain-11": { + "english" : "LOL U PROBABLY DIED" + } +}