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.

Install WSL

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.

Download Discord

Create Your Discord Account

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.

Set Up an SSH Key

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.

  1. Create a dev directory in your /home/$USER directory if you do not already own one.
cd ~
mkdir dev
  1. Clone the Server Duels repository into your dev directory.
cd /home/$USER/dev
git clone [email protected]:TYPOStudios/server-duels.git server-duels
  1. Navigate to the Discord Developer Portal Applications Tab, sign in with your Discord account credentials, and select the New Application button.

  2. Name the application something along the lines of {Your Name}'s Server Duels Bot.

  3. Navigate to the Bot tab and select the Reset 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

  1. Navigate to the scripts directory of the repository.
  2. Execute the env_setup.sh script. You may have to give executable permissions to the file with chmod +x env_setup.sh.
  3. Run poetry install at the root level of the repository.

Manual

  1. 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
  1. 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
  1. Install the necessary system level dependencies.
sudo apt-get install python3 python3-pip
  1. Pip install the poetry Python module.
pip install poetry
  1. Run poetry install at the root level of the Server Duels repository to handle other Python module dependencies.