mirror of
https://github.com/reality/dbot.git
synced 2024-12-03 17:39:28 +01:00
TVDB module
Added a tvdb module, needs to request apikey. may or may not work due to tvshow array.
This commit is contained in:
parent
7f8209544e
commit
fb14f24927
32
modules/tvdb/README.md
Normal file
32
modules/tvdb/README.md
Normal file
@ -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
|
4
modules/tvdb/config.json
Normal file
4
modules/tvdb/config.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"ignorable": true,
|
||||
"apiKey": "blah"
|
||||
}
|
8
modules/tvdb/strings.json
Normal file
8
modules/tvdb/strings.json
Normal file
@ -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'"
|
||||
}
|
||||
}
|
59
modules/tvdb/tvdb.js
Normal file
59
modules/tvdb/tvdb.js
Normal file
@ -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
|
||||
};
|
3
modules/tvdb/usage.json
Normal file
3
modules/tvdb/usage.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"~tvdb": "~tvdb [series]"
|
||||
}
|
Loading…
Reference in New Issue
Block a user