From 80a0e85af3055e83023e72f474b80b3e27d1d529 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Sat, 12 Oct 2024 00:40:04 +0200 Subject: [PATCH] guh --- src/commands/fun/gelbooru.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index 2b56e1f..c11f960 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -147,7 +147,11 @@ module.exports = { const searchTags = [rating, ...tags, ...[...blacklist, ...userBlacklist].map(i => "-" + i)]; const startTime = process.hrtime.bigint(); - var post = (await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }))[0]; + 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 }); + if (post == null) { await interaction.followUp(emojis.warning + " Could not find any post matching tags."); return;