Python-telegram-bot stops reading specific commands

45 Views Asked by At

After my python-telegram-bot runs for a while (and after extensive use) it stops reacting to the /start command. It just doesn't read it (see image below). Then it takes a certain amount of time, before it works again. (Restarting the bot doesn't help, I just have to wait for an hour or so.)

Where could this come from? It's really strange since any Message or command is read by the bot, except for the /start command.

See this Image:

see this Image:

I enabled debug logging but couldn't find anything obvious. During the call to get_updates(), in fact, it logs "No new updates found", although the /start command apparently wasn't read.

I'm using PTB v20.8

Here is the code where I initialize the ConversationHandler.

def init_application(self):
    # Create the Application and pass it bot's token.
    application = Application.builder().token(self.BOTTOKEN).read_timeout(10).get_updates_read_timeout(50).build()
    
    # Add conversation handler with the states 
    conv_handler = ConversationHandler(
        entry_points=[CommandHandler("start", self.start)],
        states={
            self.MENURESPONSE:    [MessageHandler(filters.Regex("^.*$"), self.menu_response)],
            self.TICKETING:       [MessageHandler(filters.Regex("^.*$"), self.ticketing)],
            self.TICKETING_CHECK: [MessageHandler(filters.Regex("^.*$"), self.ticketnumber_check)],
            self.ACCOMMODATION:   [MessageHandler(filters.Regex("^.*$"), self.accommodation)],
            self.PAYMENT:         [MessageHandler(filters.Regex("^.*$"), self.payment)],
            self.BANKING:         [MessageHandler(filters.Regex("^.*$"), self.banking)],
            self.BANKINGUPLOAD:   [MessageHandler(filters.Document.ALL, self.banking_file_upload)],
        },
        fallbacks=[CommandHandler("cancel", self.cancel)],
    )
    #application.add_handler(MessageHandler(filters.Document.ALL, self.banking_file_upload))
    application.add_handler(conv_handler)
    self.application = application
    return 

If I rename the command /start to something else, for example /start2, and I restart my bot, then I can use my app, and everything is fine. Still, it doesn't read the /start command, but everything works. After about an hour or so, it starts to read the /start command again.

0

There are 0 best solutions below