From 091f0604e0b12283bb889dc8b2e0bc3ce024665b Mon Sep 17 00:00:00 2001 From: hoppermeister Date: Mon, 20 Feb 2017 17:07:13 -0500 Subject: [PATCH 1/2] Cute objects in cute bomb no longer repeat --- scripts/cute.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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); + } } }); }); From 68a7cd70a4ecbf8763253832aaf981d1b3cac8cd Mon Sep 17 00:00:00 2001 From: Andrew Hopper Date: Mon, 16 Jul 2018 04:54:32 -0400 Subject: [PATCH 2/2] Adds fingerguns response --- scripts/fingerguns.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/fingerguns.js 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