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:
if (targetUser) {
interaction.deferReply(); // Deferring the reply here
let userNickname = targetUser.nickname;
embedUserNickname = userNickname.replace(/\[[^\]]*\]\s*/, "");
userNickname = userNickname.replace(/\[[^\]]*\]\s*/, "").trim().toLowerCase();
const lowercaseUserNickname = userNickname.toLowerCase();
if (targetUser) {
interaction.deferReply(); // Deferring the reply here
let userNickname = targetUser.nickname;
embedUserNickname = userNickname.replace(/\[[^\]]*\]\s*/, "");
userNickname = userNickname.replace(/\[[^\]]*\]\s*/, "").trim().toLowerCase();
const lowercaseUserNickname = userNickname.toLowerCase();
//Just grabbed the code where deferReply is called
const embed = new EmbedBuilder()
.setColor("White")
.setTitle(`**${embedUserNickname}**`)
.setThumbnail(img)
.addFields(
{ name: "**Rank:**", value: role_name },
{ name: "**Awards:**", value: awardsList},
{ name: "**Tabs:**", value: tabsList},
{ name: "**Ribbons:**", value: ribbonList}
)
.setFooter({
text: `${interaction.client.user.tag} is managed by Zer0_Access`,
iconURL: `${interaction.client.user.avatarURL()}`,
});
console.log(embed);

interaction.followUp({ embeds: [embed] , ephemeral: false});
const embed = new EmbedBuilder()
.setColor("White")
.setTitle(`**${embedUserNickname}**`)
.setThumbnail(img)
.addFields(
{ name: "**Rank:**", value: role_name },
{ name: "**Awards:**", value: awardsList},
{ name: "**Tabs:**", value: tabsList},
{ name: "**Ribbons:**", value: ribbonList}
)
.setFooter({
text: `${interaction.client.user.tag} is managed by Zer0_Access`,
iconURL: `${interaction.client.user.avatarURL()}`,
});
console.log(embed);

interaction.followUp({ embeds: [embed] , ephemeral: false});
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.
No description
65 Replies
d.js toolkit
d.js toolkit12mo ago
- 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 OP
Zer0
Zer0OP12mo ago
I will add that the bot has admin perms on both servers.
saoy
saoy12mo ago
Does one of your bots not have the intents enabled? Or message intents through the discord developer portal?
Zer0
Zer0OP12mo ago
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.
saoy
saoy12mo ago
Hmm, weird. I don't see in your code where it says .editReply though? Am I just blind?
Zer0
Zer0OP12mo ago
I changed it from .editReply to deferReply
saoy
saoy12mo ago
Oh I see now
Zer0
Zer0OP12mo ago
To see if that would fix it but sadly not.
saoy
saoy12mo ago
Could you try going back to .editReply?
Zer0
Zer0OP12mo ago
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.
saoy
saoy12mo ago
huh, weird... Are all the files the same? index.js, handlers, etc?
Zer0
Zer0OP12mo ago
Yeah I'm stumped, this problem happened overnight It was working fine before then it just broke on me
saoy
saoy12mo ago
I've seen people get the Invaild Webhook Token error, let me see if I can see where they fixed it at.
Zer0
Zer0OP12mo ago
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
saoy
saoy12mo ago
try using deferUpdate are you attempting to use an interaction's token >15 minutes after the initial response?
Zer0
Zer0OP12mo ago
Nope
saoy
saoy12mo ago
weird, try asking in #djs-help-v14 It's more open and easier to get help
Zer0
Zer0OP12mo ago
Oddly enough is says deferUpdate isn't a function?
saoy
saoy12mo ago
hmm
Zer0
Zer0OP12mo ago
Maybe because deferUpdate is only used for components? or no?
saoy
saoy12mo ago
probably
treble/luna
treble/luna12mo ago
deferReply returns a promise, resolve it
Zer0
Zer0OP12mo ago
Resolved and still won't edit the message
Zer0
Zer0OP12mo ago
No description
treble/luna
treble/luna12mo ago
show full code
Zer0
Zer0OP12mo ago
It's like 650 lines, I can try to snip it where the interaction gets called One second
d.js docs
d.js docs12mo ago
To share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.
treble/luna
treble/luna12mo ago
and around which lines
Zer0
Zer0OP12mo ago
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)
d.js docs
d.js docs12mo ago
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 more
treble/luna
treble/luna12mo ago
do that and see where it stops
Zer0
Zer0OP12mo ago
It executes the full code, line 676 is the embed in which it gets printed to the console successfully
treble/luna
treble/luna12mo ago
await the edit and make sure your code is saved
Zer0
Zer0OP12mo ago
Code is saved, this is output:
No description
No description
treble/luna
treble/luna12mo ago
you arent silently ignoring errors somewhere i hope
Zer0
Zer0OP12mo ago
Negative, the odd thing is this code literally works on my test bot Just not the main bot
treble/luna
treble/luna12mo ago
replace the embed with text and try then
Zer0
Zer0OP12mo ago
Alrighty
Zer0
Zer0OP12mo ago
Still same thing
No description
Zer0
Zer0OP12mo ago
I'll go back to using interaction.reply then editReply And see if anything changes there
Zer0
Zer0OP12mo ago
@wolvinny 🌈 Won't even edit if I use text
No description
No description
Zer0
Zer0OP12mo ago
I just have the console.log(embed) still in to see if it will go through
const pendingResults = new EmbedBuilder()
.setColor("Red")
.setTitle(`**Status:**`)
.setThumbnail(img)
.setDescription("Grabing user data...")
.setFooter({
text: `${interaction.client.user.tag} is managed by Zer0_Access`,
iconURL: `${interaction.client.user.avatarURL()}`,
});

interaction.reply({embeds: [pendingResults], ephemeral: false});
const pendingResults = new EmbedBuilder()
.setColor("Red")
.setTitle(`**Status:**`)
.setThumbnail(img)
.setDescription("Grabing user data...")
.setFooter({
text: `${interaction.client.user.tag} is managed by Zer0_Access`,
iconURL: `${interaction.client.user.avatarURL()}`,
});

interaction.reply({embeds: [pendingResults], ephemeral: false});
interaction.editReply({ content: "Checking if this actually can edit." , ephemeral: false});
interaction.editReply({ content: "Checking if this actually can edit." , ephemeral: false});
treble/luna
treble/luna12mo ago
did you await the initial reply and the editreply
Zer0
Zer0OP12mo ago
Yep The odd thing is I literally didn't change any code and the bot stopped editing responses over night
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
Sure thing, one moment.
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
No description
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
Sure sure
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
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
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
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
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
Is nothing supposed to pop up?
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
I'm kinda at a loss of words the same exact code works on my test bot
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
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
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
Why did the console.log for the ratelimit not show up?
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Zer0
Zer0OP12mo ago
Djs is 14.14.1 npm is 9.8.1
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server