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

519
Views
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
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!