Public Discord communities struggle to quickly and accurately answer user questions, especially with a constant flow of new users asking the same questions repeatedly.
HorDoc learns from previous support channel conversations to reduce the repetitive workload on community members, speed up response times, and enhance the user experience for both new and existing users seeking help in your community.
To install and run HorDoc locally, you need at least Python 3.9 and a couple Python libraries which you can install with pip
.
git clone https://github.com/hordoc/hordoc-bot.git
cd hordoc-bot
Recommended: Take a look at pipenv. This tool provides isolated Python environments, which are more practical than installing packages systemwide. It also allows installing packages without administrator privileges.
Then install the HorDoc package (with its Python dependencies, this will take a while):
pip3 install -e .
Copy the example environment variables from .env.sample
to .env
and customize them to your needs. These include your Discord authentication token, guild, forum and channel IDs and database filename.
Run the bot via:
hordoc bot data/mydb.db
To list all available commands:
hordoc --help
Development of HorDoc takes place in the hordoc-bot GitHub repository.
All improvements to the software should start with an issue. Read our Motivation for design / architecture decisions
To work on this library locally, first checkout the code. Then create a new virtual environment:
git clone git@github.com:hordoc/hordoc-bot
cd hordoc-bot
python3 -mvenv venv
source venv/bin/activate
Or if you are using pipenv:
pipenv shell
Within the virtual environment running hordoc-bot
should run your locally editable version of the tool. You can use which hordoc-bot
to confirm that you are running the version that lives in your virtual environment.
To install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
hordoc-bot
uses Black for code formatting, and flake8 and mypy for linting and type checking.
Black is installed as part of pip install -e '.[test]'
- you can then format your code by running it in the root of the project:
black .
To install mypy
and flake8
run the following:
pip install -e '.[flake8,mypy]'
Both commands can then be run in the root of the project like this:
flake8
mypy hordoc
All three of these tools are run by our CI mechanism against every commit and pull request.
If you install Just and pipenv you can use them to manage your local development environment.
To create a virtual environment and install all development dependencies, run:
cd hordoc-bot
just init
To run all of the tests and linters:
just
To run tests, or run a specific test module or test by name:
just test # All tests
just test tests/test_data.py # Just this module
just test -k test_dt_to_ms # Just this test
To run just the linters:
just lint
To apply Black to your code:
just black
And to list all available commands:
just -l
If you have any questions or feedback, join us on Discord
This project is sponsored by the AI Horde