Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra tag/Number of tags #36

Closed
26841 opened this issue Nov 14, 2019 · 3 comments
Closed

Extra tag/Number of tags #36

26841 opened this issue Nov 14, 2019 · 3 comments
Labels

Comments

@26841
Copy link

26841 commented Nov 14, 2019

I'm working on a discord bot using discord.js and node.js.
One of my command code can be seen here: https://pastebin.com/bptJySts

What the command is supposed to do is generate two danbooru images based on the tags provided in 'args', which is an array. However, when I attempt to use the Booru.search, args seems to gain an extra order:random value, which interferes with the search since it adds an extra unneeded value. Is there something wrong with how I'm using the command?

@AtoraSuunva
Copy link
Owner

That's because the package is using order:random (on boorus that support it) to get random results, you can disable it (but then you don't get random results anymore)

const posts = await Booru,search(site, tags, { random: false })

You'll have to do the "random" sorting yourself, the package does it by just fetching 100 images and shuffling them randomly

@26841
Copy link
Author

26841 commented Nov 15, 2019

So how should I go about using the command?

A bit more specifically, I want to use the command to get two random danbooru art based on the tags, and also have it so that it only gets ones that are rated 'safe'.

@AtoraSuunva
Copy link
Owner

Because danbooru is very strict about the number of tags you can use, you could only pass in the (2) search tags the user gives, and then from the 100 results you get, filter out all the nsfw ones and randomly pick 2.

You would only then be able to get results from the 100 latest images, but you could at least search with 2 tags at a time. The only other options are to either limit it to 1 tag from the user, pay for a danbooru api key, or use another booru.

@26841 26841 closed this as completed Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants