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