Borg is a modular discord bot that hopes to provide a lot of features that are helpful on University discord servers. It allows users to display their program applications, lookup a course, and allows server administrators to create custom commands and welcome messages.
And a few other small libraries that can be found in requirements.txt.
Borg uses a Postgresql database that you'll need to setup on the machine you use to develop.
- Install Postgresql -> Download
- Change the password of the default
postgresql
username:
sudo -u postgres psql
ALTER USER postgres WITH PASSWORD 'newpasswordhere';
# Ensure the result is ALTER ROLE
- Place the database's password in the .env file
- Start the database:
sudo service postgresql start
# Result will be similar to: * Starting PostgreSQL 13 database server
- Note your server's port using
sudo service postgresql status
. The output will be similar to:13/main (port 5433): online
. Place the port in the .env file. You could also run:sudo netstat -plunt |grep postgres
to get an output of what port(s) postgresql is listening to. - NOTE: You can shut down the Postgresql server with
sudo service postgresql stop
- Install Python.
- Clone the repository:
git clone https://github.com/joshuajz/Borg
- Install pipenv
pip3 install pipenv
- Install the project's requirements: dev version:
pipenv install --dev
or if you're planning to run Borg as a server, you'll only need:pipenv install
- If you're developing, you'll now have a virtual environment that you can enable with
pipenv shell
A .env
file should be in your project's directory with the following setup:
bot_token =
broadcast_token =
database_password =
database_port =
waterloo_api =
bot_token
- The token found on your bot's discord developer portal.
broadcast_token
- Only used for message_all_servers.py
database_password
- The password to the postgresql
user for your database
database_port
- The port that your database runs on, found with sudo service postgresql status
waterloo_api
- A Waterloo API key used to pull courses from Waterloo.
- Create your own test discord server (press the + at the bottom of your servers list or see here).
- Create a Discord Application (Click Applications -> New Application).
- Once in your application, click on the
Bot
tab and scroll slightly to thePrivileged Gateway Intents
section. SelectPRESENCE INTENT
andSERVER MEMBERS INTENT
for your test bot. - Now we're going to create an invite, click on
OAuth2
, selectbot
andapplications.commands
in theSCOPES
section. Then in theBOT PERMISSIONS
section select theAdministrator
permission (it's easier for a test bot to have all permissions). - Using that invite link, invite your test bot to the discord server you created. You should see your test bot as an offline member.
- Under the
Bot
tab in the Discord Developer Portal there should be aToken
, select theCopy
button. - Add your token to your bot's .env file
- Run
python3 main.py
from a terminal.