slash commands not showing up

i have a file register-commands.jswhere i register slash commands but it is not appearing in discord client

require('dotenv').config();
const { REST,Routes} = require("discord.js")


const commands = [
    {
        name:'ping',
        description:'pong',
    }
]

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

(async () => {
    try {
        console.log('registering slash commands')
        await rest.put(
            Routes.applicationGuildCommands(
                process.env.CLIENT_ID,
                process.env.GUILD_ID)
        ),
        {
            body: commands
        };
        console.log('registered slash commands');
    } catch (error) {
        console.log(`there was an error error: ${error}`);
        
    }

})();

output :

registering slash commands
registered slash commands
Was this page helpful?