Event listener breaking upon using command
Hello, my bot cannot complete a command properly and as far as I can tell in the node console is that something is breaking in the event/command listener.
I tried modifying the commands.get part, but my attempts at that only gave me the second error. I don't know why .get isn't a function as I am just following the example template bot's RegisterEvent file.
13 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!Listener:
Command:
Where and how are you calling that function?
In the main.js
Here is the loaders as well if it is stemming all the way back to that
This is the result on Discord when attempting to use the command:
items is an array in the load function, so commands is also an array, and <Array>.get indeed does not exist
Seems like you're using the create-discord-bot template but it's modified, in that template, loadCommands returns a Map, not an array
And <Map>.get does exist
I didn't intentionally do that, what is causing mine to not return a map and the create-discord-bot to return one? They appear to be doing the same thing to me.
Look at your code and then this code
https://github.com/discordjs/discord.js/blob/main/packages/create-discord-bot/template/JavaScript/src/util/loaders.js#L72
Oh, that functions return is different, I missed that, thank you
Of course