From 5f95753de9785e6070615d1509221ba5c29379fd Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 12 Oct 2024 00:40:40 +0200 Subject: [PATCH] be --- src/commands/fun/gelbooru.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index c11f960..8ffe0b6 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -148,10 +148,11 @@ module.exports = { const startTime = process.hrtime.bigint(); var tries = 0; - var post; - while (post.length == 0 && (tries++) < 5) - post = await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }); + var posts; + while (posts.length == 0 && (tries++) < 5) + posts = await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }); + const post = posts[Math.floor(Math.random() * posts.length)]; if (post == null) { await interaction.followUp(emojis.warning + " Could not find any post matching tags."); return;