#Error when creating embed

1 messages · Page 1 of 1 (latest)

winged kelp

I'm getting the following error when trying to create an embed. My main goal is to let the user enter the name, select an image and unix time to create an embed.

[29.07.2023 16:56.55.955] [ERROR] Error details: CombinedError (3)
  Received one or more errors

  1 ExpectedValidationError > s.literal(V)
  |   Expected values to be equals
  |
  |   Expected:
  |   | null
  |
  |   Received:
  |   | '#e76604'

  2 ValidationError > s.number
  |   Expected a number primitive
  |
  |   Received:
  |   | '#e76604'

  3 ValidationError > s.tuple(T)
  |   Expected an array
  |
  |   Received:
  |   | '#e76604'

    at UnionValidator.handle (file:///C:/Users/Leon/OneDrive/Desktop/DKK%20v14/node_modules/@sapphire/shapeshift/dist/index.mjs:1096:23)
    at UnionValidator.parse (file:///C:/Users/Leon/OneDrive/Desktop/DKK%20v14/node_modules/@sapphire/shapeshift/dist/index.mjs:204:88)
    at EmbedBuilder.setColor (file:///C:/Users/Leon/OneDrive/Desktop/DKK%20v14/node_modules/@discordjs/builders/dist/index.mjs:225:20)
    at createFiresaleEmbed (file:///C:/Users/Leon/OneDrive/Desktop/DKK%20v14/src/commands/firesale.js:20:14)
    at Client.<anonymous> (file:///C:/Users/Leon/OneDrive/Desktop/DKK%20v14/src/commands/firesale.js:96:27)
    at Client.emit (node:events:526:35)
    at InteractionCreateAction.handle (C:\Users\Leon\OneDrive\Desktop\DKK v14\node_modules\discord.js\src\client\actions\InteractionCreate.js:97:12)
    at module.exports [as INTERACTION_CREATE] (C:\Users\Leon\OneDrive\Desktop\DKK v14\node_modules\discord.js\src\client\websocket\handlers\INTERACTION_CREATE.js:4:36)
    at WebSocketManager.handlePacket (C:\Users\Leon\OneDrive\Desktop\DKK v14\node_modules\discord.js\src\client\websocket\WebSocketManager.js:354:31)
    at WebSocketManager.<anonymous> (C:\Users\Leon\OneDrive\Desktop\DKK v14\node_modules\discord.js\src\client\websocket\WebSocketManager.js:238:12)```

My code looks as follows:
```            let name = options.getString('name')
            let image1 = options.getAttachment('bild1')
            let image2 = options.getAttachment('bild2')
            let image3 = options.getAttachment('bild3')
            let unix = options.getInteger('unix')

            const embed = createFiresaleEmbed(event.title, name, unix, image1.url, event.color);

            interaction.reply({
                content: 'Test',
                embeds: [embed],
                ephemeral: true
            });```

```function createFiresaleEmbed(title, name, unix, image, color) {
    try {
        return new EmbedBuilder()
            .setTitle(title)
            .setColor(color)
            .setDescription(Dieses Mal einen **${name}**!\n\nDer Fire Sale startet <t:${unix}:R>\n\n) //Took out Gravis to not f up discord formatting
            .setImage(image)
            .setFooter({ text: config.global.footer });
    } catch (error) {
        console.error(Error creating embed: ${error.message}); //Took out Gravis to not f up discord formatting
        console.error("Error details:", error);
        return null;
    }
}```

I logged all the variables title, name, unix, image and color: the values seem to be ok
```        console.log(title);
        console.log(name);
        console.log(unix);
        console.log(image);
        console.log(color);```

[29.07.2023 16:59.54.946] [LOG]   🔥 Neuer Fire Sale!
[29.07.2023 16:59.54.947] [LOG]   testa
[29.07.2023 16:59.54.947] [LOG]   1690649796
[29.07.2023 16:59.54.948] [LOG]   <https://cdn.discordapp.com/ephemeral-attachments/1066036486497112075/1134862857813622804/7ify6m.jpg>
[29.07.2023 16:59.54.948] [LOG]   #e76604