Setting Up Your Development Environment - TYPOStudios/server-duels GitHub Wiki
Introduction
This wiki page is for developers contributing to Server Duels. This is a guide for how developers should set up their development environments and what tools they need to have installed in order to contribute to this project.
Prerequisites
First thing's first, contributing to Server Duels will be easiest on a Linux machine. Though it is possible over a Windows or Mac computer, there will be no Wiki pages giving guidance on how to contribute with one. If you are using a Windows machine, take advantage of the Windows Subsystem for Linux (WSL) they offer and contribute to Server Duels on that.
Since Server Duels is a Discord bot, evidently you will need a Discord account as well. It is recommended to download Discord and use the installed version on your machine rather than it's web interface for development, but either will work.
Lastly, you will need a configured SSH key on your GitHub account in order to properly clone the Server Duels repository onto your Linux machine. If you are working in Windows, you can utilize the HTTPS link to clone the repository.
Setup
You can either setup your environment manually or use the bash scripts provided in the scripts
directory of the Server Duels repository. It is recommended to use the env_setup.sh
script, but the manual directions will be provided for those who insist otherwise. There is some initial manual work needed either way including creation of a dev
directory, cloning the repository, and retrieving a Discord bot token.
- Create a
dev
directory in your/home/$USER
directory if you do not already own one.
cd ~
mkdir dev
- Clone the Server Duels repository into your
dev
directory.
cd /home/$USER/dev
git clone [email protected]:TYPOStudios/server-duels.git server-duels
-
Navigate to the Discord Developer Portal Applications Tab, sign in with your Discord account credentials, and select the
New Application
button. -
Name the application something along the lines of
{Your Name}'s Server Duels Bot
. -
Navigate to the
Bot
tab and select theReset Token
button. Take note of the Discord token that appears, we will be using this in future steps.
This is now where the setup becomes either automatic or manual.
Automatic
- Navigate to the
scripts
directory of the repository. - Execute the
env_setup.sh
script. You may have to give executable permissions to the file withchmod +x env_setup.sh
. - Run
poetry install
at the root level of the repository.
Manual
- Add the following values to the bottom of your
.bashrc
file
#Server Duels Environment Variables
export DEV_DIR=/home/$USER/dev
export SERVER_DUELS_DIR=$DEV_DIR/server-duels
- Refresh your terminal so that it knows about these new environment variables. For WSL users, I've notice that this command doesn't always work, so simply exit WSL and relaunch it for the variables to be recognized.
source /home/$USER/.bashrc
- Install the necessary system level dependencies.
sudo apt-get install python3 python3-pip
- Pip install the
poetry
Python module.
pip install poetry
- Run
poetry install
at the root level of the Server Duels repository to handle other Python module dependencies.