This is a Discord bot that fetches the daily lunch menu from the 61an Gastrogate Website and provides it in a Discord server through various commands.
This project was developed as part of a Hackathon (light-version) held at Nackademin, on 2024-10-14. It was a collaborative effort to create a Discord bot that scrapes and displays daily lunch menus from Sodexo's Restaurant 61:an at Karolinska University Hospital.
- Fetch lunch menus for each weekday:
!monday
- Get Monday's lunch menu.!tuesday
- Get Tuesday's lunch menu.!wednesday
- Get Wednesday's lunch menu.!thursday
- Get Thursday's lunch menu.!friday
- Get Friday's lunch menu.!today
- Get today's lunch menu.
- Admin Commands:
!shutdown
- Shuts down the bot (admin only).!restart
- Restarts the bot (admin only).
- Easy setup: Uses environment variables to keep your bot token secure.
- Web scraping: Uses BeautifulSoup to scrape lunch menu data from 61an Gastrogate.
Make sure you have the following installed:
- Python 3.7+
- Discord Developer Portal account to create a bot and obtain your bot token.
-
Clone the repository:
git clone https://github.com/hdm-py/lunch_bot cd lunch_bot
-
Create a virtual environment:
python -m venv venv source venv/Scripts/activate
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.env
file in the root of the project and add your Discord bot token:DISCORD_TOKEN=your_discord_bot_token
-
Run the bot:
python main.py
The bot responds to the following commands:
Command | Description |
---|---|
!monday |
Fetches Monday's lunch menu. |
!tuesday |
Fetches Tuesday's lunch menu. |
!wednesday |
Fetches Wednesday's lunch menu. |
!thursday |
Fetches Thursday's lunch menu. |
!friday |
Fetches Friday's lunch menu. |
!today |
Fetches today's lunch menu. |
!shutdown |
Shuts down the bot (admin only). |
!restart |
Restarts the bot (admin only). |
The bot scrapes the lunch menu from 61an Gastrogate using the BeautifulSoup library. It fetches the menu data for each day and responds in Discord when the respective command is used.
!monday
!today
Here are a few sample images:
Restaurang 61:an
- Address: Karolinska Universitetssjukhuset, Plan 6, C161, 141 86 Stockholm
- Phone: 08-58580046
- Website: 61an.sodexo.se
Opening Hours:
- Weekdays: 10:30 - 14:00
- Café Bakery: 09:00 - 14:00
main.py
: Contains the bot logic and command handling.response.py
: Responsible for fetching and processing the lunch menu via web scraping.
- discord.py - A Python wrapper for the Discord API.
- beautifulsoup4 - A library to extract data from HTML and XML files.
- requests - A simple HTTP library for Python.
This project was created by:
- Alfred - Co-Founder: Contributed to the development, design, and implementation of functionalities for the Discord bot, including web scraping and integration of the restaurant menu.
- Haidar - Co-Founder: Contributed to the development, design, and implementation of functionalities for the Discord bot, including web scraping and integration of the restaurant menu.
- Robert - Co-Founder: Contributed to the development, design, and implementation of functionalities for the Discord bot, including web scraping and integration of the restaurant menu.
This project is licensed under the MIT License - see the LICENSE file for details.