Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
Update the channel name several times

What I am trying to do is have a counter that is shown in the name of a channel.

I am aware of the Discord API rate-limits and that I can change the channel name 2 times in 10 minutes. I am aware that DiscordJS handles rate-limits internally by putting them in a queue.

The problem is right here, suppose the bot executes these lines consecutively:

myChannel.setName(1);
myChannel.setName(2);
myChannel.setName(3);
myChannel.setName(4);
myChannel.setName(5);

What happens is that the first two requests change the channel name and the other three go to queue. But after 10 minutes what happens is that the third and fourth requests are sent, while I would like to jump to the last one instead.

I was interested in finding out if there was a way to check the response to the request for a channel name change, in order to "intercept" the rate-limit and prevent it from going into the queue.

I have already thought of a solution for the problem itself:

setInterval(()=>{
    myChannel.setName(varDefSomewhereElse);
},10*60*1000);

but I want to solve the "problem" as efficiently as possible.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Two ways would likely work for this:

  1. try, catch:
try {
   myChannel.setName('asd')
}
catch (error) {
console.error(error)
// handle the error here
}
  1. .then
myChannel.setName(varDefSomewhereElse).then((c) => {
console.log(`Set to ${c.name}`)
})
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda