How olliequ/kittybot works
Main Components
• Bot Core (bot.py): This is the entry point that initializes the Discord bot and ties all modules together.
• Commands Module (commands folder): Contains individual Python files that implement various slash and text commands (e.g., /ping, /fortune, /translate, etc.). Each file represents a command’s logic.
• Behaviours Module (behaviours folder): Implements background or ongoing actions that the bot performs on events (e.g., auto-assigning roles, duplicate message policing, meme repost blocking, etc.).
• Common Utilities (commons folder): Implements shared utilities such as handling message formatting, emoji caching, or any common internal logic.
• Database/State Management (db.py): Manages persistence. Although the specifics aren’t deeply detailed, this component is responsible for storing data like user stats or message counts.
• External Assets & Resources: Includes additional assets such as the JSON file (e.g., pickuplinesgalore.json in the assets folder), fonts, and images. These support the bot’s functionality and UI elements when needed.
• Environment & Configuration (e.g., .env file, pyproject.toml, Dockerfile, docker-compose.yaml): These files provide deployment and runtime configuration, including sensitive variables like bot tokens, guild IDs, and other parameters.
• Testing (tests folder): Contains the test cases that ensure functionality remains correct as the project evolves.
Mapping Out Relationships and Interactions
• The Bot Core in bot.py initializes the client and registers both commands and behaviours.
• When a Discord event is received (like a user command or message), control flows from the core to the relevant command module or behaviour module.
• The commands module interacts with the commons utilities to process data, generate responses, and sometimes query/update persistent data via the database component.
• The behaviours module listens to ongoing events (like message events, image uploads) and may interact with external assets (e.g., using the pickuplines JSON or interfacing with third-party APIs such as for fortunes or translations).
• Dockerfiles and docker-compose.yaml illustrate how the service is containerized and deployed in a production/cloud setting.
• The Github workflows and configuration files show continuous integration (using Black and Pyright) enforcing code style and type checking.
Highlighted Architectural Patterns and Design Principles
• Modularity: Clear separation of concerns where commands and behaviours are split into their own modules.
• Extensibility: The README encourages adding new commands as new Python files (e.g., placing new command files in an “extensions” folder – not shown in the file tree but suggested), facilitating team contributions.
• Configuration/Environment Separation: Use of environment variables (via .env file) ensures deployment-time separation from code logic.
• Docker-based Deployment: The Dockerfile and docker-compose.yaml indicate containerization which is useful for deployment and scaling.
Including Key Technologies and Libraries
• Hikari & Lightbulb: Primary libraries used for Discord interactions and command handling.
• Python 3.11: The required runtime environment.
• Docker: For containerization, as shown by Dockerfile and docker-compose files.
• External tools: The fortunes package for the /fortune command, and potentially BeautifulSoup (mentioned in further ideas) for web scraping tasks.