65 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!you dont have such a folder
make sure your pathing is correct
fixed it
how about this
tryna made a slash command
but all my files don't have application id
you provided undefined where an application and/or guild id is needed
I have guild ID
but it somehow doesn't work
you also need the client id
have it
then pass it in
I did
show how
put in config.json and .env
why do you have both
you pick one
not both
the guide told me to use config.json but I had .env
so i created both eventually
then use .env
the guide shows example on both
it does not mean use both
does it work if i do this
..no
the guide shows how to work with dotenv
it doesn't when it comes to registration
quite literqlly does https://discordjs.guide/creating-your-bot/#using-environment-variables
yea i know
im not on that page
then edit that to use dotenv
its a guide
its meant to guide you, not 'copy paste and go'
the issue is my friend help me coded the bot a bit and he stopped helping me and idk what should i do now
start from the first or
continue
since the fundaments are here
do you know js
know the basics
then it shouldnt be too hard to edit that to use dotenv
you know the usage
so just edit it
I edited it but hm
code and error do not match
./dotenv is indeed not a module
dotenv is
what should I do
nvm
find where you used ./dotenv
because its not a local file
I have a slash command coded but
then look at how you load your commands
worked for a sec and new error
one or more of your commands do not have a name
don't believe so
(i have one slash command only for now for testing)
i am more inclined to believe the api over you
log before you deploy
i did tho..
then show it
i highly doubt that is your command
wdym
thats the error
log your command
mb
is your code saved
show the full code if so
ya
index or
everything
or the ping
where you deploy your commands
most likely your deploy-commands file
okay
Pastebin
deploy-commands - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
why are you hardcoding your commands
to then push other commands into it
the deploy script is meant to be dynamic
it is dynamic tho
i didn't hardcode them
yeah sure its dynamic for most part
it's an arrray
...which you hardcoded your ping command into
i can add more as i add more slash commands
well
what should I do then
you quite literally have code that loads your commands
do you even know what your code does
kinda
i get the idea
then you should know that line 11-23 load your commands
and that you shouldnt hardcode
but it could be anything there, if added let's say user slash cmd, i add it to the array
itd still work
won't it
or im wrong
no because youre putting your entire command in there
not the builder itself
which is what lines 11-23 do
so what should i define commands as
empty array?
but it won't work
then you have to take a look at how you are loading your commands
your folder structure thus
based on your imports, your commands are in the src folder
which your code never checks