SlashCommandHandler - Not answering
So I've created the deploy-commands & slashcommandhandler from Discord.Js guide docs, my commands do appear when I use /ping, but it doesnt respond
199 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!show your code
deploy-commands
index.js
File structure :
I dont see you listening for the interactionCreate event anywhere
Nor calling the execute function
What do you mean exactly?
you never listen for the interactionCreate event
And your command exports an execute or run function probably which you never call
Uhmm
It's such a long time since I've been developing js
and using the handler
thats my ping.js that isnt working
I mean it should work
No
or am I completely wrong @wolvinny🌈
sry for tag
You never call the execute
You never listen for an interactionCreate event
You missed a few parts of the guide there
is that something new? o.o
Listening to events? No
isnt that for normal commands?
no
I'am so idiot
I really cant find what I missed out on
do you see an interactionCreate event anywhere in your code?
No, I think I found it now
that was the part I was missing right? @wolvinny🌈
yes, try it and see
Do I have to nodemon . or nodemon deploy-commands ?
whatever file you construct your client in
I did exactly like the guide showed
unless you want to just register commands, you should run index
so it just ran that code
yk it said "Ingen command som matchede ping blev fundet'"
then you didnt set your commands properly
Uhmm
How can I fix that?
by setti'g them properly
make sure your filepaths are correct
they're
No
You're scanning /commands for files ending in .js
but you only have subfolders in there
I get that error now when its out of the sub-folder
show your code
of the deploy?
or
the code that throws thay error
deploy-commands
If thats the file you're running your commands wont ever work
Nor will your bot login
Index.js
and which one is throwing the error
because in your deploy you're scanning correctly, in your index you arent
So how do I fix it?
it throws it in deploy
well, first of all, read what i said
yeah
.
I did run index
but whats the error in index?
Your error is from your deploy
yeah
Because you're not scanning the files inside your subfolders, which you are doing in your deploy
None of this is js related either, its rather basic js
I just thought of it
was about saying it
just weird the guide shows to different kind of it
the guide is just a guide, you're expected to edit it based on your setup
I might have fixed it
I have fixed it, thank you so much for your help @wolvinny🌈 I just got back to the new versions of Discord.JS it has been months were I've been long way from home.. sorry for the inconvience
no worries
status
May I know why tf it gives me an error?
you have 2 or more commands with the same name
ehh I definitly not have
if you havent you wouldnt get that error
bro the file structure
O.o
your commands probably are being scanned twice
How would I fix that
by fixing your scanning logic
It is the exact same like on the guide
can you tell me where in the scanning it fucks up?
well, the guide expects you to have subfolders, which you do not have
so no, its not the same
I removed it
the function
with subfolder
s
then your handler isnt the exact same as the guide isnt it?
show yours
well
your commandFolders variable will have 2 files.
For each of those files you scan your commandFIle directory again, adding them twice
in the deploy?
I fixed it
its after I removed the function for subfolders I forgot to remove something else
No errors, it just doesnt reply.
well, is the execute being called at all
yes
It is.
It just says "The bot didnt respond"
then your if statement is returning false
Oh fuck
im so stupid
its meant to be if the guy doesnt have
shit
fuck me
I dont get that error .. O.o
your channel is undefined
so its either not cached or the id is incorrect
I defined it just above O.o
well it has a value of undefined
Uhmm, how can it not be cached?
if you dont have the guilds intent
I guess I have it
then the id is incorrect
wait
why do you construct a new client there
the id is correct
that client wont be logged in
thats not how it works
what should I do instead
you should access the client from <Interaction>.client
creating a new instance wont ever work
so interaction.client
would work
yes
:p
show your code
in which file?
the one that errors
thats not the file that errors isnt it
Sorry
you didnt do what i said
.
now it says the application didnt answer
because you dont reply to the interaction
I dont need it to reply
well then you will get the 'application did not respond'
Im so stupid I got it now, haha
Can I some how make the interactions in other files, so it doesnt have everything in the command files and index?
yes
I got it now
nothing happens when I click in the select menu
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
thats the event handler
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
so it wont work by just adding an s?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
Would this work?
if not, how should it be done :p
it doesnt ^^
do you know how arrays work / what an array is?
I know what it is
well
I forgot how they work tho
might want to brush up your js knowledge
yeah, I just have to see the stuff again, and then I will know
yk, its just like "Ohhh now I remember ..."
hello?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
yes the array
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
i told you fresh up on your js knowledge as the code you provided isnt valid js
I dont know how to use the values
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
Yeah.. I just dont get it, and I cant find anything on google
so its hard
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
so both ticketSupport and ticketSpørgsmål will be in the values array?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
the ones the user selected will be in the array
wtf
you both say 2 different things
your <Interaction>.values will be populated with the values the user selected
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
I already looked through it
but cmon you cant say 2 different things.. thats confusing
so to get it right, I would need to use [1]
right ?
and that would be ticketSupport
you'd need to get [0] for the first element
that will only return 1 element though
Yeah and that would be ticketSupport right?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
it just says undefined ? o.o
it would be ticketSpørgsmål wouldn't it?
please read
and take the time to fully learn about arrays
Nevermind
im so stupid
holy shit
this is redicoulus
imagine this happned
shit
fuck me
???
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
I define the channeltype? O.o
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
what is the import?
just ChannelType?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
also, ManageChannels isnt a channel perm afaik, its a role perm
yes
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
Ok
??
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
oh
fuck
also, there's not really a need to define every channel in your .env. If you need it across multiple files sure but if you need it just once
the channel I have here (c)
can I somehow send an embed to the same channel but in another file?
But its for a ticket system
how can it know which id the channel is when it creates the channel in another file?
resolve the promise and store the .id somewhere
do I need to store it?
like with a database?
Well if you want to access it later on yes
how can I make a transcript over my ticket
store the messages in a db
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
how can it be an unknown channel?
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
ehmm no.
ohh
I think I got it now
now it says this
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
wait wdym
Unknown User•16mo ago
Message Not Public
Sign In & Join Server To View
also note that that limit is useless since you can fetch 100 messages max
btw
why doesnt the whole appear in my console when I do this?
I mean it should put the whole in the console like it does on the website
or am I wrong
and how can I use the response?
thats not djs related
well its on the docs
no?
Thats just making an api request
Thats not even slightly related
Yeah, the contents, not how your browser displays it.