mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-10-23 17:36:26 +02:00
Updated Making your bot persistent (markdown)
parent
9cd9cdc1f4
commit
f9d2bd2b2d
1 changed files with 1 additions and 3 deletions
|
@ -29,9 +29,7 @@ If you've written a persistence class that could benefit others (e.g. a general
|
|||
To make your bot persistent you need to do the following.
|
||||
|
||||
- Create a persistence object (e.g. `my_persistence = PicklePersistence(filename='my_file')`)
|
||||
- Construct Updater with the persistence (`Updater('TOKEN', persistence=my_persistence, use_context=True)`)
|
||||
|
||||
Note that the Updater passes the persistence variable to the Dispatcher, so if you aren't using the Updater, you can set the persistence on your Dispatcher object instead.
|
||||
- Construct `Updater` with the persistence (`Updater('TOKEN', persistence=my_persistence, use_context=True)`). If you don't use the `Updater` class, you can pass the persistence directly to the `Dispatcher`.
|
||||
|
||||
This is enough to make `user_data`, `bot_data` and `chat_data` persistent.
|
||||
To make a conversation handler persistent (save states between bot restarts) you **must name it** and set `persistent` to `True`.
|
||||
|
|
Loading…
Reference in a new issue