#TypeError Cannot read properties of undefined (reading options)
1 messages · Page 1 of 1 (latest)
const CommandDirectory = fs.readdirSync("./commands").filter(file => file.endsWith(".js"));
const commands = [];
client.commands = new Collection();
for (const file of CommandDirectory) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
client.commands.set(command.data.name, command);
}```
no, your interactionCreate event is what I meant
client.on("interactionCreate", async Interaction => {
if (!Interaction.isCommand()) return;
const command = client.commands.get(Interaction.commandName);
if (!command) return;
try {
await command.execute(Interaction);
} catch(err) {
if (err) console.error(`${ErrorLog}${err}`);
}
})```
can you remove the try catch for now so it logs the full error
i did that and now i get no logs
it just says The application did not respond
oh wait
i removed execute
that would be a way to remove the error too 
await interation.followUp(`${interation.data.options[0]}`);
^
TypeError: Cannot read properties of undefined (reading 'options')```
oh how did I miss that
i get that error when i remove the try and catch
what are you trying to print there
a specific option or just the first
the first
can you log interaction.options.data
i will try
await console.log(`${interation.data.options[0]}`);
^
TypeError: Cannot read properties of undefined (reading 'options')```
it works i think if i put the .data.options on just reply
but if i do followup it wont
console.log(interaction.options.data)
by putting it in a string you are not logging it properly
[ { name: 'input', type: 'STRING', value: 'djdj' } ]
interaction.options.data[0] it is then
thanks
do you want to print the value of the option?
cuz printing the option as a string will print object Object
then also call .value on it
i bumped it
no problem

