I cannot use my any command....
When I try use any command. it doesnt send message in channel but it send message from dm
my code: (it can be complicated but every if else typical same)
https://srcb.in/IqfX6bA25D
128 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.how did you manage to use a slash command on your own account
Idk sometimes it can send like that
I dont manage
I try use my bot slahs command
either you dont reply to the command or you took longer than 3s to respond
You send a DM, but don't reply to the interaction
No I use slash command in a server channel then bot dont send in channel but it send dm
because you do not reply to the interaction
Actually I want bot send two message a message to channel another message to dm
I do it
You have
client.users.send(interaction.user.id, ...)
, but not interaction.reply(...)
Responding to interactions:
•
#reply
immediately respond with a message
• #update
immediately update the original message (buttons, select menus)
• #showModal
immediately show a modal (cannot be deferred)
• #deferReply/Update
respond later (up to 15 minutes)
• #followUp
post an additional message
The initial response has to happen within 3s of receiving the interaction!if you did your bot wouldn't respond with interaction failed.
You have interaction.reply somewhere in your code yes but as i said in #djs-help-v14 , your chain of if else statements make it very hard to read your code
Btw to send a DM you can just do
interaction.user.send()
No no if u look line 183 i send interaction reply
yes, but you never reach that line apparently
If you aren't getting any errors, try to place
console.log
checkpoints throughout your code to find out where execution stops.
• Once you do, log relevant values and if-conditions
• More sophisticated debugging methods are breakpoints and runtime inspections: learn moreOh ok so can u look line 33
Oh sorry wait
yes, that is a reply. But you do not enter the if statement because your statement returns false
a part of this command
also i'm pretty sure its new Date()
I use dm and reply message in same if statement
But it send dm
I wanna say that
^
If you'll debug your code you'll see you never reach any
interaction.reply()
Ok so I wanna ask also one more thing
https://srcb.in/OlKcfCrSpz
This is my another code
But also it doesnt work
Even if i send "süre" bigger than 3 it doesnt send any message
please actually read what i say
Why do you use
StringOption
instead of IntegerOption
?Bro I read but I use that two days ago
Idk
It was work two days ago
I dont do anything I dont change anythinh
hm weird
If you aren't getting any errors, try to place
console.log
checkpoints throughout your code to find out where execution stops.
• Once you do, log relevant values and if-conditions
• More sophisticated debugging methods are breakpoints and runtime inspections: learn moredo that, and see where execution stops
Yea I try also try catch but it also send anything
you shouldnt try catch it, you should place console.log checkpoints
Log is clear as my grandmoms home
Ok I will try
hi again
It didnt log last message...
console.log user.lastwaat
I try change position console.log
And then I try tree times
2 of them it work but last time it didnt work
Why?
then the only thing i can guess is your internet connection
I use VDS
a what?
do you mean vpn?
Virtual Dedicated Server
And its my internet...
its the only thing i can think of
@syjalo bro what do u think ?
We didnt find a problem or solution
seems like you're pulling things from a database, maybe try deferring the reply first?
the "database" is just a file on their pc
Yep
Its just a json file
well idk read/write can take some time too no? it has callbacks and promises after all
read/write is prettty much instantly for me
you should defer anyway
this isn't a "hmm, could this take a few seconds" debate, just to be save always defer
Ok I will try
It thinks for about 5 minutes.
@thehairy
first of all, place the deferReply at the top
not in the middle of your code
also why do you have a wait there
get rid of it
Ok
is it ok ?
no
you need to use editReply instead of reply
Oh
please don't skip half the guide
Sorry my bad
its?
try it
It doesnt work...
did you save and restart?
Yes
I will try again
the command shouldnt show that error if defer at the beginning
I try again and first it will work but after it didnt work
show your interactionCreate event
yeah that code is cursed as heck
reminds me of a certain simulator
put the deferReply() at the beginning of the interactionCreate event and replace all .reply() with .editReply()
Ok I will do it now
It looks like fixed but
2 times of 6 usage it didnt work
Its normal or not?
Yea I realise that thanks everyone thanks for everyting
Ah @qjuh and @thehairy guys
I get same error...
#rules 6
Sorry bro
To help you we need more information:
• What are you trying to do?
• What is your code?
• What errors and debug logs do you have?
the problem continues
Sometimes code is done but sometimes it didnt work
.
I did it already but it didnt work
I will add "interaction.deferReply();" top of the interactionCreate file right?
I did it but it didnt work even...
Ok I will send my all code
Thats my interactionCreate file
https://srcb.in/yWNz8Nud4v
One of the code not working (No code is working.)
https://sourceb.in/g4NK63xK4N
also log and channel screenshots
yea I realise I did it... Now I fix it and get this error
Tag suggestion for @mockir:
Common causes of
DiscordAPIError[10062]: Unknown interaction
:
• Initial response took more than 3 seconds ➞ defer the response *.
• Wrong interaction object inside a collector.
* Note: you cannot defer modal or autocomplete value responsesHow can i fix it
await your deferReply() and use .editReply() afterwards instead of .reply()
like I told you before
did you save your code
Yes... I save
I'm talking about your interactionCreate event
remove the deferReply from the command
Oh
Okey
and why are you using the users function twice
thats hella unefficient
not to mention that running through all command files is as well
I suggest you just scrap the code you have and follow the command handling guide
So I must add my interactionCreate part "interaction.deferReply();" and then I use editReply all command right?
yes
okey I will try it
the interaction you pass in your interactionCreate is invalid / expired
it expires before you defer it
I did it
But still I get error
i never told you to defer your reply in your interactionCreate? You'll get errors this way with modal interactions. What i'm saying is something in your interactionCreate is taking a long time
I did what chewie said
oh
i didnt see the return statement, mb
but show the full error
show your code around interactioncreate line 24
.
Here
even at that .deferReply, your interaction already is expired, or an Unknown Interaction at least, so i have no clue what it could be other than your connection
Maybe mods know anotherelse
no
How I can fix it....
Anybody dont know?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I write my server company
I will talk about it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
and an actual database instead of a file on your computer
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so is their
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thanks for everything guys
I try something
Like
But now sometimes I get weird response
Like that
Thats work 4 min later send response
Thanks for everything guys
Like that
Thats work 4 min later send response
Thats work 4 min later send response