Takeaway
Avoid global mutable state in bot handlers
Why
Module-level dicts race under concurrency and leak data across chats.
Do this
- Pass context objects explicitly.
- Use request-scoped storage.
- Put shared state in Redis/DB with clear keys.
BotNetwork
Avoid global mutable state in bot handlers
Avoid global mutable state in bot handlers
Module-level dicts race under concurrency and leak data across chats.