Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/firestore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Storage adapter that can be used to [store your session data](https://grammy.dev/plugins/session.html) on [Google Cloud Firestore](https://cloud.google.com/firestore) when using sessions.

> ⚠️ Google Cloud Firestore is known to cause trouble if you attempt to store anything else but plain JSON-like values.
> For example, if your data contains `undefined` or has functions installed, errors will be thrown.
> This is especially relevant when using the conversations plugin, so you might need to look into [small workarounds](https://t.me/grammyjs/320305) when using this adapter with it.

## Installation

```bash
Expand Down Expand Up @@ -62,4 +66,4 @@ If your bot does not need the session data for most of the messages it processes
Imagine your bot is in a group chat where it only counts photos but otherwise ignores all messages.
Then it would not make sense to retrieve the session data for every request, and to write back the identical data.
The solution is to use the built-in lazy mode of grammY, so just replace `bot.use(session ...)` by `bot.use(lazySession ...)`, and remember to `await ctx.session` whenever you use it.
You must also flavor your context with `LazySessionFlavor` instead of just `SessionFlavor`.
You must also flavor your context with `LazySessionFlavor` instead of just `SessionFlavor`.
Loading