Voice channel name change fails silently after 2 successful attempts

I'm using a bot with Administrator permissions to rename a voice channel via channel.setName(). The first two attempts work fine, but from the third attempt onward, the name doesn't change — and no error is thrown. Here’s the relevant code snippet:
const guild = await interaction.guild?.fetch();
const channelFetch = await guild?.channels.fetch(tempVoice.id) as VoiceChannel;

await new Promise(res => setTimeout(res, 5000));
console.log("🔧 Changing name...");
await channelFetch.setName(newName).catch((e) => console.log("❌ Error changing name", e));
console.log("✅ Name changed!");
await tempVoice.save();
const guild = await interaction.guild?.fetch();
const channelFetch = await guild?.channels.fetch(tempVoice.id) as VoiceChannel;

await new Promise(res => setTimeout(res, 5000));
console.log("🔧 Changing name...");
await channelFetch.setName(newName).catch((e) => console.log("❌ Error changing name", e));
console.log("✅ Name changed!");
await tempVoice.save();
As shown, there’s a 5-second delay and a .catch() block — but no error is logged, and ✅ Name changed! appears in the console, even though the name doesn’t actually change in Discord. Tested on multiple servers. The bot has full Administrator permissions and no permission issues are present. Expected: The channel name should change every time after the cooldown, not just for the first two tries.
6 Replies
d.js toolkit
d.js toolkit5mo ago
treble/luna
treble/luna5mo ago
1) channels, nor guilds, need to be fetched if you have the Guilds intent. 2) there's a strict ratelimit on setting the name and topic of channels, twice every 10 minutes
Mr. Boda
Mr. BodaOP5mo ago
Thx Is there a rate limit for locking/unlocking voice channels or changing the user limit frequently via bot?
d.js docs
d.js docs5mo ago
Ratelimits are dynamically assigned by the API based on current load and may change at any point. - The scale from okay to API-spam is sliding and depends heavily on the action you are taking - Rainbow roles, clock and counter channels, and DM'ing advertisements to all members are all examples of things that are not okay
treble/luna
treble/luna5mo ago
The only thing thats certain is the name and topic change limit
Mr. Boda
Mr. BodaOP5mo ago
thx

Did you find this page helpful?