#Error

1 messages · Page 1 of 1 (latest)

civic garden
#

Hey, I have some code that is giving me a lot of errors

#
const config = require('C:/Users/(removed for saftey)/Bot1/config.json')
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle} = require('discord.js');
module.exports = {
    data: new SlashCommandBuilder()
        .setName("bugreport")
        .setDescription("Report a bug from ADC Report Handler")
        .addStringOption(option => option.setName('bug').setDescription('Describe the bug, be as descriptive as possible').setRequired(true))
        .addStringOption(option => option.setName('event').setDescription('Describe how to replicate the bug, be as descriptive as possible').setRequired(true))
        .addChannelOption(option => option.setName('channel').setDescription('What channel was the bug in?').setRequired(true))
        .addIntegerOption(option => option.setName('reportid').setDescription('If possible please provide the report ID').setRequired(false)),
    async execute(interaction, client) {
        client.users.fetch("348952467293339649").then(owner => {
            owner.send({content: "Bug Reported", embeds: [new EmbedBuilder()
                .setTitle("Bug Found by " + interaction.user.tag + " (<@" + interaction.user.id + ">)")
                .addFields(
                    {name: "Bug description", value: interaction.options.getString("bug")},
                    {name: "How to Replicate", value: interaction.options.getString("event")},
                    {name: "Channel", value: interaction.options.getChannel("channel").name + "(<#" + interaction.options.getChannel("channel").id + ">)"},
                    {name: "Report ID", value: interaction.options.getInteger("reportid")},
                    )
                ]}
            )
        })
    }
}```
#
C:\Users\(removed for saftey)\Bot1\node_modules\@sapphire\shapeshift\dist\index.js:420
    return errors.length === 0 ? Result.ok(transformed) : Result.err(new CombinedPropertyError(errors));
                                                                     ^

CombinedPropertyError: Received one or more errors
    at ArrayValidator.handle (C:\Users\(removed for saftey)\Bot1\node_modules\@sapphire\shapeshift\dist\index.js![420](https://cdn.discordapp.com/emojis/587330463761170445.webp?size=128 "420")70)
    at ArrayValidator.parse (C:\Users\(removed for saftey)\Bot1\node_modules\@sapphire\shapeshift\dist\index.js:106:88)
    at EmbedBuilder.addFields (C:\Users\(removed for saftey)\Bot1\node_modules\@discordjs\builders\dist\index.js:198:31)
    at C:\Users\(removed for saftey)\Bot1\commands\bugReport.js:15:18
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errors: [
    [
      3,
      CombinedPropertyError: Received one or more errors
          at ObjectValidator.handleStrategy (C:\Users\(removed for saftey)\Bot1\node_modules\@sapphire\shapeshift\dist\index.js:1068:47)
          at ObjectValidator.run (C:\Users\(removed for saftey)\Bot1\node_modules\@sapphire\shapeshift\dist\index.js:92:23)
          at ArrayValidator.handle (C:\Users\(removed for saftey)\Bot1\node_modules\@sapphire\shapeshift\dist\index.js:414:37)
          at ArrayValidator.parse (C:\Users\(removed for saftey)\Bot1\node_modules\@sapphire\shapeshift\dist\index.js:106:88)
          at EmbedBuilder.addFields (C:\Users\(removed for saftey)\Bot1\node_modules\@discordjs\builders\dist\index.js:198:31)
          at C:\Users\(removed for saftey)\Bot1\commands\bugReport.js:15:18
          at processTicksAndRejections (node:internal/process/task_queues:96:5) {
        errors: [ [ 'value', [ValidationError] ] ]
      }
    ]
  ]
}```
silent bone
#

your 4th field value is empty, or non string

civic garden
#

So if I replaced tne value: interaction.options.getInteger("reportid") with value: (interaction.options.getInteger("reportid") ?interaction.options.getInteger("reportid").toString() : "None Provided") would that fix it?

silent bone
#

have u tried it

civic garden
#

I have not, I was wondering if that should fix it?

silent bone
#

then try it. We are not your compiler