This commit is contained in:
Ashley Graves 2024-10-12 00:41:07 +02:00
parent 5f95753de9
commit f30fc0e068

View file

@ -149,7 +149,7 @@ module.exports = {
var tries = 0; var tries = 0;
var posts; var posts;
while (posts.length == 0 && (tries++) < 5) while ((!posts || posts.length == 0) && (tries++) < 5)
posts = 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)]; const post = posts[Math.floor(Math.random() * posts.length)];