Added .wtf command
This commit is contained in:
parent
89a5df9e2b
commit
a075e3fe2c
10
app.js
10
app.js
|
@ -35,6 +35,7 @@ var getDnDCharacter = require('./plugins/getCharacter')();
|
||||||
var getDiceString = require('./plugins/getDice')();
|
var getDiceString = require('./plugins/getDice')();
|
||||||
var getUrlString = require('./plugins/getUrl')();
|
var getUrlString = require('./plugins/getUrl')();
|
||||||
var getTweet = require('./plugins/getTweet')(config);
|
var getTweet = require('./plugins/getTweet')(config);
|
||||||
|
var getInstantAnswer = require('./plugins/getInstantAnswer')(config);
|
||||||
|
|
||||||
// Configure logger
|
// Configure logger
|
||||||
// create a write stream (in append mode)
|
// create a write stream (in append mode)
|
||||||
|
@ -111,7 +112,14 @@ var handleMessage = function(from, to, message) {
|
||||||
var character = getDnDCharacter();
|
var character = getDnDCharacter();
|
||||||
client.say(to, ''+character);
|
client.say(to, ''+character);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Instant Answer
|
||||||
|
if (res = message.match(/^\.wtf (.+)$/i)) {
|
||||||
|
getInstantAnswer(res[1]).then(function(answer) {
|
||||||
|
client.say(to, '' + answer);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Throw dice
|
// Throw dice
|
||||||
if (res = message.match(/^\.heit(a|ä) ([0-9]+)d([0-9]+)$/i)) {
|
if (res = message.match(/^\.heit(a|ä) ([0-9]+)d([0-9]+)$/i)) {
|
||||||
var th = getDiceString(res[2], res[3]);
|
var th = getDiceString(res[2], res[3]);
|
||||||
|
|
13
appTest.js
13
appTest.js
|
@ -11,7 +11,18 @@ var res = text.match(regExp);
|
||||||
console.log(res[5]);
|
console.log(res[5]);
|
||||||
console.log(res[7]);
|
console.log(res[7]);
|
||||||
|
|
||||||
|
var DDG = require('node-ddg-api').DDG;
|
||||||
|
|
||||||
|
var ddg = new DDG('my-app-name');
|
||||||
|
|
||||||
|
ddg.instantAnswer('dw', {skip_disambig: '0'}, function(err, response) {
|
||||||
|
console.log(response);
|
||||||
|
console.log('"' + response.RelatedTopics[0].Text + '" | ' + response.RelatedTopics[0].FirstURL);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
var tweet = "https://twitter.com/lanxu/status/266184139324157952";
|
var tweet = "https://twitter.com/lanxu/status/266184139324157952";
|
||||||
|
|
||||||
var config = require('./config');
|
var config = require('./config');
|
||||||
|
@ -25,7 +36,7 @@ getTweet(sta).then(
|
||||||
console.log(tweet);
|
console.log(tweet);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
"node-uuid": "latest",
|
"node-uuid": "latest",
|
||||||
"irc": "latest",
|
"irc": "latest",
|
||||||
"googleapis": "latest",
|
"googleapis": "latest",
|
||||||
|
"node-ddg-api": "latest",
|
||||||
"twitter": "latest"
|
"twitter": "latest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user