Skip to content

A new way to restart the bot under v20 #3718

@harshil21

Description

@harshil21

In v13, we had a simple code snippet we could use to restart the bot (https://github.com/python-telegram-bot/v13.x-wiki/wiki/Code-snippets#simple-way-of-restarting-the-bot), which restarted the whole script passing in any arguments. However simply adapting that to v20 this doesn't work since:

  1. threading and asyncio don't play well together
  2. the application methods (stop, shutdown, app.updater.shutdown) all need to be awaited instead of simply called
  3. something more I didn't see at first glance

If anyone has figured out a simple way to restart the whole script (e.g. by sending a command to a bot), feel free to propose your solution below!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions