mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-04-18 09:21:34 +00:00
docs: add per-module READMEs with architecture and DB schemas
Each module now has a README.md documenting commands, architecture, and database schema (KV keys, JSON structure, field descriptions). Trading README enhanced with full schemas for user portfolio and price cache objects.
This commit is contained in:
35
src/modules/misc/README.md
Normal file
35
src/modules/misc/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Misc Module
|
||||
|
||||
Health check and DB demonstration. Exercises all three visibility levels.
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | Visibility | Description |
|
||||
|---------|-----------|-------------|
|
||||
| `/ping` | public | Health check — replies "pong" and records timestamp |
|
||||
| `/mstats` | protected | Shows last `/ping` timestamp |
|
||||
| `/fortytwo` | private | Easter egg — replies "The answer." |
|
||||
|
||||
## Architecture
|
||||
|
||||
- `/ping` writes a timestamp to KV on every call (best-effort — KV failure doesn't block the reply).
|
||||
- `/mstats` reads the last ping timestamp and formats it as ISO string.
|
||||
- `/fortytwo` is a hidden command demonstrating private visibility.
|
||||
|
||||
## Database
|
||||
|
||||
KV namespace prefix: `misc:`
|
||||
|
||||
| Key | Type | Description | Example |
|
||||
|-----|------|-------------|---------|
|
||||
| `last_ping` | JSON | Timestamp of the most recent `/ping` call | `{ "at": 1713100000000 }` |
|
||||
|
||||
### Schema: `last_ping`
|
||||
|
||||
```json
|
||||
{
|
||||
"at": 1713100000000
|
||||
}
|
||||
```
|
||||
|
||||
- `at` — Unix epoch milliseconds (`Date.now()`)
|
||||
Reference in New Issue
Block a user