View Guild Onboarding

I'm trying to see my Guild Onboarding questions and add answers to them but I'm just getting undefined for each property. This is my code
data: new SlashCommandBuilder()
.setName('onboarding')
.setDescription('Change onboarding settings'),
async execute(interaction) {
const guild = interaction.guild;
await interaction.reply('Fetching onboarding settings...');

await guild.fetchOnboarding().then(async onboarding => {
let promptDescription = '';
const prompts = onboarding.prompts;

devLogger.info(prompts);

for (const prompt of prompts) {
promptDescription += `${prompt}\n`;
devLogger.info(prompt);

promptDescription += '\n';
promptDescription += '**Title:** ';
promptDescription += prompt.title;
promptDescription += '\n';
promptDescription += '**Type:** ';
promptDescription += prompt.type;
promptDescription += '\n';
promptDescription += '**Options:** ';
promptDescription += prompt.options;
promptDescription += '\n';
}

const embed = new EmbedBuilder()
.setTitle('Onboarding Settings')
.setDescription(`**Prompts:** ${promptDescription}`)
.setColor('#00ff00');

await interaction.editReply({ embeds: [embed] });
});
},
};
data: new SlashCommandBuilder()
.setName('onboarding')
.setDescription('Change onboarding settings'),
async execute(interaction) {
const guild = interaction.guild;
await interaction.reply('Fetching onboarding settings...');

await guild.fetchOnboarding().then(async onboarding => {
let promptDescription = '';
const prompts = onboarding.prompts;

devLogger.info(prompts);

for (const prompt of prompts) {
promptDescription += `${prompt}\n`;
devLogger.info(prompt);

promptDescription += '\n';
promptDescription += '**Title:** ';
promptDescription += prompt.title;
promptDescription += '\n';
promptDescription += '**Type:** ';
promptDescription += prompt.type;
promptDescription += '\n';
promptDescription += '**Options:** ';
promptDescription += prompt.options;
promptDescription += '\n';
}

const embed = new EmbedBuilder()
.setTitle('Onboarding Settings')
.setDescription(`**Prompts:** ${promptDescription}`)
.setColor('#00ff00');

await interaction.editReply({ embeds: [embed] });
});
},
};
The image is what the bot sends me
No description
5 Replies
d.js toolkit
d.js toolkit13mo 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!
monbrey
monbrey13mo ago
You're iterating over the collection incorrectly
d.js docs
d.js docs13mo ago
Converting a Collection to an array You only need to convert it to an array if you need the index of an entry: - Iteration (looping) is possible with for...of over Collection#values or forEach - You can transform a Collection to an array with Collection#map - If you need indices, you can get the array using [...collection.values()]
monbrey
monbrey13mo ago
prompts.values() is what you need
sproj003 ♿
sproj003 ♿OP13mo ago
Thanks How do I add prompts?
Want results from more Discord servers?
Add your server