Storage Monitoring
Storage Monitoring¶
The Global instance can be used to monitor storage usage at the account level.
It gives visibility into total storage consumed across:
- Bot data
- User data
- Global data
This helps you track usage, prevent limits from being reached, and plan cleanups.
Get Detailed Storage Information¶
Retrieve detailed storage stats for your account.
Example output:
size→ total storage used (bytes)prop_count→ total stored entrieslast_calc→ last calculation timestamp
Get Storage Usage Percentage¶
Check how much storage is used as a percentage (0–100).
This is useful for dashboards or alerts.
Check If Storage Is Near Limit¶
You can quickly detect when storage is close to full.
if (Global.isStorageNearLimit()) {
Bot.sendMessage("⚠️ Storage almost full! Please clean up some data.")
}
By default, this checks against a 90% threshold.
Get Available Storage¶
Find out how much storage is still available.
let availableMB = Global.getAvailableStorage()
Bot.sendMessage("Available storage: " + availableMB + " MB")
This value is returned in megabytes (MB).
Notes¶
- All storage metrics are account-wide
- Includes Bot, User, and Global data
- Useful for monitoring, alerts, and maintenance
- Helps avoid unexpected storage limits
The Global instance provides a simple way to observe and manage your account’s storage usage.