ResourcesLib
ResourcesLib¶
ResourcesLib is used to manage persistent numeric resources at both user level and global level.
It is commonly used for things like balances, counters, credits, points, or usage tracking.
Resources created with ResourcesLib are stored persistently and automatically handled by TBL.
User-Level Resources¶
User resources are scoped to the current user.
Example:
- Each user has their own independent value
- Useful for coins, XP, credits, or limits
Global Resources¶
Global resources are shared across all users of the same bot.
Any update to a global resource affects every user interacting with that bot.
Example:
- One shared value for the entire bot
- Useful for visits, totals, or bot-wide counters
Info
Global resources are bot-wide, not user-specific. They are not shared between different bots.
Common Operations¶
Resources support simple operations such as:
- Adding values
- Reading current value
- Persistent storage without manual save logic
Notes¶
- Resources are created automatically if they don’t exist
- Values are stored persistently
- No setup or schema required
- Safe to use in commands and callbacks