ElysianCat's Discord Bot Template is a lightweight, highly customizable template designed for building Discord bots.
While it doesn't come with pre-built features like moderation or entertainment commands, it provides a robust foundation with advanced logging, utilities, and a modular structure.
This makes it perfect for developers who want to create a bot tailored to their specific needs without starting from scratch.
- Advanced Logging: Configurable multi-channel logging with JSON configuration.
- Environment Management: Secure token handling with
.env
files. - Dev/Prod Ready: Built-in support for different environments.
- Utilities: A collection of useful utility functions and decorators to simplify development.
- Extensible: Designed to be easily extended with new features and integrations.
- Python 3.13 or newer.
- A Discord bot token (obtained from the Discord Developer Portal).
discord.py
library installed (pip install discord.py
).
-
Clone the repository:
git clone "https://github.com/CatsSomeCat/ElysianCat-s-Discord-Bot-Template.git"
-
Navigate to the project directory:
cd ElysianCat-Discord-Bot-Template
-
Install dependencies:
pip install -r requirements.txt # If using pip
poetry install # If using poetry
-
Run the bot:
python main.py
Note: Depending on your system configuration, you may need to replace
python
with the appropriate Python command, such aspy
,python3
,python3.13
, or another version-specific command. To check which Python versions are installed, run:python --version python3 --versionEnsure you use the correct command that corresponds to the required Python version (3.13 or higher) for this project.
-
Environment Configuration:
- Rename
.example.env
to.env
. - Add your Discord bot token, application ID, and other necessary details in the
.env
file.
- Rename
-
Logging Configuration:
- Rename
logging_config.example.json
tologging_config.json
. - Customize the logging settings in the
logging_config.json
file to suit your needs.
- Rename
-
Bot Configuration:
- Rename
config.example.json
toconfig.json
. - Modify the settings in the
config.json
file to configure the bot according to your preferences.
- Rename
Customize logging_config.json
to tailor the logging behavior to your needs. Here's what you can configure:
- File Logging Paths: Specify where log files are saved.
- Log Levels: Set different log levels (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL).
- Formatting Styles: Customize the format of log messages (e.g., timestamp, log level, message).
- Rotation Policies: Configure log file rotation based on size, time or even both simultaneously.
simple
: Basic log format for file logging.colorized
: Colorized log format for console output.discord_embed
: Formats logs into Discord embed messages.JSONLFormatter
(unused): Formats logs into JSON Lines (JSONL) format.
console
: Outputs logs to the console.file
: Writes logs to a file with rotation support.discord
: Sends logs to a Discord channel via a webhook.
The bot includes custom handlers and formatters located in logging_.handlers
and logging._formatters
:
__all__ = (
"DualRotatingHandler",
"JSONLFileHandler",
"DiscordWebHookHandler",
)
__all__ = (
"ColorizedFormatter",
"JSONLFormatter",
"DiscordEmbedLoggingFormatter",
)
{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"standard": {
"format": "%(asctime)s - %(levelname)s - %(message)s"
}
},
"handlers": {
"file_handler": {
"class": "logging.handlers.RotatingFileHandler",
"filename": "logs/bot.log",
"maxBytes": 10485760,
"backupCount": 5,
"formatter": "standard"
},
"console_handler": {
"class": "logging.StreamHandler",
"formatter": "standard"
}
},
"loggers": {
"": {
"handlers": ["file_handler", "console_handler"],
"level": "INFO",
"propagate": true
}
}
}
We use CalVer for versioning. CalVer is a versioning scheme based on project release dates, making it easy to track when a version was released and how old it is. See the tags on this repository.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch (git checkout -b feature-branch).
- Commit your changes (git commit -m "Add new feature").
- Push to the branch (git push origin feature-branch).
- Open a Pull Request.
This project is licensed under the MIT License. See LICENSE for details.
Join our Discord community for support, updates, and discussions!
- Get help: Ask questions and troubleshoot issues with the community.
- Share ideas: Suggest new features or improvements.
- Stay updated: Be the first to know about new releases and updates.
If you find this project helpful, consider supporting its development! Your donations help keep the project alive and improve its features.
- Coming Soon: We're working on setting up donation options. Stay tuned for updates!
- Support Us: In the meantime, you can support us by starring the repository, sharing it with others, or contributing code.
Every contribution, no matter how small, is greatly appreciated! Thank you for your support.