-
Notifications
You must be signed in to change notification settings - Fork 0
/
command.js
48 lines (46 loc) · 1.43 KB
/
command.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var exports = module.exports = {};
var utils = require('./utils.js');
var giphy = require('./giphy.js');
var artsy = require('./artsy.js');
var etsy = require('./etsy.js');
var blockchain = require('./blockchain.js');
var twilio = require('./twilio.js');
var file = require('read-file');
exports.parseCommand = function(line){
var words = line.split(" ");
var query = words.slice(1, words.length);
switch (words[0].toLowerCase()) {
case "help":
help = file.readFileSync(__dirname + '/txt/help.txt');
console.log("\n" + help + "\n");
break;
case "giphy":
giphy.parseCommand(query);
break;
case "artsy":
artsy.parseCommand(query);
break;
case "etsy":
etsy.parseCommand(query);
break;
case "blockchain":
blockchain.parseCommand(query);
break;
case "orderx":
//do thing
break;
case "twilio":
twilio.parseCommand(query);
break;
case "convert":
utils.toAscii(query);
break;
case "fedora":
utils.getImage("http://i.ytimg.com/vi/82yHd99YxnY/maxresdefault.jpg");
break;
case "gif":
utils.gif("http://media.giphy.com/media/Pij3hAnY2TNn2/giphy.gif");
default:
console.log("Didn't understand your command! Try typing help.");
}
}