Back to Projects
Logistics Bot
Logistics-Bot is a Discord bot designed to assist with logistics, player management, and roster lookup by integrating Discord with Google Sheets. It provides quick and easy access to formatted data pulled directly from live spreadsheets, empowering users to find the information they need through slash commands.
Features
- Google Sheets Integration: Seamlessly fetches live data from Google Sheets, returning it to users in clearly formatted, easily digestible views.
- Fuzzy Search: Implements intelligent string matching to handle player name typos, ensuring users find correct roster information even if they don't type a name exactly right.
- Caching Mechanism: Employs an intelligent caching architecture to prevent hitting Google Sheets API rate limits and deliver snappy responses for frequent requests. Includes commands to manually clear the cache.
- Centralized Logging: Detailed structured logging across the application for reliable production observability and debugging.
- Environment Management: Multi-environment support (Live and Test modes) using localized configuration variables.
Commands
/roster-position [name] Fetches and displays the specific roster position of a given player.
/roster-bannermen [name] Retrieves and lists the bannermen attached to a specific player.
/clear-roster-cache Clears the locally cached roster data, forcing the next command to pull fresh data from the Google Sheet.
Tech Stack
- Python 3: The core language used for the backend logic.
- discord-py-interactions: The framework used for robust Discord integration, particularly for the implementation of modern Next-Gen Slash Commands.
- gspread & oauth2client: Used for authenticating and establishing connections with the Google Sheets API to read roster configurations.
- rapidfuzz: High-performance string matching library, used to implement fuzzy searches for player names.
- python-dotenv: Manages bot tokens and system environment variables securely outside the codebase.
Architecture
- index.py: Core entry point and event loop initialized for the bot client.
- /commands/: Isolated handlers for Discord slash commands.
- /utils/: Reusable helper functions including the centralized logger and search utilities.
- /config/ & /globals/: Global application state, constants, and shared configurations.