0

SOLVED By Konrad Linkowski: I used [reason] to get the result I wanted.

I am curently developing a SCP bot for discord, and I have a .json file that have some SCPs for the bot. I am using a command to ask for the scp's number or ID. (EG. 002) Here is what I have now:

module.exports = {
    data: new SlashCommandBuilder()
        .setName('scp')
        .setDescription('Lookup an SCP.')
        .addStringOption(option =>
            option
                .setName('number')
                .setDescription('Must be a 3 letter number.')),
    async execute(interaction) {
        const reason = interaction.options.getString('number'); // This value: 002
        
        const exampleEmbed = new EmbedBuilder()
            .setColor(0x0099FF)
            .setTitle(scplist.reason.Name + " " + scplist.reason.AKA) // Where it states "reason" I want the value from above to be in that position.
            .setURL(scplist.reason.Link)
            .setDescription(scplist.reason.Description)
            .setImage(scplist.reason.Image)
        await interaction.reply({ embeds: [exampleEmbed] });
    },
};

Here is the structure of my database/json: JSON file in JSON viewer

I tried replacing the above "reason" variables with just the variable above. I am pretty stumped as I'm new to discord.js and javascript and I'm unsure where to go for help.

0 Answers0