unknown interactions

i keep gettings this error when i use /itemsdat command
2 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
igzh
igzhOP7mo ago
here is the code
// commands/itemsdat.js

const { SlashCommandBuilder } = require('@discordjs/builders');
const { AttachmentBuilder } = require('discord.js'); // Use AttachmentBuilder
const path = require('path');

module.exports = {
data: new SlashCommandBuilder()
.setName('itemsdat')
.setDescription('Sends the items data file.'),
async execute(interaction) {
try {
const file = path.join(__dirname, '../file/itemdat/items.dat'); // Adjusted path
const attachment = new AttachmentBuilder(file); // Use AttachmentBuilder
await interaction.reply({ files: [attachment] });
} catch (error) {
console.error(error);
await interaction.reply('Failed to send the items data file.');
}
},
};
// commands/itemsdat.js

const { SlashCommandBuilder } = require('@discordjs/builders');
const { AttachmentBuilder } = require('discord.js'); // Use AttachmentBuilder
const path = require('path');

module.exports = {
data: new SlashCommandBuilder()
.setName('itemsdat')
.setDescription('Sends the items data file.'),
async execute(interaction) {
try {
const file = path.join(__dirname, '../file/itemdat/items.dat'); // Adjusted path
const attachment = new AttachmentBuilder(file); // Use AttachmentBuilder
await interaction.reply({ files: [attachment] });
} catch (error) {
console.error(error);
await interaction.reply('Failed to send the items data file.');
}
},
};
Want results from more Discord servers?
Add your server