Skip to content

Commit 75010ca

Browse files
committed
[skip ci] Clean up the docs
1 parent 708f2b7 commit 75010ca

File tree

4 files changed

+119
-68
lines changed

4 files changed

+119
-68
lines changed

CONTRIBUTING.md

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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.

README.md

+7-66
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,17 @@
1-
# rodhaj
1+
# Rodhaj
2+
3+
Transprogrammer's custom "ModMail" bot
4+
25
proto-repo for discord app
36

47
**later down the road, pls do not push to main branch directly**
58

69
## Stuff that needs to be done
710

811
- [x] Paginators
9-
- [ ] R. Danny migrations or asyncpg-trek
12+
- [x] R. Danny migrations or asyncpg-trek
1013
- [ ] The features
1114

12-
## Getting Started
13-
14-
### Preface on Slash Commands
15-
16-
Unlike other frameworks, discord.py does not automatically sync slash commands (if you want to learn more why, see [this and why Noelle is heavily against it](https://github.com/No767/Zoee#preface-on-slash-commands-and-syncing)). So the way to sync is by using an prefixed commands, which is [Umbra's Sync Command](https://about.abstractumbra.dev/discord.py/2023/01/29/sync-command-example.html). More than likely you'll need to read up on how this slash command works in order to get started. In short, you'll probably want to sync your test bot to the guild instead (as demostrated here):
17-
18-
```
19-
# Replace 1235 with your guild id
20-
r>sync 1235
21-
```
22-
23-
### PG Setup
24-
If you want to run postgres on an docker compose stack,
25-
then all you need to do is to make an `.env` file in the root of the repo,
26-
and add these:
27-
28-
```bash
29-
POSTGRES_PASSWORD=password
30-
POSTGRES_USER=user
31-
POSTGRES_DB=user
32-
```
33-
34-
The values above set up the root postgres user. Ideally you will want to make an new user, which can be done like so:
35-
36-
```sql
37-
CREATE ROLE rodhaj WITH LOGIN PASSWORD 'somepass';
38-
CREATE DATABASE rodhaj OWNER rodhaj;
39-
```
40-
41-
### Setup Instructions
42-
43-
You must have these installed:
44-
45-
- Poetry
46-
- Python
47-
- Git
48-
- PostgreSQL
49-
50-
1. Clone the repo or use it as a template.
51-
2. Copy over the ENV file template to the `bot` directory
52-
53-
```bash
54-
cp envs/dev.env bot/.env
55-
```
56-
3. Install the dependencies
57-
58-
```bash
59-
poetry install
60-
```
61-
62-
4. Configure the settings in the ENV (note that configuring the postgres uri is required)
63-
64-
5. Run the bot
65-
66-
```bash
67-
poetry run python bot/launcher.py
68-
```
69-
70-
6. Once your bot is running, sync the commands to your guild. You might have to wait a while because the syncing process usually takes some time. Once completed, you should now have the `CommandTree` synced to that guild.
15+
## Contributing
7116

72-
```
73-
# Replace 12345 with your guild id
74-
r>sync 12345
75-
```
76-
7. Now go ahead and play around with the default commands. Add your own, delete some, do whatever you want now.
17+
See [contributing](./CONTRIBUTING.md)

docker-compose-dev.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
container_name: Rodhaj-Postgres
66
image: postgres:15
77
env_file:
8-
- .env
8+
- bot/.env
99
volumes:
1010
- postgres_volume:/var/lib/postgresql/data
1111
ports:

envs/dev.env

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,12 @@ TOKEN=token
55
# IF YOU ARE RUNNING A PRODUCTION BUILD, SET THIS TO False!!
66
DEV_MODE=True
77

8+
# Docker PostgreSQL root credientials
9+
POSTGRES_USER=postgres
10+
POSTGRES_PASSWORD=password
11+
12+
# Account for the rodhaj user on PostgreSQL
13+
RODHAJ_PASSWORD=password
14+
815
# PostgreSQL URI string
9-
POSTGRES_URI=postgresql://user:password@localhost:5432/user
16+
POSTGRES_URI=postgresql://user:password@localhost:5432/user

0 commit comments

Comments
 (0)