From 1220d939cb201e780c37323fac5cbcc50fa0b139 Mon Sep 17 00:00:00 2001 From: grumbulon Date: Tue, 5 Apr 2022 00:18:49 -0400 Subject: [PATCH] Added random choice of waifu, and removed one booru because non-safe images were being pulled --- config.json | 5 +++-- src/helpers/API.js | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 6e33a71..9820495 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { - "booru": ["danbooru", "safebooru", "konan"], - "tags": ["onodera_kosaki", "-underwear"], + "booru": ["danbooru", "safebooru"], + "characterTags": ["onodera_kosaki", "tohsaka_rin", "izumi_konata"], + "tags": ["-underwear"], "rating": "safe" } diff --git a/src/helpers/API.js b/src/helpers/API.js index 5360bef..928781f 100644 --- a/src/helpers/API.js +++ b/src/helpers/API.js @@ -10,10 +10,17 @@ export function getFromBooru() { console.log(err); return; } + + //append safe rating to the tags if so desired if (config.rating === "safe") { config.tags.push("rating:safe"); } + //Select a random index from the array and append the waifu to the tags + const randWaifu = Math.floor(Math.random() * config.characterTags.length); + config.tags.push(config.characterTags[randWaifu]); + + //Select a random index from the array to pick which booru is being queried const randBooru = Math.floor(Math.random() * config.booru.length); search(config.booru[randBooru], config.tags, { limit: 1,