HoloBot Discord
Small Discord bot made on Py-Cord
Installation from release
- Install MongoDB using the official installation manual
- Install Python 3.11+
- Download the latest release's archive
- Extract the archive
- Navigate to the extracted folder and subfolder
Discord
in it - Create a virtual environment:
python -m venv .venv
orvirtualenv .venv
- Activate the virtual environment:
Windows:.venv\Scripts\activate.bat
Linux/macOS:.venv/bin/activate
- Install the dependencies:
python -m pip install -r requirements.txt
- Run the bot with
python main.py
after completing the configuration
Installation with Git
- Install MongoDB using the official installation manual
- Install Python 3.11+
- Clone the repository:
git clone https://git.end-play.xyz/HoloUA/Discord.git
cd Discord
- Create a virtual environment:
python -m venv .venv
orvirtualenv .venv
- Activate the virtual environment:
Windows:.venv\Scripts\activate.bat
Linux/macOS:.venv/bin/activate
- Install the dependencies:
python -m pip install -r requirements.txt
- Run the bot with
python main.py
after completing the configuration
Upgrading with Git
- Go to the bot's directory
git pull
- Activate the virtual environment:
Windows:.venv\Scripts\activate.bat
Linux/macOS:.venv/bin/activate
- Update the dependencies:
python -m pip install -r requirements.txt
- First start after the upgrade must initiate the migration:
python main.py --migrate
- Now the bot is up to date and the next run will not require
--migrate
anymore
Configuration
There's a file config_example.json
which contains default configuration
and should be used as a base config.
Copy this file to config.json
and open it with any text editor of your liking.
Modify the newly created configuration file to fit your needs.
Mandatory keys to modify:
- guild
- bot.owner
- bot.bot_token
- database.*
- categories.*
- channels.*
- roles.*
After all of that you're good to go! Happy using :)
Caching
Although general database access speed is fast, caching might become helpful for bigger servers with many bot interactions. Currently, Redis and Memcached are supported.
Configuration happens through the config key caching
.
Set caching.type
to the service of you choice ("redis" or "memcached") and then update
the URI to access the service. It's Redis' default URI format for Redis and "address:port"
for Memcached.
Which one should I choose?
Service | Read/write speed | Config flexibility |
---|---|---|
Redis | High | Very flexible |
Memcached | Very high | Basic |
Performance difference between Redis and Memcached is generally quite low, so your setup should normally depend more on the configuration flexibility than on raw speed.
Debugging
There's a config key debug
that can be set to true
for debugging purposes.
It should be set to false
in production, otherwise log becomes very verbose and might
contain data that shouldn't normally be logged.
Docker [Experimental]
As an experiment, Docker deployment option has been added.
Building the image
git clone https://git.end-play.xyz/HoloUA/Discord.git
cd Discord
docker build -t holoua-discord .
Starting the bot
- Install MongoDB using the official installation manual
- Download the configuration example file and store it somewhere you would like your bot to access it
- Complete the configuration step for this file
docker run -d -v /path/to/config.json:/app/config.json holoua-discord