0
votes

I'm trying to make a discord bot that changes the name of the voice channel to 'game' when you enter and 'shhh' when you leave. The first time I joined and left, both name changes were made very quickly. But the second time, it took around 10 minutes to change the name of the voice channel.

Here is what i'm trying:

client.on('voiceStateUpdate', async (oldMember, newMember) => {
 let newUserChannel = newMember.channelID;
 let oldUserChannel = oldMember.channelID;

 if (newUserChannel === '601225675227267072') {
  console.log('joined');
  if (newMember.channel.name !== 'game') {
   await newMember.channel.setName('game');
  }
 } else if (oldUserChannel === '601225675227267072') {
  console.log('left');
  if (oldMember.channel.name !== 'shhh') {
   await oldMember.channel.setName('shhh');
  }
 }
});
1
Discord's API Implements a delay for some moderator actions, This could be affecting your bot. Similarly, If your bot makes too many requests a minute it can be rate limited.pfych

1 Answers

0
votes

The rate limit for channel name and topic changes is 2 per 10 minutes (I think), this is per channel. I think that's what your issue is here.