Skip to content
Advertisement

I’m unable to push my bot’s slash commands to an array. Why?

When I try to push my bot’s slash commands to an array which I want to use to register my commands, it doesn’t seem to get pushed, as when I console.log the array, it returns an empty array. But when I log each command individually, it logs properly. Why?

Here is the code I use to push my bot’s commands to the array:

JavaScript

Advertisement

Answer

Replace this:

JavaScript

with this:

JavaScript

This solution was found purely by experimentation, I do not know how/why this worked. If someone does know how/why this worked, please leave a comment.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement