ORE's Discord bot. Built as a replacement for Chad.
Patrick uses the following software:
- Python 3.12
- Any python environment manager (I personally use pipenv) or bluildah/podman to run as a container
- Go to the Discord Developer Portal.
- Click "New Application" and give it a name.
- Navigate to "installation", uncheck "User install" and set "Install link" to "None".
- Go to the "Bot" tab, disable "Public Bot" and enable all 3 intents (Presence, Server Members, and Message Content).
- Click "Reset Token" to generate a bot token. Copy this token somewhere safe as we will need it later.
- Go to the "OAuth2" tab, select "bot" and "applications.commands" under "Scopes", and then select the permissions you want to grant the bot. For ease of testing, you can select "Administrator" to give it all permissions. However, for production use, you should only select the permissions that are necessary for the bot to function.
- Copy the generated URL at the bottom and paste it into your browser to invite the bot to your server.
-
Clone the repository:
git clone github.com/openRedstoneEngineers/patrick.git
-
Navigate to the cloned directory:
cd patrick
-
Copy the example
.env.example
file to.env
:cp .env.example .env
-
Open the
.env
file in a text editor (like nano or vim) and paste your bot token right after theTOKEN=
line. It should look like this:TOKEN=abcdefghijklmnopqrstuvwxyz1234567890
-
Save the
.env
file. -
Copy over the
config.example.yaml
toconfig.yaml
:cp config.example.yaml config.yaml
-
Open the
config.yaml
file in a text editor and adjust any settings as needed. You will need to set the channels and roles correctly for your bot to start without errors. The other configurations can be left as default for now. -
Install the dependencies. If using pip, the following command will install the required packages:
pip install -r requirements.txt
If you are using any python environment manager, you can use the equivalent command to install the dependencies from the requirements.txt
file.
To run Patrick, you can use the following command, assuming you are in the root directory of the project and have set up your environment correctly:
python patrick.py
NOTE: If you are using a virtual environment, make sure to activate it before running the command.
Build with buildah:
buildah bud -t patrick .
Run the container:
podman run -d --name patrick \
--env-file .env \
-v $(pwd):/app:Z \
localhost/patrick
NOTE: Pushing changes to a deployed instance requires removing the patrick
container, rebuilding Patrick, then rerunning it.
For deployment, create a systemd unit file:
podman generate systemd --name patrick \
--restart-policy=always \
--restart-sec=5 > patrick.service
Finally, save this unit file in the appropriate location and enable the service with the following commands:
sudo mv patrick.service /etc/systemd/system/
sudo systemctl enable patrick
sudo systemctl start patrick