From e6c9355cf3d9414fc08a3503e4b95b7892b3adb7 Mon Sep 17 00:00:00 2001 From: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com> Date: Wed, 28 Dec 2022 16:03:57 +0100 Subject: [PATCH] Updated Making your bot persistent (markdown) --- Making-your-bot-persistent.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Making-your-bot-persistent.md b/Making-your-bot-persistent.md index 5f095fa..1a121d4 100644 --- a/Making-your-bot-persistent.md +++ b/Making-your-bot-persistent.md @@ -79,8 +79,9 @@ Hence, each implementation should take care that it does not try to serialize `t For example, it can check if the data equals the attribute `BasePersistence.bot` (which will be the bot object used by the `Application`) and instead store a placeholder. When loading the data, the `BasePersistence.bot` can be reinserted instead of the placeholder. Indeed, this is basically what the built-in `PicklePersistence` does. -### ⚠️ Note -Although `PicklePersistence` does the 'placeholder' process described above, all the data are deep copied with `copy.deepcopy` before being handed over to persistence. This means that you should store only copyable data on bot parts that will be persisted. This technical detail is described in a note [here](https://docs.python-telegram-bot.org/en/v20.0b0/telegram.ext.application.html#telegram.ext.Application.update_persistence) For more technical details, please refer to the documentation of [`BasePersistence`](https://python-telegram-bot.readthedocs.io/telegram.ext.basepersistence.html#telegram-ext-basepersistence), -[`PicklePersistence`](https://python-telegram-bot.readthedocs.io/telegram.ext.picklepersistence.html#telegram-ext-picklepersistence) \ No newline at end of file +[`PicklePersistence`](https://python-telegram-bot.readthedocs.io/telegram.ext.picklepersistence.html#telegram-ext-picklepersistence) + +### ⚠️ Note +Although `PicklePersistence` does the 'placeholder' process described above, all the data are deep copied with `copy.deepcopy` before being handed over to persistence. This means that you should either store only copyable data (e.g. no `telegram.Bot` objects) and/or ensure that your stored data defines appropriate custom deepcopy behavior. This technical detail is described in a note [here](https://docs.python-telegram-bot.org/telegram.ext.application.html#telegram.ext.Application.update_persistence) \ No newline at end of file