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

521
Visualizações
Stop telegram bot command

I am writing the telegram bot using node.js and telegraf. I ran into the question how to make the /stop command so, that user won't be able enter messages until he presses the restart button at the bottom. I tried to use bot.stop() and bot.leaveChat(), but that doesn't work; My code now:

const stop = async ctx => {
    ctx.reply('Your account was deleted and all subscriptions was cancelled')

    await CurrencyController.deleteUserCurrencies(ctx) //deletes user's subscriptions from database
    await UserController.deleteUser(ctx) //deletes user from database
    bot.stop() //doesn't work correctly
};


bot.command('stop', async ctx => await stop(ctx))

Now result of code is this, as you can see bot wasn't stopped for user, it just stopes in node.js, so I need to restart it with terminal.

I need such result of function, it can be done with hands when you press stop and block bot in it's profile

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