list all commands in array
` `` async execute(interaction) {
const foldersPath = path.join(dirname);
fs.readdir(dirname, (err, files) => { if(err) console.error(err); let jsfiles = files.filter(f => f.split(".").pop() === "js"); if(jsfiles.length <= 0) { applog("No commands to load!"); return; } const filesArray = new Array(); jsfiles.forEach((f, i) => { const props = require(__dirname + '/' + f); applog(props.data.name + ' | usage: ' + props.usage) const filesArray = [props.data.name, props.data.description, props.usage] }); applog(filesArray) });
interaction.reply('nur bis her').then(msg => { setTimeout(() => msg.delete(), deleteInSlow) }); }, ``` I try to output all commands in an array but I can't get the array to display at that point. As soon as I reply with the bot inside the foreach, it always gives me the error message interaction not found. Thank you for your help
const foldersPath = path.join(dirname);
fs.readdir(dirname, (err, files) => { if(err) console.error(err); let jsfiles = files.filter(f => f.split(".").pop() === "js"); if(jsfiles.length <= 0) { applog("No commands to load!"); return; } const filesArray = new Array(); jsfiles.forEach((f, i) => { const props = require(__dirname + '/' + f); applog(props.data.name + ' | usage: ' + props.usage) const filesArray = [props.data.name, props.data.description, props.usage] }); applog(filesArray) });
interaction.reply('nur bis her').then(msg => { setTimeout(() => msg.delete(), deleteInSlow) }); }, ``` I try to output all commands in an array but I can't get the array to display at that point. As soon as I reply with the bot inside the foreach, it always gives me the error message interaction not found. Thank you for your help
7 Replies
- 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!The array is always from outside empty
With this I become as error
Tag suggestion for @h4ze:
Common causes of
DiscordAPIError[10062]: Unknown interaction
:
- Initial response took more than 3 seconds ➞ defer the response *.
- Wrong interaction object inside a collector.
- Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance)
* Note: you cannot defer modal or autocomplete value responses
Shows me this error .. without the editReply it shows only bot is thinking ..