Button functioning once

Code - https://srcshare.io/64978dcec50c534c8dbb3831 When I click the comeplay or edit-name button the first time, it works as intended. But if I click it again, it gets logged through the collector, but for example on the comeplay button when it gets to line 22 when the voice channel name should change; nothing happens. No errors get logged in the console, but on discord it does say "This interaction failed" (doesn't say it the first time). Any help would be appreciated.. Djs version: "discord.js": "^14.9.0",
SrcShare
Easily share your source code with other developers.
3 Replies
d.js toolkit
d.js toolkit12mo ago
• 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.
victorr
victorr12mo ago
Thanks for the improvements, I got rid of the deferUpdate and added i.update. I also changed the code for my filter so it uses an array. Here is an updated version (https://srcshare.io/64982000e07d5ab9a9569367). However, the problem seems to be persisting. Before I only showed the part of the code I believed was necessary but now I added the full code now just incase something else was interfering.
SrcShare
Easily share your source code with other developers.
victorr
victorr12mo ago
If it helps, both the lock & unlock buttons work as intended (multiple times) I think I did it in the span of about 10 seconds; Also do you mean something like this?
if (i.customId === 'comeplay') {
const voiceChannel = i.member.voice.channel;
await i.deferReply();
await voiceChannel.setName(`comeplay->${i.member.displayName}`);


disabled = true;
panelEmbed.setDescription(`🔊${voiceChannel.name}\nRoom ${locked ? "**Locked**" : "**Unlocked**"}`);

if (locked === false) {
row.components[1].setDisabled(true);
await i.editReply({ embeds: [panelEmbed], components: [row] });
} else if (locked === true) {
row2.components[1].setDisabled(true);
await i.editReply({ embeds: [panelEmbed], components: [row2] });
}

}
if (i.customId === 'comeplay') {
const voiceChannel = i.member.voice.channel;
await i.deferReply();
await voiceChannel.setName(`comeplay->${i.member.displayName}`);


disabled = true;
panelEmbed.setDescription(`🔊${voiceChannel.name}\nRoom ${locked ? "**Locked**" : "**Unlocked**"}`);

if (locked === false) {
row.components[1].setDisabled(true);
await i.editReply({ embeds: [panelEmbed], components: [row] });
} else if (locked === true) {
row2.components[1].setDisabled(true);
await i.editReply({ embeds: [panelEmbed], components: [row2] });
}

}
(Just tested after waiting a little longer, that didn't seem to change anything) Ah right No rate limits seem to be showing. I don't think that can be the problem because I'm using the comeplay button first then editing the name using the edit name button within the span of like 5-10 seconds, and they work fine the first time. Just to make sure though, here is the code for my rateLimit event listener:
botClient.rest.on('rateLimited', (rateLimitInfo) => {
console.log("Rate Limited!", rateLimitInfo);
});
botClient.rest.on('rateLimited', (rateLimitInfo) => {
console.log("Rate Limited!", rateLimitInfo);
});
Also this time, when I click the come-play button the 2nd time, it doesn't say "This interaction failed", Just does nothing. Ah my bad I don't think I explained clearly. So like when I click the come-play button the 2nd time AFTER I click the edit-name button. Series + Click comeplay (Functions as intended) + Click editname (Functions as intended (changes the name of the channel)) + Click comeplay again (Nothing happens) So I did a little bit more testing, and it definitely gets picked up by the collector, the issue happens when the channel name is supposed to change and when the embed description is supposed to change It's just confusing because no errors or anything are being thrown? Ok it was definitely a rate limit thing; 10 mins = 2 name change requests. Really wish some sort of error was thrown, spent about a day trying to figure out what the problem was 😩 I did ask if this was right?