DEV Community

Discussion on: How to make a slash commands bot with Discord.js V13

Collapse
 
errolm profile image
ErrolM

I'm Having issues with the code in the for loop where it states commands.push(command.data.toJSON())

its states .toJSON() is not defined

Collapse
 
soulsoccer73 profile image
Soulsoccer

i tried these few changes and it worked out for me, ive commented the corrections along

Client.command=new Collection(); //command instead of commands

Client.command.set(command.data.name, command);
commands.push(command.data.toJSON());