Discord.js 销售命令不起作用,在某行后停止运行

问题描述

我正在尝试制作一个具有经济性的不和谐机器人,一切都很顺利,直到我收到了卖出命令。当我尝试出售时,机器人只是没有响应。它只在return message.channel.send

有人可以帮我吗?

代码

if (message.content === `${prefix}sell`) {
    let item = message.content.split(" ").slice(1).join(" ");
    if (!item) return message.channel.send("Please enter what you want to sell!");
    item = item.toLowerCase();

    if (animals.includes(item) === false) return message.channel.send("That is not a valid thing to sell!");

    let inventory = db.get(`Data_${message.author.id}.inv`);
    if (inventory.includes(item) === false) return message.channel.send("You don't have a " + item + "!");

    let price = prices[animals.indexOf(item)];

    let embed = new discord.MessageEmbed()
        .setTitle("Sold!")
        .setDescription("You sold 1 " + item + " and got " + price.toString() + " for it.")
        .setColor(embedColor);

    message.channel.send(embed);

    message.channel.send("Sold.");

    db.add(`Data_${message.author.id}.coins`,price);

    let newInventory = inventory.splice(inventory.indexOf(item),1);
    db.set(`Data_${message.author.id}.inv`,newInventory);
}

我尝试过的事情:

记录每一行以查看它在哪里停止,如果您不满足要求,它将发送错误消息,但如果您满足要求,机器人就不会响应。

代码行转换为注释以查看哪些不起作用(这对我没有帮助)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)