From eaa439f68c35dbcadabcb785b121ca711f1d8d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Wed, 26 Jun 2019 04:32:56 +0200 Subject: [PATCH] Should not show sticky post --- commands/fun/4chan.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/fun/4chan.js b/commands/fun/4chan.js index a3a2345..439ac7e 100644 --- a/commands/fun/4chan.js +++ b/commands/fun/4chan.js @@ -40,13 +40,17 @@ class FourchanCommand extends Command { let i = Math.floor((Math.random() * response.threads.length)); + while(response.threads[i].posts[0].sticky == 1) { + i = Math.floor((Math.random() * response.threads.length)); + } + let description = response.threads[i].posts[0].com; + description = decodeURI(description); let regex = /(<([^>]+)>)/ig; if (regex.test(description)) { description = response.threads[i].posts[0].com.replace(/(<([^>]+)>)/ig,''); } - description = decodeURI(description); const FourchanEmbed = new MessageEmbed() .setColor('#ff9900')