Skip to content

lii4ee/f1-prediction-BOT-Discord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README generated by GPT.

F1 Prediction Discord Bot

A Discord bot for managing Formula 1 race predictions, leaderboards, and race history in your server. Users can submit their top 5 driver predictions for each race, view their own and others' predictions, and see a points-based leaderboard. Admins can manage prediction rounds and the driver roster.


Features

  • Prediction Rounds: Admins start and end prediction rounds for each race.
  • User Predictions: Users submit their top 5 driver predictions using slash commands.
  • Leaderboard: Points are awarded based on prediction accuracy, and a leaderboard is maintained.
  • Race History: View completed races and detailed results.
  • Driver Management: Admins can add or remove drivers from the roster.
  • Persistent Storage: All data is saved in JSON files.

Commands

For Everyone

  • /predict pos1 pos2 pos3 pos4 pos5
    Submit your top 5 driver predictions (by driver number).

  • /my_prediction
    View your current prediction for the active race.

  • /status
    Check if there's an active prediction and who has submitted.

  • /leaderboard
    View the overall points leaderboard.

  • /race_history
    List all completed races.

  • /race_history_details race_name
    View details for a specific completed race.

  • /list_drivers
    List all available drivers and their numbers.

  • /help
    Show help and usage instructions.

Admin Only

  • /start_prediction race_name
    Start a new prediction round.

  • /end_prediction pos1 pos2 pos3 pos4 pos5
    End the prediction round and submit actual results (by driver number).

  • /add_driver number name
    Add a driver to the roster.

  • /remove_driver number
    Remove a driver from the roster.

  • /clear_prediction
    Force clear the active prediction.


Setup

1. Clone the Repository

git clone https://github.com/yourusername/f1-prediction-BOT-Discord.git
cd f1-prediction-BOT-Discord

2. Install Dependencies

pip install -r requirements.txt

3. Create a .env File

Create a .env file in the project root with your Discord bot token:

DiscordAPIToken=YOUR_DISCORD_BOT_TOKEN

Never commit your .env file or bot token to version control!

4. Run the Bot

python main.py

Data Files

  • f1_predictions.json — Stores predictions, leaderboard, and race history.
  • drivers.json — Stores the list of available drivers.
  • .env — Stores your Discord bot token (not tracked by git).

Example Driver List

See drivers.json for the current roster. Add or remove drivers using the admin commands.


Points System

Points are awarded for each predicted driver based on how close their predicted position is to the actual result:

  • Exact position: 10 points
  • 1 position off: 7 points
  • 2 positions off: 5 points
  • 3 positions off: 3 points
  • 4 positions off: 1 point

Credits

Created by Angelo Alexander.
Inspired by the excitement of Formula 1!

About

This project is a Discord bot for managing Formula 1 race predictions in a server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages