正确使用booru软件包?

时间:2019-02-28 01:12:10

标签: javascript discord discord.js

因此,我试图在不和谐的服务器上运行一些布尔图像搜索代码。我已经从npm下载了booru软件包,并且正在使用以下代码:

const Discord = require("discord.js")
const booru = require('booru');
var query = args.slice(0).join(" ");

booru.search('safebooru', [query], {
        limit: 1,
        random: true
    })
    .then(booru.commonfy)
    .then(images => {
        for (let image of images) {
            const embed = new Discord.MessageEmbed()
                .setAuthor(`safebooru ${query}`)
                .setDescription(`[Image URL](${image.common.file_url})`)
                .setImage(image.common.file_url)
                .setColor('#E89F3E');
            return message.channel.send({
                embed
            });
        }
    }).catch(err => {
        if (err.name === 'booruError') {
            return message.channel.send(`No results found for **${query}**!`);
        } else {
            return message.channel.send(`No results found for **${query}**!`);
        }
    })

但是,当我使用!booru happy时,它将只返回No results found for happy!。好像它甚至都没有搜索过该词。我是否正确使用booru?

0 个答案:

没有答案