Closed EmerickGrimm closed 3 years ago
Same code, but
const site = 'safebooru'
Output:
Post {
data: {
directory: '2636',
hash: 'f7634abafa5afe90567686d60dfde60d',
height: 766,
id: 2745768,
image: 'e6317bb8ee0ef2b0f00344c8438036e2a09964d8.png',
change: 1547663471,
owner: 'gelbooru',
parent_id: 0,
rating: 'safe',
sample: false,
sample_height: 0,
sample_width: 0,
score: null,
tags: '1girl ahri animal_ears blonde_hair breasts choker cleavage fox_ears jewelry k/da_(league_of_legends) k/da_ahri league_of_legends long_hair makeup sasucchi95 solo thigh-highs whisker_markings yellow_eyes',
width: 900
},
booru: Booru {
domain: 'safebooru.org',
site: Site {
domain: 'safebooru.org',
type: 'json',
aliases: [Array],
nsfw: false,
api: [Object],
paginate: 'pid',
random: false,
tagQuery: 'tags',
insecure: false,
defaultTags: []
},
credentials: null
},
fileUrl: 'https://safebooru.org/images/2636/e6317bb8ee0ef2b0f00344c8438036e2a09964d8.png',
height: 766,
width: 900,
sampleUrl: null,
sampleHeight: NaN,
sampleWidth: NaN,
previewUrl: null,
previewHeight: NaN,
previewWidth: NaN,
id: '2745768',
tags: [
'1girl',
'ahri',
'animal_ears',
'blonde_hair',
'breasts',
'choker',
'cleavage',
'fox_ears',
'jewelry',
'k/da_(league_of_legends)',
'k/da_ahri',
'league_of_legends',
'long_hair',
'makeup',
'sasucchi95',
'solo',
'thigh-highs',
'whisker_markings',
'yellow_eyes'
],
score: NaN,
source: undefined,
rating: 's',
createdAt: Invalid Date
}
[ 'ahri' ]
That's odd, I can't replicate that issue with this code:
const Booru = require('booru')
const site = 'rule34.xxx'
const tags = ['ahri']
;(async () => {
const posts = await Booru.search(site, tags, { limit: 1, random: true })
console.log('posts', posts[0])
console.log('tags', tags)
})()
Nor if I try it with my own bot
Although looking at this line:
if (message.channel.nsfw == true) // if command called in nsfw channel than execute code {
That last {
seems commented out, so that might be the issue (if you're testing the commands in a channel not marked nsfw)
Tried your code (link to youtube vid me trying to run your code), same issue.
Code:
Output:
undefined (empty posts[0] ?) [ 'ahri' ] (tag)
And same issue for all sites, but safebooru.