Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!