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