From 7537d8508496bbc0fb103b592b6bd7bd65d0c7a0 Mon Sep 17 00:00:00 2001 From: thieson Date: Tue, 18 Feb 2014 17:17:39 +0100 Subject: [PATCH 01/13] requesting music for tripradio Adding a command to ping the DJ that a user requests a song. --- modules/radio/radio.js | 28 ++++++++++++++++++++++++---- modules/radio/strings.json | 4 ++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/modules/radio/radio.js b/modules/radio/radio.js index 38ce3c0..6769ef1 100644 --- a/modules/radio/radio.js +++ b/modules/radio/radio.js @@ -7,10 +7,10 @@ var _ = require('underscore')._, icecast = require('icecast-stack'); var radio = function(dbot) { - this.listening = false; - this.data = false; - this.stream = false; - this.internalAPI = { + this.listening = false; + this.data = false; + this.stream = false; + this.internalAPI = { 'startRadio': function() { var stream = icecast.createReadStream(this.config.stream); this.stream = stream; @@ -55,6 +55,26 @@ var radio = function(dbot) { }.bind(this)); }.bind(this) }; + + //requesting music by pinging the current DJ + //dj should be icy-description inside the headers + //user should be the requesting user + //request should be the event + //TODO:pm dj + + this.commands={ + '~request music': function(event){ + var dj=this.data['icy-description']; + var user=event.user; + var request=event; + dbot.say(dbot.t('request',{ + 'dj':dj, + 'user':user, + 'song':song + })); + } + }; + this.onLoad = function() { this.internalAPI.getRadio(); }.bind(this); diff --git a/modules/radio/strings.json b/modules/radio/strings.json index ecd3157..8a4c771 100644 --- a/modules/radio/strings.json +++ b/modules/radio/strings.json @@ -5,4 +5,8 @@ "now_playing": { "en": "Now Playing: {name} - {song} - {url}" } + + "request":{ + "en":"{dj}: User {user} requests '{song}' to be played on tripradio." + } } From b43be1f900adacb319fa447fda830c0f796e9dfd Mon Sep 17 00:00:00 2001 From: thoso Date: Wed, 19 Feb 2014 22:19:36 +0100 Subject: [PATCH 02/13] Adding a unit converter Due to issue #596 I coded a basic unit converter to convert time, distance, mass, volume and digital values. It depends on node-units. Also, fixed a typo. --- modules/radio/strings.json | 3 +-- modules/units/README.md | 24 ++++++++++++++++++++++++ modules/units/strings.json | 8 ++++++++ modules/units/units.js | 33 +++++++++++++++++++++++++++++++++ modules/units/usage.json | 3 +++ 5 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 modules/units/README.md create mode 100644 modules/units/strings.json create mode 100644 modules/units/units.js create mode 100644 modules/units/usage.json diff --git a/modules/radio/strings.json b/modules/radio/strings.json index 8a4c771..d4c07ad 100644 --- a/modules/radio/strings.json +++ b/modules/radio/strings.json @@ -4,8 +4,7 @@ }, "now_playing": { "en": "Now Playing: {name} - {song} - {url}" - } - + }, "request":{ "en":"{dj}: User {user} requests '{song}' to be played on tripradio." } diff --git a/modules/units/README.md b/modules/units/README.md new file mode 100644 index 0000000..9d59619 --- /dev/null +++ b/modules/units/README.md @@ -0,0 +1,24 @@ +## Unit conversion + +Converts units into other units. + +### Description + +This module provides a command which allows users to convert units into another +unit given the international character of networks. Converts time, distance, +mass, volume and digital values. + +It has following dependencies: +node-units : https://github.com/brettlangdon/node-units + +### Commands + +#### ~convert [input value] [input unit] to [output unit] + +Example: +~convert 5 minutes to s +~convert 20 quarts to gallons + +### TODO + +Currency Conversion \ No newline at end of file diff --git a/modules/units/strings.json b/modules/units/strings.json new file mode 100644 index 0000000..35237f7 --- /dev/null +++ b/modules/units/strings.json @@ -0,0 +1,8 @@ +{ + "result": { + "en": "{input}: {output}" + }, + "error": { + "en": "Something went wrong :( Example:'~convert 5 minutes to s'" + } +} diff --git a/modules/units/units.js b/modules/units/units.js new file mode 100644 index 0000000..cda7d36 --- /dev/null +++ b/modules/units/units.js @@ -0,0 +1,33 @@ +/** + * Module Name: Unit Conversion + * Description: Converts units. + * Requires: node-units [https://github.com/brettlangdon/node-units] + * TODO: currency converting + */ + +var _ = require('underscore')._, + unit = require('node-units'); + +var units = function(dbot) { + this.commands = { + '~convert': function(event) { + var query = event.input[1]; + try { + event.reply(dbot.t('result', { + 'input': query, + 'output': result + })); + var result = unit.convert(query); + } + } catch (e) { + event.reply(dbot.t('error')); + } + + } + }; + +}; + +exports.fetch = function(dbot) { + return new units(dbot); +}; diff --git a/modules/units/usage.json b/modules/units/usage.json new file mode 100644 index 0000000..b7ce8cf --- /dev/null +++ b/modules/units/usage.json @@ -0,0 +1,3 @@ +{ + "~convert": "~convert [input value] [input unit] to [output unit]" +} \ No newline at end of file From 8f8636c50972c2826010e7f6242a0ceb9686d8c8 Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 00:52:42 +0100 Subject: [PATCH 03/13] Added Wolfram Alpha module --- modules/wolframalpha/README.md | 25 +++++++++++++++ modules/wolframalpha/strings.json | 8 +++++ modules/wolframalpha/usage.json | 3 ++ modules/wolframalpha/wolframalpha.js | 48 ++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 modules/wolframalpha/README.md create mode 100644 modules/wolframalpha/strings.json create mode 100644 modules/wolframalpha/usage.json create mode 100644 modules/wolframalpha/wolframalpha.js diff --git a/modules/wolframalpha/README.md b/modules/wolframalpha/README.md new file mode 100644 index 0000000..f2acdd9 --- /dev/null +++ b/modules/wolframalpha/README.md @@ -0,0 +1,25 @@ +## Wolfram Alpha Calculator + +Calculates whatever you want. + +### Description + +This module provides a command which allows users to calculate whatever they want. + +It has following dependencies: +node-wolfram : https://github.com/strax/node-wolfram + +### appID + +appID has to be added into config.json. It can be obtained at +http://products.wolframalpha.com/developers/ for free. + +### Commands + +#### ~calculate [(whatever)] + +Example: +~calculate (2+2) +~calculate (x^2+2x+4) + +### TODO \ No newline at end of file diff --git a/modules/wolframalpha/strings.json b/modules/wolframalpha/strings.json new file mode 100644 index 0000000..2f1ab84 --- /dev/null +++ b/modules/wolframalpha/strings.json @@ -0,0 +1,8 @@ +{ + "result": { + "en": "{output}" + }, + "error": { + "en": "Something went wrong :( Example:'~calculate (2+2)'" + } +} diff --git a/modules/wolframalpha/usage.json b/modules/wolframalpha/usage.json new file mode 100644 index 0000000..b50d0fb --- /dev/null +++ b/modules/wolframalpha/usage.json @@ -0,0 +1,3 @@ +{ + "~calculate": "~calculate [(whatever)]" +} \ No newline at end of file diff --git a/modules/wolframalpha/wolframalpha.js b/modules/wolframalpha/wolframalpha.js new file mode 100644 index 0000000..ef8674e --- /dev/null +++ b/modules/wolframalpha/wolframalpha.js @@ -0,0 +1,48 @@ +/** + * Module Name: wolframalpha + * Description: Calculates all kinds of stuff through Wolfram Alpha. + * Requires: node-wolfram [https://github.com/strax/node-wolfram] + */ + +var _ = require('underscore')._, + Client = require('node-wolfram'); + +var wolframalpha = function(dbot) { + this.commands = { + '~calculate': function(event) { + var wolfram = new Client(this.config.appID); + var query = event.input[1]; + wolfram.query(event.input[1], function(err, result) { + if(err) + event.reply(dbot.t('error')); + else + { + var out = ""; + for(var a=0; a Date: Thu, 20 Feb 2014 00:56:09 +0100 Subject: [PATCH 04/13] config.json s --- .gitignore | 1 - modules/units/config.json | 3 +++ modules/wolframalpha/config.json | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 modules/units/config.json create mode 100644 modules/wolframalpha/config.json diff --git a/.gitignore b/.gitignore index 2b664c9..8994ae5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ # Ignore the user config files -config.json db.json # ignore npm diff --git a/modules/units/config.json b/modules/units/config.json new file mode 100644 index 0000000..1aee092 --- /dev/null +++ b/modules/units/config.json @@ -0,0 +1,3 @@ +{ + "ignorable": true +} \ No newline at end of file diff --git a/modules/wolframalpha/config.json b/modules/wolframalpha/config.json new file mode 100644 index 0000000..cca4bd1 --- /dev/null +++ b/modules/wolframalpha/config.json @@ -0,0 +1,4 @@ +{ + "ignorable": true, + "appID": "blah" +} \ No newline at end of file From ade1dcd5e8eaafcc842bf3ec1fa381165f5e63be Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 01:48:04 +0100 Subject: [PATCH 05/13] typo fix --- modules/units/units.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/units/units.js b/modules/units/units.js index cda7d36..85c730d 100644 --- a/modules/units/units.js +++ b/modules/units/units.js @@ -19,8 +19,9 @@ var units = function(dbot) { })); var result = unit.convert(query); } - } catch (e) { - event.reply(dbot.t('error')); + catch (e) { + event.reply(dbot.t('error')); + } } } From d1b72fe4439a49d219083eba1f1a2d9620d7e4e7 Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 04:33:56 +0100 Subject: [PATCH 06/13] Added Sample folder for (easier) module development. --- modules/SAMPLE/README.md | 25 ++++++++++++++++++++ modules/SAMPLE/config.json_.json | 4 ++++ modules/SAMPLE/foo.js_.js | 39 +++++++++++++++++++++++++++++++ modules/SAMPLE/strings.json_.json | 8 +++++++ modules/SAMPLE/usage.json_.json | 3 +++ 5 files changed, 79 insertions(+) create mode 100644 modules/SAMPLE/README.md create mode 100644 modules/SAMPLE/config.json_.json create mode 100644 modules/SAMPLE/foo.js_.js create mode 100644 modules/SAMPLE/strings.json_.json create mode 100644 modules/SAMPLE/usage.json_.json diff --git a/modules/SAMPLE/README.md b/modules/SAMPLE/README.md new file mode 100644 index 0000000..65b115f --- /dev/null +++ b/modules/SAMPLE/README.md @@ -0,0 +1,25 @@ +## FOO + +bar. + +### Description + +This module provides a command which allows users to foobar. + +### Dependencies + +It has following dependencies: +node-wolfram : https://github.com/strax/node-wolfram + +### config.json + +foo + +### Commands + +#### ~foo [(bar] + +Example: +~foo bar + +### TODO \ No newline at end of file diff --git a/modules/SAMPLE/config.json_.json b/modules/SAMPLE/config.json_.json new file mode 100644 index 0000000..a1e88b8 --- /dev/null +++ b/modules/SAMPLE/config.json_.json @@ -0,0 +1,4 @@ +{ + "foo": true, + "foo": "bar" +} \ No newline at end of file diff --git a/modules/SAMPLE/foo.js_.js b/modules/SAMPLE/foo.js_.js new file mode 100644 index 0000000..5435698 --- /dev/null +++ b/modules/SAMPLE/foo.js_.js @@ -0,0 +1,39 @@ +/** + * Module Name: foo + * Description: bar. + * Requires: foo [bar] + */ + +var _ = require('underscore')._, + bar = require('foo');//dependencies + +var foo = function(dbot) { //name of module + + this.ApiRoot = 'API_ROOT_HERE'; + + this.internalAPI = { + //code for internal api here + }; + + this.api = { + //code for api here + }; + + this.commands = { + //code for commands here + }; + + this.onLoad = function() { + //code for stuff to be done on load here + }; + + this.onDestroy = function() { + //stuff to be done on destroy here + }; + } + +}; + +exports.fetch = function(dbot) { + return new foo(dbot); //name of module +}; diff --git a/modules/SAMPLE/strings.json_.json b/modules/SAMPLE/strings.json_.json new file mode 100644 index 0000000..dd01128 --- /dev/null +++ b/modules/SAMPLE/strings.json_.json @@ -0,0 +1,8 @@ +{ + "foo": { + "en": "{output} bar" + }, + "foo2": { + "en": "Something went wrong :( Example:'~foo bar'" + } +} diff --git a/modules/SAMPLE/usage.json_.json b/modules/SAMPLE/usage.json_.json new file mode 100644 index 0000000..8f9e67e --- /dev/null +++ b/modules/SAMPLE/usage.json_.json @@ -0,0 +1,3 @@ +{ + "~foo": "~foo [bar]" +} \ No newline at end of file From b369ce3a0cd64b3b71dc53f3a421a0015594831d Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 06:06:02 +0100 Subject: [PATCH 07/13] Various README.md's and cleanups --- modules/SAMPLE/README.md | 7 ++- modules/imdb/README.md | 32 +++++++++++++ modules/lastfm/README.md | 66 +++++++++++++++++++++++++++ modules/radio/README.md | 28 ++++++++++++ modules/soundcloud/README.md | 33 ++++++++++++++ modules/sstats/README.md | 83 ++++++++++++++++++++++++++++++++++ modules/sstats/config.json | 2 +- modules/steam/README.md | 42 +++++++++++++++++ modules/steam/config.json | 2 +- modules/units/README.md | 6 ++- modules/warning/README.md | 33 ++++++++++++++ modules/wolframalpha/README.md | 18 ++++++-- modules/words/README.md | 41 +++++++++++++++++ modules/words/config.json | 2 +- modules/youare/README.md | 17 +++++++ modules/youtube/README.md | 33 ++++++++++++++ 16 files changed, 433 insertions(+), 12 deletions(-) create mode 100644 modules/imdb/README.md create mode 100644 modules/lastfm/README.md create mode 100644 modules/radio/README.md create mode 100644 modules/soundcloud/README.md create mode 100644 modules/sstats/README.md create mode 100644 modules/steam/README.md create mode 100644 modules/warning/README.md create mode 100644 modules/words/README.md create mode 100644 modules/youtube/README.md diff --git a/modules/SAMPLE/README.md b/modules/SAMPLE/README.md index 65b115f..0df8e12 100644 --- a/modules/SAMPLE/README.md +++ b/modules/SAMPLE/README.md @@ -9,17 +9,20 @@ This module provides a command which allows users to foobar. ### Dependencies It has following dependencies: -node-wolfram : https://github.com/strax/node-wolfram ++ [foo](link) ### config.json foo +``` +``` ### Commands + #### ~foo [(bar] Example: -~foo bar ++ ~foo bar ### TODO \ No newline at end of file diff --git a/modules/imdb/README.md b/modules/imdb/README.md new file mode 100644 index 0000000..dac2fbd --- /dev/null +++ b/modules/imdb/README.md @@ -0,0 +1,32 @@ +## IMDB + +Adds various IMDB functionalities. + +### Description + +This module provides a command which allows users to search IMDB for a movie. + +### Dependencies + +It has following dependencies: ++ [request](https://github.com/mikeal/request) + +### config.json + +output prefix can be set. +``` +{ + "outputPrefix": "\u00033IMDB\u000f" +} + +``` + +### Commands + + +#### ~imdb [movie] +Searches IMDB for a movie. +Example: ++ ~imdb Fear and Loathing in Las Vegas + +### TODO \ No newline at end of file diff --git a/modules/lastfm/README.md b/modules/lastfm/README.md new file mode 100644 index 0000000..db3c7e0 --- /dev/null +++ b/modules/lastfm/README.md @@ -0,0 +1,66 @@ +## LastFM + +Adds various LastFM functionalities. + +### Description + +This module provides a command which allows users to show stats of LastFM and such stuff. + +### Dependencies + +It has following dependencies: ++ [request](https://github.com/mikeal/request) ++ [async](https://github.com/caolan/async) ++ [moment](https://github.com/moment/moment) + +### config.json + +api_key and output prefix can be set. +Example: +``` +{ + "dependencies": [ "profile" ], + "api_key": "blah", + "outputPrefix": "\u000315,5last.fm\u000f" +} +``` + +### Commands + + +#### ~lastfm [user] +Display all scrobbles of a user. +Example: ++ ~lastfm reality + +#### ~scrobbliest +Displays the users with the most scrobbles. +Example: ++ ~scrobbliest + +#### ~suggestion +Displays a suggestion based on the listened scrobbles. +Example: ++ ~suggestion + +#### ~listening +Displays the currently/last played song of the posting user. +Example: ++ ~listening + +#### ~taste [user] +Compares two users (the posting user and the defined user). +Example: ++ ~taste reality + +#### ~tastiest +Displays the users that matches the most in music taste. +Example: ++ ~tastiest + +#### ~artists [user] +Compares two users (the posting user and the defined user) and displays their matching artists. +Example: ++ ~artists reality + +### TODO \ No newline at end of file diff --git a/modules/radio/README.md b/modules/radio/README.md new file mode 100644 index 0000000..d86dc49 --- /dev/null +++ b/modules/radio/README.md @@ -0,0 +1,28 @@ +## TODO + +bar. + +### Description + +This module provides a command which allows users to foobar. + +### Dependencies + +It has following dependencies: ++ [foo](link) + +### config.json + +foo +``` +``` + +### Commands + + +#### ~foo [(bar] + +Example: ++ ~foo bar + +### TODO \ No newline at end of file diff --git a/modules/soundcloud/README.md b/modules/soundcloud/README.md new file mode 100644 index 0000000..88ba889 --- /dev/null +++ b/modules/soundcloud/README.md @@ -0,0 +1,33 @@ +## Souncloud + +Adds various Soundcloud functionality. + +### Description + +This module provides a command which allows users to search Soundcloud for a song. + +### Dependencies + +It has following dependencies: ++ [request](https://github.com/mikeal/request) + +### config.json + +client_id and output prefix can be set. +``` +{ + "client_id": "CLIENT _ID_HERE, + "outputPrefix": "\u000307soundcloud\u000f", + "dependencies": [ "link" ] +} +``` + +### Commands + + +#### ~soundcloud [song] +Searches Soundcloud for a song. +Example: ++ ~soundcloud TNGHT + +### TODO \ No newline at end of file diff --git a/modules/sstats/README.md b/modules/sstats/README.md new file mode 100644 index 0000000..b85d5a9 --- /dev/null +++ b/modules/sstats/README.md @@ -0,0 +1,83 @@ +## sstats + +Adds various stats functionality. + +### Description + +This module provides a command which allows users to print stats, such as how many words etc.. + +### Dependencies + +It has following dependencies: ++ [async](https://github.com/caolan/async) + +### config.json + +database type and curses can be set. +``` +{ + "dbType": "redis", + "dependencies": [ "users" ], + "curses": [ "s***", "f***" ] +} +``` + +### Commands + + +#### ~words [user] +Displays how many words a user wrote. +Example: ++ ~words reality + +#### ~lines [user] +Displays how many lines a user wrote. +Example: ++ ~lines reality + +#### ~loudest [channel] +Displays the users with the most lines written. +Example: ++ ~loudest #tripsit + +#### ~uncouth [channel] +Displays the users with the most curses written. +Example: ++ ~uncouth #tripsit + +#### ~shoutiest [user] +Displays the users with the most capital words written. +Example: ++ ~shoutiest #tripsit + +#### ~wordiest [channel] +Displays the users with the most words written. +Example: ++ ~wordiest #tripsit + +#### ~clines [user] +Displays how many lines a user wrote in all channels. +Example: ++ ~clines reality + +#### ~last [user] +Displays when the user was last seen. +Example: ++ ~last reality + +#### ~trackword [word] +Adding a word to being tracked. +Example: ++ ~trackword derp + +#### ~word [word] +Displays how often a word was written in all channels. +Example: ++ ~word derp + +#### ~wordusers [word] +Displays how often and by whom a word was written. +Example: ++ ~wordusers derp + +### TODO \ No newline at end of file diff --git a/modules/sstats/config.json b/modules/sstats/config.json index 121157d..441ddad 100644 --- a/modules/sstats/config.json +++ b/modules/sstats/config.json @@ -2,4 +2,4 @@ "dbType": "redis", "dependencies": [ "users" ], "curses": [ "shit", "piss", "fuck", "cunt", "cocksucker", "motherfucker", "tits" ] -} +} \ No newline at end of file diff --git a/modules/steam/README.md b/modules/steam/README.md new file mode 100644 index 0000000..39c5775 --- /dev/null +++ b/modules/steam/README.md @@ -0,0 +1,42 @@ +## Steam + +Adds various steam functionalities. + +### Description + +This module provides a command which allows users to seek and compare games inside the Steam library. + +### Dependencies + +It has following dependencies: ++ [request](https://github.com/mikeal/request) + +### config.json + +api_key and output prefix +For example: +``` +{ + "api_key": "bleh", + "outputPrefix": "\u00033steam\u000f" +} +``` + +### Commands + + +#### ~games [user] +Seeks the games of a user. If left blank, the posting users games will be displayed. +Example: ++ ~games reality ++ ~games + +#### ~playing [user] +Displays the currently/last played game of a user. If left blank, the posting users game will be displayed. +Example: ++ ~playing reality ++ ~playing + + + +### TODO \ No newline at end of file diff --git a/modules/steam/config.json b/modules/steam/config.json index 4e40b80..eff4a11 100644 --- a/modules/steam/config.json +++ b/modules/steam/config.json @@ -1,4 +1,4 @@ { "api_key": "bleh", "outputPrefix": "\u00033steam\u000f" -} +} \ No newline at end of file diff --git a/modules/units/README.md b/modules/units/README.md index 9d59619..070a89a 100644 --- a/modules/units/README.md +++ b/modules/units/README.md @@ -8,8 +8,10 @@ This module provides a command which allows users to convert units into another unit given the international character of networks. Converts time, distance, mass, volume and digital values. +### Dependencies + It has following dependencies: -node-units : https://github.com/brettlangdon/node-units ++ [node-units](https://github.com/brettlangdon/node-units) ### Commands @@ -21,4 +23,4 @@ Example: ### TODO -Currency Conversion \ No newline at end of file ++ Currency Conversion \ No newline at end of file diff --git a/modules/warning/README.md b/modules/warning/README.md new file mode 100644 index 0000000..27c09f3 --- /dev/null +++ b/modules/warning/README.md @@ -0,0 +1,33 @@ +## Warning + +Adds functionality to warn a user. + +### Description + +This module provides commands which allows power users to warn another user. + +### Dependencies + +It has following dependencies: ++ [node-uuid](https://github.com/broofa/node-uuid) + +### config.json + +foo +``` +``` + +### Commands + + +#### ~warn [user] +Warning a user. +Example: ++ ~warn reality + +#### ~warnings [user] +Getting info of all warnings. +Example: ++ ~warnings reality + +### TODO \ No newline at end of file diff --git a/modules/wolframalpha/README.md b/modules/wolframalpha/README.md index f2acdd9..9ec2965 100644 --- a/modules/wolframalpha/README.md +++ b/modules/wolframalpha/README.md @@ -6,20 +6,28 @@ Calculates whatever you want. This module provides a command which allows users to calculate whatever they want. -It has following dependencies: -node-wolfram : https://github.com/strax/node-wolfram +### Dependencies -### appID +It has following dependencies: ++ [node-wolfram](https://github.com/strax/node-wolfram) + +### config.json + +This module is ignorable. appID has to be added into config.json. It can be obtained at http://products.wolframalpha.com/developers/ for free. +`{ + "ignorable": true, + "appID": "APP_ID_HERE" +}` ### Commands #### ~calculate [(whatever)] Example: -~calculate (2+2) -~calculate (x^2+2x+4) ++ ~calculate (2+2) ++ ~calculate (x^2+2x+4) ### TODO \ No newline at end of file diff --git a/modules/words/README.md b/modules/words/README.md new file mode 100644 index 0000000..93163a6 --- /dev/null +++ b/modules/words/README.md @@ -0,0 +1,41 @@ +## words + +Adds various functionality for words. + +### Description + +This module provides commands which allows users to have various functionality for words, +such as defining, getting the etymology and jimble the letters. +To achieve that, this module seeks the wordnik database. + +### Dependencies + +It has following dependencies: ++ [node-wordnik](https://github.com/cpetzold/node-wordnik) + +### config.json + +api_key : most likely the wordnik developer homepage + +### Commands + + +#### ~define [word] + +Seeks wordnik database and replys with a definition. +Example: ++ ~define Spaghetti + +#### ~etymology [word] + +Seeks wordnik database and replys with its etymology. +Example: ++ ~etymology Spaghetti + +#### ~jimble [word] + +Jimbles the letters of a word. +Example: ++ ~jimble Spaghetti + +### TODO \ No newline at end of file diff --git a/modules/words/config.json b/modules/words/config.json index 649e069..b147589 100644 --- a/modules/words/config.json +++ b/modules/words/config.json @@ -1,3 +1,3 @@ { "api_key": "http://developer.wordnik.com/" -} +} \ No newline at end of file diff --git a/modules/youare/README.md b/modules/youare/README.md index 09a9940..d7d9167 100644 --- a/modules/youare/README.md +++ b/modules/youare/README.md @@ -8,3 +8,20 @@ This module occasionally comes back and says "You're a x" when somebody goes "y is x" or "y are x," with the intention of annoying people who are calling something crap. Warning: this module occasionally causes the bot to be nice to people. + +### Dependencies + +It has no dependencies. + +### config.json + +This module is ignorable. +``` +{ + "ignorable": true +} +``` + +### Commands + +none. \ No newline at end of file diff --git a/modules/youtube/README.md b/modules/youtube/README.md new file mode 100644 index 0000000..9133920 --- /dev/null +++ b/modules/youtube/README.md @@ -0,0 +1,33 @@ +## Youtube + +Searches youtube.com for videos. + +### Description + +This module provides a command which allows users to search for a video on youtube.com. +It replies with a video thats title is the most similar to the input. + +### Dependencies + +It has following dependencies: ++ [request](https://github.com/mikeal/request) + +### config.json + +Output prefix can be set. +For example: +``` +{ + "outputPrefix": "\u00031,0You\u000315,5Tube\u000f" +} +``` + + +### Commands + +#### ~youtube [title] + +Example: ++ ~youtube Hello World! + +### TODO \ No newline at end of file From df87621241da8e53cac2a7246812c5a535ec3fc3 Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 06:09:16 +0100 Subject: [PATCH 08/13] sample fix --- modules/SAMPLE/{config.json_.json => config} | 0 modules/SAMPLE/{foo.js_.js => foo} | 0 modules/SAMPLE/{strings.json_.json => strings} | 0 modules/SAMPLE/{usage.json_.json => usage} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename modules/SAMPLE/{config.json_.json => config} (100%) rename modules/SAMPLE/{foo.js_.js => foo} (100%) rename modules/SAMPLE/{strings.json_.json => strings} (100%) rename modules/SAMPLE/{usage.json_.json => usage} (100%) diff --git a/modules/SAMPLE/config.json_.json b/modules/SAMPLE/config similarity index 100% rename from modules/SAMPLE/config.json_.json rename to modules/SAMPLE/config diff --git a/modules/SAMPLE/foo.js_.js b/modules/SAMPLE/foo similarity index 100% rename from modules/SAMPLE/foo.js_.js rename to modules/SAMPLE/foo diff --git a/modules/SAMPLE/strings.json_.json b/modules/SAMPLE/strings similarity index 100% rename from modules/SAMPLE/strings.json_.json rename to modules/SAMPLE/strings diff --git a/modules/SAMPLE/usage.json_.json b/modules/SAMPLE/usage similarity index 100% rename from modules/SAMPLE/usage.json_.json rename to modules/SAMPLE/usage From f21745305e6ef61538cd7ed2a20b7d2a8bc65011 Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 06:32:46 +0100 Subject: [PATCH 09/13] Only known users can add quotes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit May not work due to callback inside dbot.users.api.isKnownUser(…) --- modules/quotes/commands.js | 8 ++++++++ modules/users/config.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/quotes/commands.js b/modules/quotes/commands.js index 83e596a..9a379d8 100644 --- a/modules/quotes/commands.js +++ b/modules/quotes/commands.js @@ -11,6 +11,10 @@ var commands = function(dbot) { var key = event.input[1].toLowerCase().trim(), quote = event.input[2]; + var server=event.server, + user=event.rUser; + if (dbot.users.api.isKnownUser(server,user,function(x) {return x})==true) + { this.api.addQuote(key, quote, event.user, function(newCount) { if(newCount) { dbot.api.event.emit('~qadd', [ key, quote ]); @@ -22,6 +26,10 @@ var commands = function(dbot) { event.reply(dbot.t('quote_exists')); } }); + } + else{ + event.reply(dbot.t('You have no permissions to add quotes. :(')); + } }, /*** Quote Retrieval ***/ diff --git a/modules/users/config.json b/modules/users/config.json index c9b6aa2..1a8c339 100644 --- a/modules/users/config.json +++ b/modules/users/config.json @@ -1,6 +1,6 @@ { "ignorable": false, - "dependencies": [ "event" ], + "dependencies": [ "event" , "users"], "dbKeys": [ "knownUsers" ], "dbType": "redis" } From fb14f249277f381a6e28f78bde9383575de3c893 Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 07:23:25 +0100 Subject: [PATCH 10/13] TVDB module Added a tvdb module, needs to request apikey. may or may not work due to tvshow array. --- modules/tvdb/README.md | 32 +++++++++++++++++++++ modules/tvdb/config.json | 4 +++ modules/tvdb/strings.json | 8 ++++++ modules/tvdb/tvdb.js | 59 +++++++++++++++++++++++++++++++++++++++ modules/tvdb/usage.json | 3 ++ 5 files changed, 106 insertions(+) create mode 100644 modules/tvdb/README.md create mode 100644 modules/tvdb/config.json create mode 100644 modules/tvdb/strings.json create mode 100644 modules/tvdb/tvdb.js create mode 100644 modules/tvdb/usage.json diff --git a/modules/tvdb/README.md b/modules/tvdb/README.md new file mode 100644 index 0000000..fd22daa --- /dev/null +++ b/modules/tvdb/README.md @@ -0,0 +1,32 @@ +## theTVDB + +Addes various TVDB funtionalities. + +### Description + +This module provides a command which allows users to search for series on theTVDB.com. + +### Dependencies + +It has following dependencies: ++ [node-tvdb](https://github.com/enyo/node-tvdb) + +### config.json + +ignorable and apiKey can be set. A key can be requested at http://thetvdb.com/?tab=apiregister +``` +{ + "ignorable": true, + "apiKey": "blah" +} +``` + +### Commands + + +#### ~tvdb [series] +Searches for series on theTVDB +Example: ++ ~tvdb How I met your Mother + +### TODO \ No newline at end of file diff --git a/modules/tvdb/config.json b/modules/tvdb/config.json new file mode 100644 index 0000000..1f5a2d7 --- /dev/null +++ b/modules/tvdb/config.json @@ -0,0 +1,4 @@ +{ + "ignorable": true, + "apiKey": "blah" +} \ No newline at end of file diff --git a/modules/tvdb/strings.json b/modules/tvdb/strings.json new file mode 100644 index 0000000..a08974e --- /dev/null +++ b/modules/tvdb/strings.json @@ -0,0 +1,8 @@ +{ + "result": { + "en": "{name} - {banner} - http://thetvdb.com/?id={id}" + }, + "error": { + "en": "Something went wrong :( Example:'~tvdb How I met your Mother'" + } +} diff --git a/modules/tvdb/tvdb.js b/modules/tvdb/tvdb.js new file mode 100644 index 0000000..fdb11dc --- /dev/null +++ b/modules/tvdb/tvdb.js @@ -0,0 +1,59 @@ +/** + * Module Name: theTVDB + * Description: Addes various TVDB functionality. + * Requires: node-tvdb [https://github.com/enyo/node-tvdb] + */ + +var _ = require('underscore')._, + TVDB = require('tvdb'), + thetvdb = new TVDB({ apiKey: this.config.apiKey });//dependencies + +var tvdb = function(dbot) { //name of module + + this.ApiRoot = 'API_ROOT_HERE'; + + this.internalAPI = { + //code for internal api here + }; + + this.api = { + //code for api here + }; + + this.commands = { + //code for commands here + '~tvdb' : function(){ + var query = event.input[1]; + thetvdb.findTvShow(query, function(err, tvShows) { + if (err) + { + event.respond(dbot.t('error'); + return; + } + else + { + // Handle tvShows. + var name=tvShows[0].SeriesName, + banner=tvShows[0].banner, + id=tvShows[0].id; + event.reply(dbot.t('result',{'name':name,'banner'=banner,'id'=id})); + } + }; + + } + }; + + this.onLoad = function() { + //code for stuff to be done on load here + }; + + this.onDestroy = function() { + //stuff to be done on destroy here + }; + } + +}; + +exports.fetch = function(dbot) { + return new tvdb(dbot); //name of module +}; diff --git a/modules/tvdb/usage.json b/modules/tvdb/usage.json new file mode 100644 index 0000000..c22bf02 --- /dev/null +++ b/modules/tvdb/usage.json @@ -0,0 +1,3 @@ +{ + "~tvdb": "~tvdb [series]" +} \ No newline at end of file From c6fdd3bdbcad9a59346f7a60c1ed6f8ed8925c2b Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 08:40:24 +0100 Subject: [PATCH 11/13] 500px random popular photo --- modules/500px/500px.js | 56 ++++++++++++++++++++++++++++++++++++++ modules/500px/README.md | 34 +++++++++++++++++++++++ modules/500px/config.json | 4 +++ modules/500px/strings.json | 8 ++++++ modules/500px/usage.json | 3 ++ 5 files changed, 105 insertions(+) create mode 100644 modules/500px/500px.js create mode 100644 modules/500px/README.md create mode 100644 modules/500px/config.json create mode 100644 modules/500px/strings.json create mode 100644 modules/500px/usage.json diff --git a/modules/500px/500px.js b/modules/500px/500px.js new file mode 100644 index 0000000..89e61ca --- /dev/null +++ b/modules/500px/500px.js @@ -0,0 +1,56 @@ +/** + * Module Name: 500px + * Description: Adds various 500px functionality. + * Requires: node-500px [http://mjgil.github.io/five-px/] + */ + +var _ = require('underscore')._, + API500px = require('500px').API500px, + api500px = new API500px(this.config.consumerKey);//dependencies + +var foo = function(dbot) { //name of module + + this.ApiRoot = 'API_ROOT_HERE'; + + this.internalAPI = { + //code for internal api here + }; + + this.api = { + //code for api here + }; + + this.commands = { + //code for commands here + '~r500px':function(){ + + var random = Math.floor(Math.random() * 30); + api500px.photos.getPopular({'sort': 'created_at', 'rpp': '30'}, function(error, results) { + if (error) { + event.reply(dbot.t('error')); + } else { + // getting photo name and url from results json http://is.gd/hALYmR + var name=results.photos[random].name, + url=results.photos[random].image_url; + event.reply(dbot.t('result',{'name':name,'url'=url})); + } + }); + + } + + }; + + this.onLoad = function() { + //code for stuff to be done on load here + }; + + this.onDestroy = function() { + //stuff to be done on destroy here + }; + } + +}; + +exports.fetch = function(dbot) { + return new foo(dbot); //name of module +}; diff --git a/modules/500px/README.md b/modules/500px/README.md new file mode 100644 index 0000000..5e9e6fc --- /dev/null +++ b/modules/500px/README.md @@ -0,0 +1,34 @@ +## 500px + +Adds various 500px functionality. + +### Description + +This module provides a command which allows users to search for a random popular 500px photo. + +### Dependencies + +It has following dependencies: ++ [node-500px](https://github.com/ro-ka/node-500px) + +### config.json + +ignorable and consumerKey has to be configurated. It can be obtained at http://developers.500px.com +``` +{ + "ignorable": true, + "consumerKey": "CONSUMERKEY_HERE" +} +``` + +### Commands + + +#### ~r500px +Responds with a random popular 500px photo. +Example: ++ ~r500px + +### TODO + +Photo by user etc. \ No newline at end of file diff --git a/modules/500px/config.json b/modules/500px/config.json new file mode 100644 index 0000000..17552f2 --- /dev/null +++ b/modules/500px/config.json @@ -0,0 +1,4 @@ +{ + "ignorable": true, + "consumerKey": "CONSUMERKEY_HERE" +} \ No newline at end of file diff --git a/modules/500px/strings.json b/modules/500px/strings.json new file mode 100644 index 0000000..b0a684d --- /dev/null +++ b/modules/500px/strings.json @@ -0,0 +1,8 @@ +{ + "result":{ + "en": "{name} - {url}" + }, + "error": { + "en": "Something went wrong :( Example:'~r500px'" + } +} diff --git a/modules/500px/usage.json b/modules/500px/usage.json new file mode 100644 index 0000000..b8fccfb --- /dev/null +++ b/modules/500px/usage.json @@ -0,0 +1,3 @@ +{ + "~r500px": "~r500px" +} \ No newline at end of file From 408707157a0c4685578e00098cca4472cf2f07ef Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 20:25:50 +0100 Subject: [PATCH 12/13] Unit module fix --- modules/units/units.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/units/units.js b/modules/units/units.js index 85c730d..0bc4a88 100644 --- a/modules/units/units.js +++ b/modules/units/units.js @@ -13,11 +13,11 @@ var units = function(dbot) { '~convert': function(event) { var query = event.input[1]; try { + var result = unit.convert(query); event.reply(dbot.t('result', { 'input': query, 'output': result })); - var result = unit.convert(query); } catch (e) { event.reply(dbot.t('error')); From 3ea9fb8c68611b3eaeab68ff49f3ac9cf025664b Mon Sep 17 00:00:00 2001 From: thoso Date: Thu, 20 Feb 2014 20:50:12 +0100 Subject: [PATCH 13/13] 500px crappy photo fix --- modules/500px/500px.js | 6 +++--- modules/500px/strings.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/500px/500px.js b/modules/500px/500px.js index 89e61ca..dcfc436 100644 --- a/modules/500px/500px.js +++ b/modules/500px/500px.js @@ -30,9 +30,9 @@ var foo = function(dbot) { //name of module event.reply(dbot.t('error')); } else { // getting photo name and url from results json http://is.gd/hALYmR - var name=results.photos[random].name, - url=results.photos[random].image_url; - event.reply(dbot.t('result',{'name':name,'url'=url})); + var 500px_name=results.photos[random].name, + 500px_id=results.photos[random].id; + event.reply(dbot.t('result',{'name':500px_name,'id'=500px_id})); } }); diff --git a/modules/500px/strings.json b/modules/500px/strings.json index b0a684d..16cea03 100644 --- a/modules/500px/strings.json +++ b/modules/500px/strings.json @@ -1,6 +1,6 @@ { "result":{ - "en": "{name} - {url}" + "en": "{name} - http://500px.com/photo/{id}" }, "error": { "en": "Something went wrong :( Example:'~r500px'"