Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

520
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda