From 7db432a2935c5e40ecfac6002370e398279e6db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= Date: Sun, 21 Aug 2016 18:27:11 +0200 Subject: [PATCH] memes --- dodsorfas/Skypebot/app.js | 1 + dodsorfas/Skypebot/commands.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dodsorfas/Skypebot/app.js b/dodsorfas/Skypebot/app.js index 972da8d..80dce84 100644 --- a/dodsorfas/Skypebot/app.js +++ b/dodsorfas/Skypebot/app.js @@ -36,6 +36,7 @@ bot.dialog('/', new builder.IntentDialog() .matches(helper.regex("about"), function(s) {cmd.about(s)}) .matches(helper.regex("help"), function(s) {cmd.help(s)}) .matches(helper.regex("meme \\w+"), function(s) {cmd.meme(s)}) + .matches(helper.regex("memes"), function(s) {cmd.memes(s)}) .onDefault(function(session) { session.send("I didn't understand. Say 'help' to get a list of commands!"); })); diff --git a/dodsorfas/Skypebot/commands.js b/dodsorfas/Skypebot/commands.js index 3e5c316..870c175 100644 --- a/dodsorfas/Skypebot/commands.js +++ b/dodsorfas/Skypebot/commands.js @@ -43,7 +43,9 @@ text.help = [ "about - Gives you information about the bot", "ping - pong!", "stuff - Information about different services we use", - "games - IPs and other related information about game servers we use" + "games - IPs and other related information about game servers we use", + "meme - meme posts the relevant meme", + "memes - lists all available memes" ]; exports.help = function(session) { @@ -70,4 +72,9 @@ exports.meme = function(session) { session.send(msg); } +} + +exports.memes = function(session) { + var memes = fs.readdirSync("/usr/src/app/memes/"); + helper.send(session, ["My available memes are:", memes.join(", ")]); } \ No newline at end of file