Error while trying to make command register

Hello,
I'm trying to make register-command.js file to store my slash commands in but it returns a error. I'll say right away that I'm totally new to programming so I'm copying code from YT tutorial while trying to understand it. This is the code for register-commands.js
 ***JS file***
require("dotenv").config();
const {REST, Routes} =require("discord.js");

const commands = [
    {
        name: "Hey",
        description: "Replies with hey",
    },
];

const rest = new REST({version: "10"}).setToken(process.env.TOKEN);

(async ()=> {
    try{
        console.log("Registrování lomítkových příkazů...");

        await rest.put(
            Routes.applicationGuildCommands(
                process.env.CLIENT_ID,
                process.env.GUILD_ID
                ),
            { body: commands }
        );

        console.log("Lomítkové příkazy zaregistrovány")
    }catch(error){
        console.log(`!!!Je tady error: ${error}`);
    }
})();

and this is the error I cannot get rid of (I had checked many times but hadn't found any mistake and I couldn't find any help either)
 ***Console output***
PS H:\programovani\boti\snad_VaVic_bot> node src/register-commands.js
Registrování lomítkových příkazů...
!!!Je tady error: DiscordAPIError[50035]: Invalid Form Body
name[APPLICATION_COMMAND_INVALID_NAME]: Command name is invalid
Was this page helpful?