Output what meme is sent

This commit is contained in:
Daniel Løvbrøtte Olsen 2016-08-22 22:12:31 +02:00 committed by GitHub
parent 84087570c3
commit 129196b290

View File

@ -58,7 +58,7 @@ exports.meme = function(session) {
var file; var file;
var memewhitelist = fs.readdirSync("/usr/src/app/memes/"); var memewhitelist = fs.readdirSync("/usr/src/app/memes/");
if (session.message.text.match(helper.regex("meme random")) != null) { if (session.message.text.match(helper.regex("meme random")) != null) {
var image = Math.floor(Math.random() * 9999999) % memewhitelist.length; var image = Math.floor(Math.random() * 1000000) % memewhitelist.length;
file=(memewhitelist[image]); file=(memewhitelist[image]);
} }
else { else {
@ -74,7 +74,7 @@ exports.meme = function(session) {
contentType: "image/png", contentType: "image/png",
contentUrl: "http://dandellion.xyz/dodsorfas/memes/" + file contentUrl: "http://dandellion.xyz/dodsorfas/memes/" + file
}]); }]);
session.send("This meme is called: " + file);
session.send(msg); session.send(msg);
} }