Telegram Bot in python is not working as expected that is hosted on cyclic.sh

51 Views Asked by At

I have made a telegram bot , but it is not working as expected . When I deployed on cyclic.sh, it provided me a cyclic URL for my bot , when I refresh the web page , then for a moment the bot works but again it stops . So, I have to refresh the page to make it run . What can be the the problem and how can I fix this .

Log : Timeout waiting for port to be ready after 6 seconds, defaulting to 3000 [CYCLIC] ERROR: No response from server on port 3000 [CYCLIC] Timeout waiting for port to be ready after 6 seconds, defaulting to 3000 [CYCLIC] ERROR: No response from server on port 3000 [CYCLIC] Timeout waiting for port to be ready after 6 seconds, defaulting to 3000 [CYCLIC] ERROR: No response from server on port 3000 Listening ...

Also the bot is working smoothly and continuously on my local computer that i till the time my code is running on pycharm , the bot works .

After deploying the python telegram bot , I was expecting the bot to run continuously . It was supposed to execute based on user's command but it is not working as such . My bot responds only when the web page provided by cyclic.sh is refreshed and does not works every time . It is working very smoothly on my local computer .

My code is structured this way :

import telegram.ext

def main(): TOKEN = ""

def start(update, context):
    update.message.reply_text(f"Text")

def help(update, context):
    update.message.reply_text("help_message")


updater = telegram.ext.Updater(TOKEN, use_context=True)
dispatch = updater.dispatcher

dispatch.add_handler(telegram.ext.CommandHandler("start", start))
dispatch.add_handler(telegram.ext.CommandHandler("help", help))

updater.start_polling()
updater.idle()

if name == "main": main()

0

There are 0 best solutions below