def bot_start():
application = ApplicationBuilder().token("api_key").build()
async def stop(update, context):
await context.bot.send_message(chat_id=update.message.chat_id, text='Terminating Bot...')
await application.stop()
await Updater.shutdown(application.bot)
await application.shutdown()
async def error(update, context):
err = f"Update: {update}\nError: {context.error}"
logging.error(err, exc_info=context.error)
await context.bot.send_message(chat_id=user_id, text=err)
application.add_handler(CommandHandler('stop', stop))
application.add_error_handler(error)
application.run_polling()
I tried everything I could to stop it and I couldnt as it's not letting other lines of code that comes after calling bot_start() run. It basically never reaches them.