3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 12:29:26 +01:00

everything except wolfram working

This commit is contained in:
reality 2014-02-20 20:10:45 +00:00
commit 03f2ac16b5
43 changed files with 848 additions and 7 deletions

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
# Ignore the user config files # Ignore the user config files
config.json
db.json db.json
# ignore npm # ignore npm

View File

@ -14,7 +14,7 @@ then
exit 1 exit 1
fi 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/ cd public/
wget http://twitter.github.com/bootstrap/assets/bootstrap.zip wget http://twitter.github.com/bootstrap/assets/bootstrap.zip

28
modules/SAMPLE/README.md Normal file
View File

@ -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

4
modules/SAMPLE/config Normal file
View File

@ -0,0 +1,4 @@
{
"foo": true,
"foo": "bar"
}

39
modules/SAMPLE/foo Normal file
View File

@ -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
};

8
modules/SAMPLE/strings Normal file
View File

@ -0,0 +1,8 @@
{
"foo": {
"en": "{output} bar"
},
"foo2": {
"en": "Something went wrong :( Example:'~foo bar'"
}
}

3
modules/SAMPLE/usage Normal file
View File

@ -0,0 +1,3 @@
{
"~foo": "~foo [bar]"
}

34
modules/fpx/README.md Normal file
View File

@ -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.

4
modules/fpx/config.json Normal file
View File

@ -0,0 +1,4 @@
{
"ignorable": true,
"api_key": "CONSUMERKEY_HERE"
}

33
modules/fpx/fpx.js Normal file
View File

@ -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);
};

8
modules/fpx/strings.json Normal file
View File

@ -0,0 +1,8 @@
{
"5px_result":{
"en": "{name} - {url}"
},
"5px_error": {
"en": "Something went wrong :( Example: '~r500px'"
}
}

3
modules/fpx/usage.json Normal file
View File

@ -0,0 +1,3 @@
{
"~r500px": "~r500px"
}

32
modules/imdb/README.md Normal file
View File

@ -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

66
modules/lastfm/README.md Normal file
View File

@ -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

28
modules/radio/README.md Normal file
View File

@ -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

View File

@ -46,7 +46,20 @@ var radio = function(dbot) {
}.bind(this)); }.bind(this));
}.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.onLoad = function() {
this.internalAPI.startRadio(); this.internalAPI.startRadio();
dbot.api.timers.addTimer(20000, function() { dbot.api.timers.addTimer(20000, function() {

View File

@ -4,5 +4,8 @@
}, },
"now_playing": { "now_playing": {
"en": "Now Playing: {name} - {song} - {url}" "en": "Now Playing: {name} - {song} - {url}"
},
"radio_request":{
"en": "User {user} requests '{song}' to be played on the radio."
} }
} }

View File

@ -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

83
modules/sstats/README.md Normal file
View File

@ -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

View File

@ -2,4 +2,4 @@
"dbType": "redis", "dbType": "redis",
"dependencies": [ "users" ], "dependencies": [ "users" ],
"curses": [ "shit", "piss", "fuck", "cunt", "cocksucker", "motherfucker", "tits" ] "curses": [ "shit", "piss", "fuck", "cunt", "cocksucker", "motherfucker", "tits" ]
} }

42
modules/steam/README.md Normal file
View File

@ -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

View File

@ -1,4 +1,4 @@
{ {
"api_key": "bleh", "api_key": "bleh",
"outputPrefix": "\u00033steam\u000f" "outputPrefix": "\u00033steam\u000f"
} }

31
modules/tvdb/README.md Normal file
View File

@ -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

5
modules/tvdb/config.json Normal file
View File

@ -0,0 +1,5 @@
{
"ignorable": true,
"api_key": "blah",
"outputPrefix": "\u00033TVDB\u000f"
}

View File

@ -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'"
}
}

39
modules/tvdb/tvdb.js Normal file
View File

@ -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);
};

3
modules/tvdb/usage.json Normal file
View File

@ -0,0 +1,3 @@
{
"~tvdb": "~tvdb [series]"
}

26
modules/units/README.md Normal file
View File

@ -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

View File

@ -0,0 +1,3 @@
{
"ignorable": true
}

View File

@ -0,0 +1,8 @@
{
"unit_result": {
"en": "{input}: {output}"
},
"unit_error": {
"en": "Something went wrong :( Example:'~convert 5 minutes to s'"
}
}

32
modules/units/units.js Normal file
View File

@ -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);
};

3
modules/units/usage.json Normal file
View File

@ -0,0 +1,3 @@
{
"~convert": "~convert [input value] [input unit] to [output unit]"
}

View File

@ -1,6 +1,6 @@
{ {
"ignorable": false, "ignorable": false,
"dependencies": [ "event" ], "dependencies": [ "event" , "users"],
"dbKeys": [ "knownUsers" ], "dbKeys": [ "knownUsers" ],
"dbType": "redis" "dbType": "redis"
} }

33
modules/warning/README.md Normal file
View File

@ -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

View File

@ -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

View File

@ -0,0 +1,4 @@
{
"ignorable": true,
"appID": "blah"
}

View File

@ -0,0 +1,8 @@
{
"result": {
"en": "{output}"
},
"error": {
"en": "Something went wrong :( Example:'~calculate (2+2)'"
}
}

View File

@ -0,0 +1,3 @@
{
"~calculate": "~calculate [(whatever)]"
}

View File

@ -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<result.queryresult.pod.length; a++)
{
var pod = result.queryresult.pod[a];
out += pod.$.title;
out +=": ";
for(var b=0; b<pod.subpod.length; b++)
{
var subpod = pod.subpod[b];
for(var c=0; c<subpod.plaintext.length; c++)
{
var text = subpod.plaintext[c];
console.log('\t', text);
out += text;
out += " ; ";
}
}
}
event.reply(dbot.t('result',{'output':out}));
}
});
}
};
};
exports.fetch = function(dbot) {
return new wolframalpha(dbot);
};

41
modules/words/README.md Normal file
View File

@ -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

View File

@ -1,3 +1,3 @@
{ {
"api_key": "http://developer.wordnik.com/" "api_key": "http://developer.wordnik.com/"
} }

View File

@ -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 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 something crap. Warning: this module occasionally causes the bot to be nice to
people. people.
### Dependencies
It has no dependencies.
### config.json
This module is ignorable.
```
{
"ignorable": true
}
```
### Commands
none.

33
modules/youtube/README.md Normal file
View File

@ -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