Skip to content

jonax1337/Schedule-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

667 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Schedule Bot logo

Valorant Schedule Bot

A comprehensive Discord bot + web dashboard for E-Sports team scheduling

Documentation

Quick Start β€’ API Reference β€’ Commands β€’ Deployment


Deploy on Railway

Tech Stack

TypeScript Node.js Discord.js Express Next.js React PostgreSQL Prisma TailwindCSS Radix UI


About

Valorant Schedule Bot is a full-stack scheduling solution designed for E-Sports teams. It combines Discord's familiar interface with a powerful web dashboard to manage player availability, coordinate training sessions, track scrims, and plan strategies.

Why This Bot?

  • Dual Interface - Discord commands for quick access + Web dashboard for detailed management
  • Smart Analysis - Automatically calculates overlapping time windows for all available players
  • Automation - Daily schedule posts, reminder notifications, and automated jobs via node-cron
  • Role Management - Support for main roster, substitutes, and coaches
  • Timezone-Aware - Per-user timezone support with automatic time conversion
  • VOD Review - Collaborative video analysis with timestamped comments
  • Stratbook - Local strategy management with TipTap rich text editor
  • Secure - JWT authentication, bcrypt password hashing, rate limiting, CORS protection

Features

Discord Bot

Feature Description
Interactive Availability Button-based UI for quick availability updates
Smart Schedule Analysis Detects roster status (full, needs subs, can't proceed)
Time Window Calculation Finds common available time slots
Per-User Timezone Players set their timezone via /set-timezone
Recurring Availability Set weekly default patterns that auto-apply
Quick Polls Custom polls with countdown timer and auto-recovery
Training Polls Vote on preferred training start times
Absence Management Plan absences in advance with automatic marking

Web Dashboard

Feature Description
Schedule Editor Spreadsheet-like editor for schedule entries
Scrim Manager Track opponents, results, VOD URLs, agent compositions
VOD Review YouTube player with timestamped comments, filtering, mentions
Statistics Availability charts, scrim results, win/loss streaks
Stratbook TipTap editor with folders, map/side filtering, file uploads
User Portal Self-service availability with live database updates
Live Logs Stream bot activity, warnings, and errors
Dark Mode Full dark mode with system preference detection

Automation

  • Daily Schedule Posts - Automatic posting at configured time
  • Smart Reminders - DM notifications before post time
  • Change Notifications - Channel alerts when roster status changes
  • Schedule Seeding - Maintains 14-day rolling window automatically

Quick Start

Prerequisites

  • Node.js v20 or higher
  • PostgreSQL 14+ (local or managed service)
  • Discord Bot application (setup guide)

Installation

# Clone the repository
git clone https://github.com/jonax1337/schedule-bot.git
cd schedule-bot

# Install backend dependencies
npm install

# Install dashboard dependencies
cd dashboard && npm install && cd ..

# Create environment file
cp .env.example .env
# Edit .env with your values (see Configuration section)

# Run database migrations
npx prisma migrate deploy

# Build and start
npm run build
npm start

# Start dashboard (separate terminal)
cd dashboard && npm run dev

Environment Variables

# Required
DISCORD_TOKEN=your_bot_token
DISCORD_GUILD_ID=your_server_id
DATABASE_URL=postgresql://user:pass@localhost:5432/schedule_bot
ADMIN_USERNAME=admin
ADMIN_PASSWORD_HASH=bcrypt_hash  # Generate: node dist/generateHash.js YOUR_PASSWORD
JWT_SECRET=random_32+_char_string

# Optional - Discord OAuth
DISCORD_CLIENT_ID=your_client_id
DISCORD_CLIENT_SECRET=your_client_secret
DISCORD_REDIRECT_URI=http://localhost:3000/auth/callback

# Optional - URLs
DASHBOARD_URL=http://localhost:3000
BOT_API_URL=http://localhost:3001
NEXT_PUBLIC_BOT_API_URL=http://localhost:3001

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  β”‚         β”‚                  β”‚
β”‚  Discord Server  │◄─────────  Discord Bot     β”‚
β”‚  (User Input)    β”‚         β”‚  (discord.js)    β”‚
β”‚                  β”‚         β”‚                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β”‚
                                      β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚   Node.js Backend         β”‚
                      β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
                      β”‚   β”‚ Bot Logic       β”‚     β”‚
                      β”‚   β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€     β”‚
                      β”‚   β”‚ Scheduler       β”‚     β”‚
                      β”‚   β”‚ (node-cron)     β”‚     β”‚
                      β”‚   β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€     β”‚
                      β”‚   β”‚ API Server      β”‚     β”‚
                      β”‚   β”‚ (Express :3001) β”‚     β”‚
                      β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β–Ό               β–Ό               β–Ό
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚ PostgreSQL β”‚  β”‚  Next.js   β”‚  β”‚  Discord   β”‚
         β”‚ (Prisma)   β”‚  β”‚  Dashboard β”‚  β”‚  OAuth     β”‚
         β”‚            β”‚  β”‚  :3000     β”‚  β”‚ (optional) β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Project Structure

schedule-bot/
β”œβ”€β”€ src/                      # Backend TypeScript
β”‚   β”œβ”€β”€ index.ts              # Entry point
β”‚   β”œβ”€β”€ api/                  # Express server + routes
β”‚   β”œβ”€β”€ bot/                  # Discord bot (commands, events, interactions)
β”‚   β”œβ”€β”€ jobs/                 # node-cron scheduler
β”‚   β”œβ”€β”€ repositories/         # Prisma data access layer
β”‚   β”œβ”€β”€ services/             # Business logic
β”‚   └── shared/               # Config, middleware, utils
β”œβ”€β”€ dashboard/                # Next.js frontend
β”‚   β”œβ”€β”€ app/                  # App Router pages
β”‚   β”œβ”€β”€ components/           # React components
β”‚   β”‚   β”œβ”€β”€ admin/            # Admin panel
β”‚   β”‚   β”œβ”€β”€ user/             # User portal
β”‚   β”‚   β”œβ”€β”€ shared/           # Shared components
β”‚   β”‚   └── ui/               # Radix UI primitives
β”‚   β”œβ”€β”€ hooks/                # Custom React hooks
β”‚   └── lib/                  # Utilities, API client, auth
β”œβ”€β”€ prisma/                   # Database schema + migrations
└── assets/                   # Logo, banner images

Discord Commands

User Commands

Command Description
/schedule [date] View team availability for a date
/schedule-week Show next 7 days overview
/my-schedule Your personal 14-day schedule
/set Set your availability interactively
/set-timezone Set your personal timezone
/set-recurring Set recurring weekly availability
/my-recurring View your recurring schedule
/view-scrims View recent match results
/scrim-stats View win/loss statistics

Admin Commands

Command Description
/post-schedule Post schedule to channel
/register @user Register user in database
/unregister @user Remove user mapping
/remind Send reminders manually
/notify Send notification to players
/poll Create quick poll
/add-scrim Add scrim result

Discord Bot Setup

  1. Go to Discord Developer Portal
  2. Click "New Application" β†’ Enter name β†’ "Create"
  3. Navigate to "Bot" tab β†’ "Add Bot"
  4. Copy the token β†’ Save as DISCORD_TOKEN
  5. Enable SERVER MEMBERS INTENT under Privileged Gateway Intents
  6. Navigate to "OAuth2" β†’ "URL Generator"
  7. Select scopes: bot, applications.commands
  8. Select permissions: View Channels, Send Messages, Embed Links, Add Reactions, Use Slash Commands, Read Message History
  9. Open the generated URL to invite the bot
  10. Copy your server ID (Developer Mode) β†’ Save as DISCORD_GUILD_ID

Database Setup

Local PostgreSQL

# Create database
psql -U postgres
CREATE DATABASE schedule_bot;
\q

# Configure DATABASE_URL in .env
DATABASE_URL="postgresql://postgres:password@localhost:5432/schedule_bot"

# Run migrations
npx prisma migrate deploy

# Optional: Open database GUI
npx prisma studio

Managed Services

Works with Railway, Supabase, Neon, or any PostgreSQL provider. Just set the DATABASE_URL connection string.


Deployment

One-Click Deploy (Railway)

Deploy on Railway

Deploys Backend + Frontend + PostgreSQL automatically.

Docker Compose

git clone https://github.com/jonax1337/schedule-bot.git
cd schedule-bot
cp .env.example .env
# Edit .env with your values
docker compose up -d

Manual Deployment

# Backend
npm run build
npm start

# Dashboard
cd dashboard
npm run build
npm start

Development

# Terminal 1: Backend (hot reload)
npm run dev

# Terminal 2: Dashboard
cd dashboard && npm run dev

# Terminal 3: Database GUI (optional)
npx prisma studio

Key Commands

npm run build              # Build backend
npm run dev                # Dev mode (rebuild + start)
npm test                   # Run tests
npm run test:coverage      # Tests with coverage
npm run db:generate        # Regenerate Prisma client
npm run db:migrate         # Run migrations (dev)
npm run db:studio          # Open Prisma Studio

Important Notes

  • ES Modules - All imports need .js extension (even for .ts files)
  • Date Format - Always use DD.MM.YYYY (e.g., "24.01.2026")
  • Availability Format - Empty = no response, "x" = unavailable, "HH:MM-HH:MM" = time window

API Documentation

The bot runs an Express REST API on port 3001.

Authentication

  • JWT-based (24h expiry)
  • Header: Authorization: Bearer <token>
  • Admin login: /api/admin/login
  • User login: /api/user/login or Discord OAuth

Key Endpoints

# Schedule
GET  /api/schedule/next14
POST /api/schedule/update-availability

# User Mappings
GET  /api/user-mappings
POST /api/user-mappings

# Scrims
GET  /api/scrims
POST /api/scrims
GET  /api/scrims/stats/summary

# Strategies
GET  /api/strategies
POST /api/strategies

# Actions (Admin)
POST /api/actions/schedule
POST /api/actions/remind
POST /api/actions/poll

# Monitoring
GET  /api/health
GET  /api/bot-status

Troubleshooting

Issue Solution
Bot doesn't respond Check token, permissions, and intents in Developer Portal
Database connection fails Verify DATABASE_URL format, test with npx prisma db pull
Dashboard can't connect Check NEXT_PUBLIC_BOT_API_URL, verify API is running
OAuth not working Verify redirect URI matches exactly in Developer Portal
Commands not registering Ensure GUILDS and GUILD_MEMBERS intents are enabled

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m "Add amazing feature"
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Guidelines

  • TypeScript strict mode is enabled
  • Use async/await for all database operations
  • Follow existing code style and patterns
  • Add tests for new features

License

This project is licensed under the MIT License.


Acknowledgments


Made with ❀️ for E-Sports teams

Stars

About

Discord Bot + Web Dashboard for E-Sports team scheduling

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages