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/install b/install index 9f435b6..5f59661 100755 --- a/install +++ b/install @@ -14,7 +14,7 @@ then exit 1 fi -npm install crypto-js process async wordnik node-uuid underscore request sandbox express moment-timezone moment jade databank databank-redis ent passport passport-local password-hash connect-flash +npm install node-units tvdb crypto-js 500px process async wordnik node-uuid underscore request sandbox express moment-timezone moment jade databank databank-redis ent passport passport-local password-hash connect-flash cd public/ wget http://twitter.github.com/bootstrap/assets/bootstrap.zip diff --git a/modules/SAMPLE/README.md b/modules/SAMPLE/README.md new file mode 100644 index 0000000..0df8e12 --- /dev/null +++ b/modules/SAMPLE/README.md @@ -0,0 +1,28 @@ +## FOO + +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/SAMPLE/config b/modules/SAMPLE/config new file mode 100644 index 0000000..a1e88b8 --- /dev/null +++ b/modules/SAMPLE/config @@ -0,0 +1,4 @@ +{ + "foo": true, + "foo": "bar" +} \ No newline at end of file diff --git a/modules/SAMPLE/foo b/modules/SAMPLE/foo new file mode 100644 index 0000000..5435698 --- /dev/null +++ b/modules/SAMPLE/foo @@ -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 b/modules/SAMPLE/strings new file mode 100644 index 0000000..dd01128 --- /dev/null +++ b/modules/SAMPLE/strings @@ -0,0 +1,8 @@ +{ + "foo": { + "en": "{output} bar" + }, + "foo2": { + "en": "Something went wrong :( Example:'~foo bar'" + } +} diff --git a/modules/SAMPLE/usage b/modules/SAMPLE/usage new file mode 100644 index 0000000..8f9e67e --- /dev/null +++ b/modules/SAMPLE/usage @@ -0,0 +1,3 @@ +{ + "~foo": "~foo [bar]" +} \ No newline at end of file diff --git a/modules/fpx/README.md b/modules/fpx/README.md new file mode 100644 index 0000000..23cbf04 --- /dev/null +++ b/modules/fpx/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, + "api_key": "CONSUMERKEY_HERE" +} +``` + +### Commands + + + ~r500px +Responds with a random popular 500px photo. +Example: ++ ~r500px + +### TODO + +Photo by user etc. diff --git a/modules/fpx/config.json b/modules/fpx/config.json new file mode 100644 index 0000000..0044a09 --- /dev/null +++ b/modules/fpx/config.json @@ -0,0 +1,4 @@ +{ + "ignorable": true, + "api_key": "CONSUMERKEY_HERE" +} diff --git a/modules/fpx/fpx.js b/modules/fpx/fpx.js new file mode 100644 index 0000000..a2ebdc4 --- /dev/null +++ b/modules/fpx/fpx.js @@ -0,0 +1,33 @@ +/** + * Module Name: 500px + * Description: Adds various 500px functionality. + * Requires: node-500px [http://mjgil.github.io/five-px/] + */ + +var _ = require('underscore')._, + API500px = require('500px').API500px; + +var fpx = function(dbot) { + this.commands = { + '~r500px': function(event) { + var random = Math.floor(Math.random() * 30); + this.api500px.photos.getPopular({'sort': 'created_at', 'rpp': '30'}, function(error, results) { + if (error) { + event.reply(dbot.t('5px_error')); + console.log(error); + } else { + var name = results.photos[random].name, + url = results.photos[random].image_url; + event.reply(dbot.t('5px_result',{'name':name,'url':url})); + } + }); + } + }; + this.onLoad = function() { + this.api500px = new API500px(this.config.api_key); + }.bind(this); +}; + +exports.fetch = function(dbot) { + return new fpx(dbot); +}; diff --git a/modules/fpx/strings.json b/modules/fpx/strings.json new file mode 100644 index 0000000..3a42e73 --- /dev/null +++ b/modules/fpx/strings.json @@ -0,0 +1,8 @@ +{ + "5px_result":{ + "en": "{name} - {url}" + }, + "5px_error": { + "en": "Something went wrong :( Example: '~r500px'" + } +} diff --git a/modules/fpx/usage.json b/modules/fpx/usage.json new file mode 100644 index 0000000..b8fccfb --- /dev/null +++ b/modules/fpx/usage.json @@ -0,0 +1,3 @@ +{ + "~r500px": "~r500px" +} \ 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/radio/radio.js b/modules/radio/radio.js index 196260e..e628815 100644 --- a/modules/radio/radio.js +++ b/modules/radio/radio.js @@ -46,7 +46,20 @@ var radio = function(dbot) { }.bind(this)); }.bind(this), }; - + + this.commands={ + '~request': function(event){ + var dj = this.data['icy-description'], + song = event.input[1]; + dbot.say(event.server, dj, dbot.t('radio_request',{ + 'user': event.user, + 'song': song + })); + event.reply('Song requested!'); + } + }; + this.commands['~request'].regex = [/^request ([\d\w\s-]*)/, 2]; + this.onLoad = function() { this.internalAPI.startRadio(); dbot.api.timers.addTimer(20000, function() { diff --git a/modules/radio/strings.json b/modules/radio/strings.json index ecd3157..64553c2 100644 --- a/modules/radio/strings.json +++ b/modules/radio/strings.json @@ -4,5 +4,8 @@ }, "now_playing": { "en": "Now Playing: {name} - {song} - {url}" + }, + "radio_request":{ + "en": "User {user} requests '{song}' to be played on the radio." } } 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/tvdb/README.md b/modules/tvdb/README.md new file mode 100644 index 0000000..4aa9680 --- /dev/null +++ b/modules/tvdb/README.md @@ -0,0 +1,31 @@ +## 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, + "api_key": "blah" +} +``` + +### Commands + + ~tvdb [series] +Searches for series on theTVDB +Example: ++ ~tvdb How I met your Mother + +### TODO diff --git a/modules/tvdb/config.json b/modules/tvdb/config.json new file mode 100644 index 0000000..d24556f --- /dev/null +++ b/modules/tvdb/config.json @@ -0,0 +1,5 @@ +{ + "ignorable": true, + "api_key": "blah", + "outputPrefix": "\u00033TVDB\u000f" +} diff --git a/modules/tvdb/strings.json b/modules/tvdb/strings.json new file mode 100644 index 0000000..214dec6 --- /dev/null +++ b/modules/tvdb/strings.json @@ -0,0 +1,8 @@ +{ + "tvdb_result": { + "en": "{name} - http://thetvdb.com/?id={id}" + }, + "tvdb_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..48313cd --- /dev/null +++ b/modules/tvdb/tvdb.js @@ -0,0 +1,39 @@ +/** + * Module Name: theTVDB + * Description: Addes various TVDB functionality. + * Requires: node-tvdb [https://github.com/enyo/node-tvdb] + */ + +var _ = require('underscore')._, + TVDB = require('tvdb'); + +var tvdb = function(dbot) { + this.commands = { + '~tvdb' : function(event) { + var query = event.input[1]; + this.thetvdb.findTvShow(query, function(err, tvShows) { + if (err) { + event.reply(dbot.t('tvdb_error')); + } else { + // Handle tvShows. + var name = tvShows[0].name, + id = tvShows[0].id; + + event.reply(dbot.t('tvdb_result', { + 'name': name, + 'id': id + })); + } + }); + } + }; + this.commands['~tvdb'].regex = [/^tvdb ([\d\w\s-]*)/, 2]; + + this.onLoad = function() { + this.thetvdb = new TVDB({ 'apiKey': this.config.api_key }); + }.bind(this); +}; + +exports.fetch = function(dbot) { + return new tvdb(dbot); +}; 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 diff --git a/modules/units/README.md b/modules/units/README.md new file mode 100644 index 0000000..070a89a --- /dev/null +++ b/modules/units/README.md @@ -0,0 +1,26 @@ +## 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. + +### Dependencies + +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/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/units/strings.json b/modules/units/strings.json new file mode 100644 index 0000000..298f878 --- /dev/null +++ b/modules/units/strings.json @@ -0,0 +1,8 @@ +{ + "unit_result": { + "en": "{input}: {output}" + }, + "unit_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..49bf2de --- /dev/null +++ b/modules/units/units.js @@ -0,0 +1,32 @@ +/** + * 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 { + var result = unit.convert(query); + event.reply(dbot.t('unit_result', { + 'input': query, + 'output': result + })); + } + catch (e) { + event.reply(dbot.t('unit_error')); + } + } + }; + this.commands['~convert'].regex = [/^convert ([\d\w\s-]*)/, 2]; +}; + +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 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" } 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 new file mode 100644 index 0000000..9ec2965 --- /dev/null +++ b/modules/wolframalpha/README.md @@ -0,0 +1,33 @@ +## Wolfram Alpha Calculator + +Calculates whatever you want. + +### Description + +This module provides a command which allows users to calculate whatever they want. + +### Dependencies + +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) + +### TODO \ 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 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