How aleg94/pricegram works
Pricegram is a Telegram bot for tracking Amazon product prices and availability. Users add products through /track, then manage them with /list; a background poller checks saved products and the application sends preference-based alerts. The graph separates Telegram interaction, product retrieval, tracking and alerts, and persistence. Relationships for the main runtime are supported by excerpts and README statements; some unsampled modules are represented by their exact tree paths, with uncertain calls omitted.
Main entry points: product.model.js Product model · actions Product actions · index.js Bot runtime · handler.js Product check handler
Components 25
Telegram interaction
- Bot runtime
lib/bot/index.js - Command registry
lib/bot/commands/index.js - Track command
lib/bot/commands/track.js - List command
lib/bot/commands/list.js - Add product flow
lib/bot/scenes/add-product.js - Target price flow
lib/bot/scenes/set-target-price.js - Product actions
lib/bot/actions - List action
lib/bot/actions/list.js - Menu action
lib/bot/actions/menu.js - Remove action
lib/bot/actions/remove.js - Price action
lib/bot/actions/price.js - Availability action
lib/bot/actions/availability.js - Product menu
lib/bot/keyboards/menu.js
Amazon product retrieval
- Page fetcher
lib/helpers/http.js - Amazon page parser
lib/amazon/amazon-product-page.js - URL validator
lib/helpers/validator.js
Tracking and alerts
- Tracker coordinator
lib/price-tracker/index.js - Polling scheduler
lib/price-tracker/polling.js - Product check handler
lib/price-tracker/handler.js - Alert formatter
lib/templates/alert.js
Persistence
- Database connector
lib/database.js - Product model
lib/models/product.model.js
Other components
- Telegram user
- MongoDB
- Telegram API
Connections 35
- Telegram user → Bot runtime: sends commands
README.md - Bot runtime → Command registry: dispatches commands
lib/bot/index.js - Bot runtime → Product actions: dispatches actions
lib/bot/index.js - Bot runtime → Telegram API: sends messages
lib/bot/index.js - Command registry → Track command: registers
lib/bot/commands/index.js - Command registry → List command: registers
lib/bot/commands/index.js - Track command → Add product flow: starts flow
lib/bot/commands/track.js - List command → Product model: queries products
lib/bot/commands/list.js - List command → Product menu: renders options
lib/bot/commands/list.js - Product actions → List action: dispatches
lib/bot/actions/index.js - Product actions → Menu action: dispatches
lib/bot/actions/index.js - Product actions → Remove action: dispatches
lib/bot/actions/index.js - Product actions → Price action: dispatches
lib/bot/actions/index.js - Product actions → Availability action: dispatches
lib/bot/actions/index.js - List action → Product model: queries products
lib/bot/actions/list.js - Menu action → Product model: queries products
lib/bot/actions/menu.js - Menu action → Product menu: renders options
lib/bot/actions/menu.js - Remove action → Product model: deletes product
lib/bot/actions/remove.js - Price action → Target price flow: starts flow
lib/bot/actions/price.js - Availability action → Product model: updates preference
lib/bot/actions/availability.js - Add product flow → Product model: saves product
lib/bot/scenes/add-product.js - Add product flow → Page fetcher: fetches page
lib/bot/scenes/add-product.js - Add product flow → Amazon page parser: parses page
lib/bot/scenes/add-product.js - Add product flow → URL validator: validates URL
lib/bot/scenes/add-product.js - Target price flow → Product model: updates target
lib/bot/scenes/set-target-price.js - Tracker coordinator → Polling scheduler: starts polling
lib/price-tracker/index.js - Tracker coordinator → Product check handler: registers checks
lib/price-tracker/index.js - Polling scheduler → Product check handler: dispatches results
lib/price-tracker/index.js - Product check handler → Page fetcher: fetches page
lib/price-tracker/handler.js - Product check handler → Amazon page parser: parses page
lib/price-tracker/handler.js - Product check handler → Product model: updates record
lib/price-tracker/handler.js - Database connector → MongoDB: connects
lib/database.js - Product check handler → Alert formatter: emits update
- Alert formatter → Bot runtime: formats alert
app.js - Bot runtime → Telegram user: delivers alert