diff --git a/scripts/cute.js b/scripts/cute.js index 428fbe9..a00b3c4 100644 --- a/scripts/cute.js +++ b/scripts/cute.js @@ -2,7 +2,6 @@ // Cute bomb is the cutest script //Commands: // fred cute me -// fred cute bomb // fred cute bomb N module.exports = function(robot){ @@ -15,7 +14,9 @@ module.exports = function(robot){ return; } - msg.send( (JSON.parse(body).data.children)[Math.floor(Math.random()*(JSON.parse(body).data.children).length)].data.url); + var json = JSON.parse(body).data.children; + + msg.send( json[random].data.url); }); }); @@ -31,8 +32,15 @@ module.exports = function(robot){ return; } + var json = JSON.parse(body).data.children; + + for(var i = 0; i < count; i++){ - msg.send( (JSON.parse(body).data.children)[Math.floor(Math.random()*(JSON.parse(body).data.children).length)].data.url); + var random = Math.floor(Math.random()*json.length); + msg.send( json[random].data.url); + if(json.length > 1){ + json.splice(random, 1); + } } }); }); diff --git a/scripts/fingerguns.js b/scripts/fingerguns.js new file mode 100644 index 0000000..ab2bf6c --- /dev/null +++ b/scripts/fingerguns.js @@ -0,0 +1,16 @@ +//Description: +// Responds with some rad fingerguns. +//Commands: +// fred fingerguns + +module.exports = function(robot){ + + let emoticons = ['(☞ ͡° ͜ʖ ͡°)☞','(σ゚ロ゚)σ','(╭☞• ⍛• )╭☞','(╭☞•̀o•́)╭☞','( ☞◔ ౪◔)☞','╭☞(-_-)╭☞']; + + robot.respond(/fingerguns/i, function(msg){ + + let randomEmoticon = emoticons[Math.floor((Math.random() * emoticons.length))]; + msg.send(randomEmoticon); + + }); +} \ No newline at end of file