I am trying to make a discord bot with an economy, everything was going well until I got to the sell command. When I try to sell, the bot just doesn't respond. It only responds on the lines where it will return message.channel.send
Can anyone help me?
Code:
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);
}
Things I have tried:
Logging each line to see where it stops, it will send an error message if you don't meet a requirement, but if you meet it the bot just doesn't respond.
Turning lines of code into comments to see what is not working (This didn't help me)