Bot will not .editReply() it's message.
Greetings,
I am running discord.js v14.14.1 and npm v 9.8.1. I have two bots with the exact same code, however one is for the main server in which it's deployed and the second bot is on my test server so I can test out new features to add. My test bot is able to edit the message just fine while the actual bot refuses to edit the messages from the deferedReply and crashes after 15 minutes. I see no signs of Rate Limiting by discord so I'm shocked. Attached is proof that the embed data is coming through the console side.
Code:
//Just grabbed the code where deferReply is called
It just gets stuck on the bot is thinking message. Any help would be appreciated. The code works on the test bot but not the actual bot.
Note: it doesn't error until after 15 minutes in which it says
Invalid Webhook Token
.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!
- ✅
Marked as resolved by OPI will add that the bot has admin perms on both servers.
Does one of your bots not have the intents enabled? Or message intents through the discord developer portal?
Both bots have intents enabled, shockingly enough this just happened overnight. Originally I made an interaction.reply then .editReply() and it was working for 2 weeks then all of the sudden poof.
Hmm, weird. I don't see in your code where it says .editReply though?
Am I just blind?
I changed it from .editReply to deferReply
Oh I see now
To see if that would fix it but sadly not.
Could you try going back to .editReply?
This code that I have currently works on the test bot I have and it's the exact same code I have deployed on the main bot but the main bot won't edit it.
Even in my test server the main bot won't edit it.
But the test bot works and it's the same exact code.
huh, weird... Are all the files the same? index.js, handlers, etc?
Yeah I'm stumped, this problem happened overnight
It was working fine before then it just broke on me
I've seen people get the Invaild Webhook Token error, let me see if I can see where they fixed it at.
It's because the deferred reply expires after 15 minutes
So the bot isn't following up with the reply so after 15 minutes the token expires
try using deferUpdate
are you attempting to use an interaction's token >15 minutes after the initial response?
Nope
weird, try asking in #djs-help-v14
It's more open and easier to get help
Oddly enough is says deferUpdate isn't a function?
hmm
Maybe because deferUpdate is only used for components? or no?
probably
deferReply returns a promise, resolve it
Resolved and still won't edit the message
show full code
It's like 650 lines, I can try to snip it where the interaction gets called
One second
and around which lines
Line 96 is where deferReply is
Line 678 is where the reply is sent
No console errors occur, and the code works on my test bot but not my main bot. (Same exact code)
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 it stops
It executes the full code, line 676 is the embed in which it gets printed to the console successfully
await the edit
and make sure your code is saved
Code is saved, this is output:
you arent silently ignoring errors somewhere i hope
Negative, the odd thing is this code literally works on my test bot
Just not the main bot
replace the embed with text and try then
Alrighty
Still same thing
I'll go back to using interaction.reply then editReply
And see if anything changes there
@wolvinny 🌈 Won't even edit if I use text
I just have the console.log(embed) still in to see if it will go through
did you await the initial reply
and the editreply
Yep
The odd thing is I literally didn't change any code and the bot stopped editing responses over night
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Sure thing, one moment.
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Sure sure
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Bot has admin
Also as a heads up @gwapes it can pull all the data successfully from everywhere else there isn't anywhere that the code is stopping
This code worked about 2 days ago and I haven't changed it in the slighest the bot just stopped editting over night
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Keep in mind some didn't deploy simply because they didn't have certain ribbons / badges in this case and what the bot is used for
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Is nothing supposed to pop up?
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I'm kinda at a loss of words the same exact code works on my test bot
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Test bot I boot up locally, main bot is stored on a 24/7 server and yes the code is saved
I can 100% try hosting the bot locally to confirm your theory
@gwapes Worked when hosted locally
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Why did the console.log for the ratelimit not show up?
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Djs is 14.14.1
npm is 9.8.1
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View