Hello there. I am having a problem and i do not know what should i do. After creating new command file(with command) the bot crashes on startup because of the error below.
throw result.error;
^
ZodError: [
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [],
"message": "Required"
}
]
at new ZodError (D:\Akaribot\node_modules\zod\lib\ZodError.js:80:28)
at handleResult (D:\Akaribot\node_modules\zod\lib\types.js:115:21)
at ZodString.ZodType.safeParse (D:\Akaribot\node_modules\zod\lib\types.js:191:16)
at ZodString.ZodType.parse (D:\Akaribot\node_modules\zod\lib\types.js:172:27)
at D (D:\Akaribot\node_modules\@discordjs\builders\dist\index.js:3:1447)
at h (D:\Akaribot\node_modules\@discordjs\builders\dist\index.js:3:1294)
at MixedClass.runRequiredValidations (D:\Akaribot\node_modules\@discordjs\builders\dist\index.js:3:2544)
at MixedClass.toJSON (D:\Akaribot\node_modules\@discordjs\builders\dist\index.js:3:6734)
at D:\Akaribot\node_modules\@discordjs\builders\dist\index.js:3:8832
at Array.map (<anonymous>) {
issues: [
{
code: 'invalid_type',
expected: 'string',
received: 'undefined',
path: [],
message: 'Required'
}
],
format: [Function (anonymous)],
addIssue: [Function (anonymous)],
addIssues: [Function (anonymous)],
flatten: [Function (anonymous)]
}
Node.js v17.4.0
Here is my current code of the command:
const { SlashCommandBuilder } = require('@discordjs/builders');
const { Message, MessageAttachment, MessageEmbed, MessageActionRow, MessageButton, client, Intents, Collection } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('profil')
.setDescription('Podaje informacje o profilu danego gracza Skyblock.')
.addStringOption(option =>
option.setName("nickname").setRequired(true)
),
async execute(interaction) {
const nickname = interaction.options.getString("nickname")
interaction.reply({ embeds: [
new MessageEmbed()
.setTitle(`Profil gracza ${nickname}`)
.setThumbnail(`https://mc-heads.net/avatar/${nickname}/500`)
.setDescription(`e`)
], components: [] });
}}