Unexpected string in JSON
I'm trying to create discord bot that can show an output by slash command but the code couldn't run. App used: Replit. Here's the code:
index.js
15 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.deploy-commands.js
You say that it "couldn't run" but that's not very specific
What's happening in your terminal?
hold on
config.json
Error message
So the error comes 100% from your config.json not being in valid JSON format
From the redacted version you sent here, you're missing a comma after the first key-value pair
Fixed
brb
There's no error message rn, but the run button turn back to run once I clicked it (app used: replit)
Are you ever calling
client.login(token)
? It's not in the code that you sentwait, lemme check
Should it be placed in index.js?
Yes, that's what the guide says
It could run properly now, hold on I want to create a slash command
hi.js
this error has been fixed
You should know basic javascript before developing a bot, especially how to diagnose ones that tell you the exact problem
I've added
Ok
There's no error for now, but I can't access the slash command
this?
I've created that deploy-commands.js, or there's some missing code?
If I press Run, all of the code should be run at the same time. App used: Replit
So I need to click the run button while in the deploy-commands.js?
I've run the deploy file, it works but inside the console tab it says "No command matching hi was found."