Skip to content

Rhythmic-Ocean/TruMeals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TruMeals Discord Bot

Docs Status

Invite the Bot

Join Test Server

A meal recommender discord bot for Truman Students Dining at Missouri and Ryle Hall


Features

  • Real-time Menu Integration – Fetches and parses live daily menus from Missouri and Ryle Dining Halls.
  • Automated Dietary Filtering – Automatically excludes items based on user's diet restrictions in profile (eg: Vegan, Lactose Intolerance etc...).
  • Gemini AI Recommendations – Leverages Google’s Pro model to suggest optimal meal combinations within given filtered menu
  • Nutritional Profiling – Calculates users BMR and TDEE using the Mifflin-St Jeor Equation and finds optimal caloric consumption per day
  • Supports Meal Splitting – Supports custom caloric distributions like Balanced, Skip Breakfast, or Heavy Dinner.
  • Data Management – Uses Supabase (PostgreSQL) for secure storage of user physical stats and health constraints.
  • Asynchronous Cog Architecture – Built with discord.py Cogs and asyncio for non-blocking database and API operations.
  • Interactive Multi-Step Signup – Employs a robust discord.ui View system with validation for sign ups.

Commands (Help Menu)

TruMeals uses slash commands to provide a clean and interactive experience. Here is a breakdown of what you can do:


/sign_up

  • Link your Discord account to the TruMeals database and set up your nutritional profile.
  • Launches a multi-step interface to collect age, weight, height, and activity levels.
  • Allows you to select dietary restrictions (Vegan, Vegetarian, etc.) and specific allergens.

/profile

  • View your personalized nutritional dashboard.
  • Displays your current recorded age, weight, and height.
  • Shows your calculated TDEE (Total Daily Energy Expenditure) based on your fitness goals.
  • Breaks down calorie targets for each meal (e.g., Breakfast, Lunch, Dinner) according to your chosen split.

/meal [hall] [when] [meal_type]

Get a personalized AI-generated meal recommendation based on your profile and live dining hall menus.

  • hall: Choose the Dining Hall (Missouri or Ryle Hall).
  • when: Select the menu date (Today or Tomorrow).
  • meal_type: Select the specific meal (Breakfast, Lunch, or Dinner).

Example: /meal hall:Ryle when:Today meal_type:Dinner


/delete

Permanently wipe your data from the TruMeals database.

  • This action is irreversible and removes all physical stats, dietary preferences, and account links.

/help

Displays an interactive help menu with a quick overview of all available commands and bot features.


Project Structure


├── bot.py
├── cogs
│   ├── meal.py -> implemented /meal
│   ├── profile.py -> implemented /profile and /help
│   └── sign_up.py -> implemented /sign_up and /delete
├── load_env.py
├── requirements.txt
├── sec.env
└── utils
    ├── ai_eval.py
    ├── db_handler.py
    ├── enums.py
    ├── fetch_data.py
    ├── filter_data.py
    ├── food_item.py
    ├── __init__.py
    ├── renderer.py
    └── user_profile.py

Stuff Used

  • Python 3.12+
  • Discord.py – Discord bot framework
  • Supabase – Realtime Postgres database
  • asyncio – Async tasks, loops, polling
  • Sodexo-API - Through it's website's network tab

Deployment Overview

Component Role Deployment
bot.py Main Discord bot runtime RailWay (Bot Host)

Local Setup(Linux/ MacOS)

Follow these steps to get a development instance of TruMeals running locally.

Prerequisites

  • Git
  • A Supabase project (Free tier works)
  • Discord Application (Bot Token + Client ID)
  • Sodexo API, you can just scrape it from one of their websites displaying menues

1. Fork & Clone

Fork the repository to your GitHub account, then clone it to your local machine:

# Replace 'YOUR_USERNAME' with your GitHub username
git clone [https://github.com/YOUR_USERNAME/TruMeals.git]
cd TruMeals

2. Configuring .env

Create a file named sec.env in the root directory. Copy and paste the following template, filling in your specific API keys:

# --- External APIs (Data Fetching) ---
SODEXO_API_KEY=     # Extracted from Truman's Dining site; used for daily menu JSON.
GEMINI_URL=         # Full Google AI endpoint (API Key already appended).

# --- Discord Configuration ---
DISCORD_TOKEN=      # Private bot token from the Discord Developer Portal.
TRUMEALS_ID=        # The Guild (Server) ID for development and testing.

# --- Database (Supabase) ---
SUPABASE_URL=       # Your specific Supabase project API URL.
SUPABASE_KEY=       # The public 'anon' key for database access and auth.

3. Database Initialization

  1. Log in to your Supabase Dashboard.

  2. Go to the SQL Editor.

  3. Open the file utils/schema.txt located in the root of this repository and run it on Table Editor in SupaBase

4. Running the Bot


pip install -r requirements.txt

python bot.py


About

A meal recommender discord bot for Truman Students Dining at Missouri and Ryle Hall

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages