From 96e00b5b85029c65160a4ffdcab0df5c6dd5baa0 Mon Sep 17 00:00:00 2001 From: ZyLacx Date: Thu, 8 Sep 2022 20:39:50 +0200 Subject: [PATCH] Who asked 2.0 not replying to messages without content, with attachments or embeds --- kokocina.js | 15 +++++++++++++++ main.js | 3 --- responses.js | 12 +++++++----- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 kokocina.js diff --git a/kokocina.js b/kokocina.js new file mode 100644 index 0000000..0887e31 --- /dev/null +++ b/kokocina.js @@ -0,0 +1,15 @@ +h(1) +h(2) +h(3) +h(0) + +function h(n) { + console.log(7*(5**n)+9+g(n)) +} + +function g(n) { + if (n == 0) { + return 0 + } + return 9*7*(5**(n-1))+g(n-1) +} \ No newline at end of file diff --git a/main.js b/main.js index 8aff214..07969b6 100755 --- a/main.js +++ b/main.js @@ -98,13 +98,10 @@ function gotMessage(message) { debugger_.debug(message); } -/** - * kokot v piči const chance = help.RNG(50000); if (chance == 420) { resp.whoAsked(message); } -*/ const msg = message.content.toLowerCase(); diff --git a/responses.js b/responses.js index 22c121b..722e33f 100644 --- a/responses.js +++ b/responses.js @@ -19,9 +19,11 @@ function mood(message) { } async function whoAsked(message) { - const searchKey = 'who-asked'; - const gifAmount = 20; - const gifs = `https://g.tenor.com/v1/search?q=${searchKey}&key=${process.env.TENOR}&limit=${gifAmount}`; - - message.reply({ embeds: [await help.getGifEmbed(gifs, gifAmount)] }); + if (message.embeds.length == 0 && message.attachments.size == 0 && message.content != '') { + const searchKey = 'who-asked'; + const gifAmount = 20; + const gifs = `https://g.tenor.com/v1/search?q=${searchKey}&key=${process.env.TENOR}&limit=${gifAmount}`; + + message.reply({ embeds: [await help.getGifEmbed(gifs, gifAmount)] }); + } } \ No newline at end of file