Skip to content

jaylane/propbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PropBot 🎯

A Discord bot for tracking sports betting props with live ESPN updates. Add your bets, get real-time stat tracking as games progress, and see P&L summaries β€” all delivered via Direct Message so your tracking is private and works anywhere.

Features

  • πŸ“Έ AI Bet Slip Parsing β€” Upload a bet slip image and PropBot auto-extracts all your bets
  • πŸ“Š Live Stat Tracking β€” Real-time player stats from ESPN (free, no API key required)
  • πŸ”” DM Monitoring β€” Live updates sent to your DMs as games progress (no channel spam)
  • πŸ“ˆ Odds Comparison β€” Compare lines across sportsbooks (BYOK: bring your own Odds API key)
  • 🎰 Parlay Support β€” Track multi-leg parlays, auto-settle when all games finish
  • πŸ—„οΈ Zero-Config DB β€” SQLite, no external database needed

DM-First Architecture

All bet tracking is user-scoped and delivered via DM:

  • Commands work in DMs or any server β€” no channel setup required
  • /monitor start sends live updates directly to your DMs
  • Each user has their own independent monitor (start/stop without affecting others)
  • Bet history is private to you, not tied to a server

Servers are optional β€” useful for discovery, but PropBot doesn't need to post to channels.

Supported Sports

Sport Coverage
NBA Full box score, all stats
NCAAB Full box score, all stats
NFL Passing/rushing/receiving yards, TDs
MLB Hits, strikeouts (partial)
NHL Goals, assists, saves (partial)

Supported Prop Types

Stat Command Key Description
Points points or pts Player points
Rebounds rebounds or reb Total rebounds
Assists assists or ast Assists
3-Pointers threePointers or 3pm 3PT made
Steals steals or stl Steals
Blocks blocks or blk Blocks
Turnovers turnovers or to Turnovers
PRA pra Points + Rebounds + Assists
RA ra Rebounds + Assists
PA pa Points + Assists
PR pr Points + Rebounds

Slash Commands

/prop add β€” Track a single prop

/prop add player:Anthony Edwards stat:threePointers line:3.5 direction:over game:TOR@MIN wager:20
/prop add player:Nikola Jokic stat:pra line:52.5 direction:over game:LAL@DEN wager:50 odds:-110

/prop list β€” View your active props

/prop remove slip:1 β€” Void a slip

/parlay β€” Track a multi-leg parlay

/parlay wager:25 legs:Edwards O3.5 3PM, Randle O6.5 REB, Murray O25.5 PTS
/parlay wager:50 legs:Jokic O52.5 PRA, LeBron O25.5 PTS odds:+450

/track β€” Parse a bet slip image

/track slip:[attach image]
/track text:"Edwards 3PM over 3.5 -115, Jokic PRA over 52.5 -110, wager $25"

/monitor start β€” Enable live DM updates

/monitor start                  β€” DM updates every 5 minutes (default)
/monitor start interval:2       β€” DM updates every 2 minutes
/monitor stop
/monitor status

Updates are sent to your DMs β€” no channel permission required.

/status β€” Check your current stats

/status           β€” All your active bets
/status slip:3    β€” Specific slip

/odds β€” Compare lines (BYOK)

/odds game:"Lakers vs Nuggets" market:spreads
/odds game:MIN sport:nba market:h2h

/settings β€” Configure preferences

/settings oddskey:YOUR_ODDS_API_KEY
/settings timezone:America/Los_Angeles
/settings    β€” View current settings

Setup

Prerequisites

  • Node.js 20+
  • A Discord bot token (guide)
  • OpenAI API key (optional, for /track slip parsing)
  • The Odds API key (optional, per-user BYOK for /odds)

1. Clone & Install

git clone https://github.com/yourusername/propbot
cd propbot
npm install

2. Configure

cp .env.example .env

Edit .env:

DISCORD_TOKEN=your-discord-bot-token
DISCORD_CLIENT_ID=your-discord-client-id
OPENAI_API_KEY=your-openai-key          # Optional: for /track
ENCRYPTION_KEY=$(openssl rand -hex 32)  # Required: for encrypting user keys
DATABASE_PATH=./data/propbot.db

3. Register Commands

Commands are registered globally (work in DMs + all servers):

npm run register

For guild-specific registration (instant, good for testing):

GUILD_ID=your-guild-id npm run register

4. Start the Bot

npm run build && npm start
# or for development:
npm run dev

Docker Deployment

# Build
docker build -t propbot .

# Run
docker run -d \
  --name propbot \
  --restart unless-stopped \
  -e DISCORD_TOKEN=your-token \
  -e DISCORD_CLIENT_ID=your-client-id \
  -e OPENAI_API_KEY=your-openai-key \
  -e ENCRYPTION_KEY=your-32-byte-hex \
  -v propbot_data:/app/data \
  propbot

Railway / Fly.io

Both platforms support Docker-based deployment. Set the environment variables in their dashboard and point to this repo. The SQLite database persists on a mounted volume.


How Live Tracking Works

  1. You add a prop with /prop add and specify the game: argument (e.g. TOR@MIN)
  2. PropBot looks up the ESPN game ID for that matchup today
  3. Run /monitor start β€” PropBot will DM you updates every N minutes
  4. When the game is final, PropBot evaluates all legs, settles the slip, and DMs you the result

Linking Parlays to Games

The /parlay command parses free-text legs but can't always auto-link each player to a game. For reliable tracking:

  1. Use /parlay to create the slip (it stores the legs)
  2. The monitor will attempt matching β€” or use /prop add per leg for explicit game linking

Architecture

src/
β”œβ”€β”€ index.ts              β€” Bot entrypoint, command dispatch
β”œβ”€β”€ register-commands.ts  β€” One-time Discord command registration
β”œβ”€β”€ commands/             β€” Slash command handlers (all DM-capable)
β”‚   β”œβ”€β”€ prop.ts           β€” /prop (add/list/remove)
β”‚   β”œβ”€β”€ parlay.ts         β€” /parlay
β”‚   β”œβ”€β”€ track.ts          β€” /track (AI vision parsing)
β”‚   β”œβ”€β”€ monitor.ts        β€” /monitor (start/stop/status) β€” DMs updates to user
β”‚   β”œβ”€β”€ status.ts         β€” /status
β”‚   β”œβ”€β”€ odds.ts           β€” /odds (BYOK)
β”‚   └── settings.ts       β€” /settings
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ espn.ts           β€” ESPN API (free, no key)
β”‚   β”œβ”€β”€ odds-api.ts       β€” The Odds API (BYOK)
β”‚   β”œβ”€β”€ slip-parser.ts    β€” AI vision parsing (OpenAI GPT-4o)
β”‚   β”œβ”€β”€ prop-tracker.ts   β€” Leg evaluation engine
β”‚   └── monitor.ts        β€” Per-user game monitoring loop (DM delivery)
β”œβ”€β”€ models/               β€” TypeScript types
β”œβ”€β”€ db/                   β€” SQLite (better-sqlite3)
└── utils/                β€” Embeds, constants, crypto

Environment Variables

Variable Required Description
DISCORD_TOKEN βœ… Bot token from Discord Developer Portal
DISCORD_CLIENT_ID βœ… Application ID from Discord Developer Portal
ENCRYPTION_KEY βœ… 64-char hex string for AES-256 encryption of user keys
OPENAI_API_KEY Optional Required for /track slip image parsing
DATABASE_PATH Optional Path to SQLite file (default: ./data/propbot.db)
MONITOR_INTERVAL_MINUTES Optional Default monitor interval in minutes (default: 5)

Discord Bot Permissions

When adding the bot to a server, it needs:

  • Send Messages
  • Embed Links
  • Read Message History
  • Use Slash Commands

For DM delivery (required for /monitor):

  • Enable Message Content Intent in the Discord Developer Portal β†’ Bot settings

OAuth2 scopes: bot, applications.commands

Note: If a user has DMs disabled from server members, PropBot will silently skip DM delivery for the monitor. The bot will log a warning server-side.


Future: Server Features

  • TODO: /leaderboard β€” opt-in P&L rankings shown in a server channel

License

MIT β€” go build something cool.

About

Discord bot for live sports betting prop tracking. ESPN-powered, AI bet slip parsing, BYOK odds comparison.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors