|
| 1 | +# Contributing |
| 2 | + |
| 3 | +This document goes over the process of contributing, and the setup instructions. |
| 4 | + |
| 5 | +## Development |
| 6 | + |
| 7 | +### Software Requirements |
| 8 | + |
| 9 | +- Git |
| 10 | +- Poetry |
| 11 | +- Python |
| 12 | +- Docker |
| 13 | +- Discord Account + App |
| 14 | + |
| 15 | +> [!WARNING] |
| 16 | +> Rodhaj is natively developed on Linux, and is known to work on Linux and MacOS. |
| 17 | +> Development should work on Windows but is highly untested. |
| 18 | +
|
| 19 | +### Setup Instructions |
| 20 | + |
| 21 | +1. Ensure that you have a separate development bot and server before continuing. |
| 22 | + |
| 23 | +2. Fork and clone the repo |
| 24 | + |
| 25 | + ```bash |
| 26 | + git clone https://github.com/[username]/rodhaj |
| 27 | + ``` |
| 28 | + |
| 29 | + Alternatively, you can use the `gh` tool to clone the repo: |
| 30 | + |
| 31 | + ```bash |
| 32 | + gh repo clone https://github.com/[username]/rodhaj |
| 33 | + ``` |
| 34 | + |
| 35 | +> [!NOTE] |
| 36 | +> Ensure that you are in the cloned repo before continuing |
| 37 | + |
| 38 | +3. Copy the ENV template into the `bot` directory |
| 39 | + |
| 40 | + ```bash |
| 41 | + cp envs/dev.env bot/.env |
| 42 | + ``` |
| 43 | + |
| 44 | +4. Install the dependencies |
| 45 | + |
| 46 | + ```bash |
| 47 | + poetry install |
| 48 | + ``` |
| 49 | + |
| 50 | +5. Configure the settings in the ENV file (Note that the user that is created in the Docker container is `rodhaj`) |
| 51 | + |
| 52 | +6. Run the migrations |
| 53 | + |
| 54 | + If this is the first time setting up the PostgreSQL server: |
| 55 | + |
| 56 | + ```bash |
| 57 | + poetry run python bot/migrations.py init |
| 58 | + ``` |
| 59 | + |
| 60 | + If you are already have migrations set, then upgrade: |
| 61 | + |
| 62 | + ```bash |
| 63 | + poetry run python bot/migrations.py upgrade |
| 64 | + ``` |
| 65 | + |
| 66 | +7. Launch the bot |
| 67 | + |
| 68 | + ```bash |
| 69 | + poetry run python bot/launcher.py |
| 70 | + ``` |
| 71 | + |
| 72 | +> Where are the slash commands? See the [FAQ](CONTRIBUTING.md#-Where-are-the-slash-commands?) |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +### PostgreSQL Setup (If you are not using Docker) |
| 77 | + |
| 78 | +If you are not using Docker, then you'll need to manually create and set up the database. |
| 79 | +The following SQL queries set up the user and database |
| 80 | +
|
| 81 | +```sql |
| 82 | +CREATE ROLE rodhaj WITH LOGIN PASSWORD 'somepass'; |
| 83 | +CREATE DATABASE rodhaj OWNER rodhaj; |
| 84 | +``` |
| 85 | +
|
| 86 | +You'll need to activate the `pg_trgm` extension within the `rodhaj` database. |
| 87 | + |
| 88 | +```sql |
| 89 | +CREATE EXTENSION IF NOT EXISTS pg_trgm; |
| 90 | +``` |
| 91 | + |
| 92 | +## FAQ |
| 93 | + |
| 94 | +### Where are the slash commands? |
| 95 | + |
| 96 | +> TL;DR |
| 97 | +> Manually sync using Umbra's Sync Command (`r>sync <guild_id`) |
| 98 | +
|
| 99 | +Unlike other frameworks, discord.py **does not** automatically sync slash commands to Discord. |
| 100 | +Slash commands are commands that need to be sent to Discord, and they take care of the rest. |
| 101 | +As a result, you'll need to manually sync using [Umbra's Sync Command](https://about.abstractumbra.dev/discord.py/2023/01/29/sync-command-example.html), |
| 102 | +which is included in the bot. |
| 103 | +See [this gist](https://gist.github.com/No767/e65fbfdedc387457b88723595186000f) for more detailed information. |
0 commit comments