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

128
Visualizações
I want to make my bot status be shown 24/7

I want to make my bot status be shown 24/7

Here is my code:

client.once('ready', () => {
    console.log('pdm bot is online'); 
        setInterval(() => {
          targetGuild = client.guilds.cache.get('My guild id')
          client.user.setPresence({ 
            activities: [{ name: `${targetGuild.memberCount} Users👥`, type: 'WATCHING' }], 
            status: 'online'
            });
        }, 1000 * 60 * 5);
    
    });

My problem is when I close command prompt the code do not run anymore and my but activity will be empty.

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

0

To make your bot run 24/7 you have to keep the node process alive, when you close the terminal the execution of that process is terminated and your bot goes off. You can do it in a couple of ways:

  • Buy a vps online(that stays online 24/7 of course) and start the process there
  • Host it on services like heroku
  • If you have a pc in your house and you want to use it as a server(meaning that you never turn it off) you can use it(not the best idea).

These are the main ways of hosting a bot, and last but not least for each of these(except for pre-made services of course) you will probably need a process manager, the most famous one is pm2, it basically allows you to run code in background(so you don't need to keep the terminal open) but more important than that it allows you to generate several processes and in case scale your application.

I haven't said all the things you need to start hosting a bot, but i think this will be something to start from. I guess you now have the basics

about 4 years ago · Juan Pablo Isaza Relatório

0

You need a server to run the code 24/7, or keep open the CMD. If the code is not running your bot cant stay online.

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