This commit is contained in:
Ashley Graves 2024-10-12 00:40:40 +02:00
parent 80a0e85af3
commit 5f95753de9

View file

@ -148,10 +148,11 @@ module.exports = {
const startTime = process.hrtime.bigint(); const startTime = process.hrtime.bigint();
var tries = 0; var tries = 0;
var post; var posts;
while (post.length == 0 && (tries++) < 5) while (posts.length == 0 && (tries++) < 5)
post = await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }); 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) { if (post == null) {
await interaction.followUp(emojis.warning + " Could not find any post matching tags."); await interaction.followUp(emojis.warning + " Could not find any post matching tags.");
return; return;