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

155
Visualizações
Discord.js bot wont boot up anymore

I was coding my bot this morning, it was working fine until I go to eat. When I came back the bot no longer wanted to boot up when I was executing my code. The weird thing is that I didn't changed anything in my code, I don't have any log message on console (usually success log when boot up properly) and It was working fine about 1h ago. I have tried reset bot's token but not working. I'm using Replit.com as Node.js project, here is the link.

const TOKEN = process.env['token']
const { Client, Intents } = require('discord.js');

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });

function getLastWord(str) {
    return (str.toLowerCase().match(/(\w+)\W*$/) || [])[1];
}

const activities = [
      "test activity 1",
      "test activity 2",
      "test activity 3",
      "test activity 4"
    ];
      

client.on("ready", () => {
  console.log(`Logged in as ${client.user.tag}!`)
  // run every 10 seconds
      setInterval(() => {
        // generate random number between 1 and list length.
        const randomIndex = Math.floor(Math.random() * (activities.length - 1) + 1);
        const newActivity = activities[randomIndex];

        client.user.setActivity(newActivity,{ type: 'LISTENING' });
      }, 10000);
});

client.on("message", msg => {
  if (getLastWord(msg.content) === "quoi") {
    msg.reply("feur");
  }
  if (client.users.cache.find(user => user.id === '422449611035115520') && msg.author.bot === false){
    msg.reply("spotted");
  }
})

client.login(TOKEN)

It worked again for 3h for no reasons and now it's not working anymore (again), sometimes the bot won't boot up I don't understand that's very random.

about 4 years ago · Santiago Gelvez
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