DiscordAPIError: Unknown Interaction

Viewed 236

I have been using an online guide to set up a currency bot but when I use the command to add items to the shop the terminal throws out this error and while the bot says the item has been added when I check the shop it has nothing in it. this is the exact error that i get I'm new to coding and a have little to no idea what it means any help or point towards a guide that might explain it would be greatly appreciated

DiscordAPIError: Unknown interaction
    at RequestHandler.execute (c:\Users\danie\Desktop\CurrencyBot\node_modules\discord.js\src\rest\RequestHandler.js:349:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (c:\Users\danie\Desktop\CurrencyBot\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
    at async CommandInteraction.reply (c:\Users\danie\Desktop\CurrencyBot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:99:5)
====================

Here is the code for the command

const Discord = require('discord.js')
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
exports.run = async (client, message, args) => {
    await message.deferReply();
    if (message.options.getInteger('price') < 1) return message.editReply("You can't add an item for less than 1$!");
    let result = await cs.addItem({
        guild: message.guild,
        inventory: {
            name: message.options.getString('name'),
            price: message.options.getInteger('price'),
            description: message.options.getString('description') || 'No Description'
        }
    });
    if (result.error) {
        if (result.type == 'No-Inventory-Name') return message.editReply('There was a error, Please enter item name to add.!')
        if (result.type == 'Invalid-Inventory-Price') return message.editReply('There was a error, invalid price!')
        if (result.type == 'No-Inventory-Price') return message.editReply('There was a error, You didnt specify price!')
        if (result.type == 'No-Inventory') return message.editReply('There was a error, No data recieved!')
    } else return message.editReply('Done! Successfully added `' + message.options.getString('name') + '` to the shop!')



}

exports.help = {
    name: "additem",
    data: {
        name: 'additem',
        description: "A way to additem to shop",
        options: [{
                name: 'name',
                type: 'STRING',
                description: 'Name of Item.',
                required: true,
            }, {
                name: 'price',
                type: 'INTEGER',
                description: 'Price of item',
                required: true,
            },

            {
                name: 'description',
                type: 'STRING',
                description: 'Description of the item. (Can\'t be Changed later.)',
                required: false,
            }
        ]
    }
};

exports.conf = {
    aliases: [],
    cooldown: 5 // This number is a seconds, not a milliseconds.
    // 1 = 1 seconds.
}
0 Answers
Related