👋Getting Started

Here are the steps you need to follow to get started as an Enoch Bot Developer!

Discord

Join the Enoch Developers Discord server

If you need the invite link:

  • Check out the pinned messages in the #enoch channel of the C4T members server OR

  • Ask anyone with the Enoch Bot Developer role on Discord in any C4T Discord server

Refrain from sharing the invite link to the developer server with people who are not C4T members.

Turn on Developer Mode on Discord

  1. Open the Discord app.

  2. Go to User Settings > Appearance > Advanced > Developer Mode

This will allow you to do developer-related things. For example, if you right-click a user or server you can copy the user ID or guild ID ("guild" is the word for "server" in the discord API).

Copy your user ID and send it to the #developers channel on the Enoch Bot Developers Discord server so you can be added as a bot owner. Make sure to ping the lead developer to do this.

Git, GitHub, and GitBook

Join the Enoch Bot collaborators on GitHub

  1. If you do not already have one, create a GitHub account.

  2. Send the lead developer your Github username so they can invite you as a collaborator on the GitHub repository: https://github.com/phrdang/enoch-bot

The Enoch Bot GitHub repo is a private repo because it contains sensitive info. DO NOT make the repo public EVER.

What's a GitHub repository?

A repository, often called repo for short, is the place where all the code for a particular piece of software is stored. For more information on repositories, see the Git & GitHub section of Miscellaneous and Resources.

Install git

If you have not already done so, install Git onto your computer.

What's git?

Git is a distributed version control system, which is a fancy way of saying it's a way for us to keep track of changes we make to our code. It also makes collaborating on code easier. For more information, see the Git & GitHub section of Miscellaneous and Resources.

Clone the repo

Once you have been added as a collaborator and installed Git, clone (aka copy the code files) the Enoch Bot repo by running the following commands in your terminal:

cd <path>
git clone https://github.com/phrdang/enoch-bot.git

where <path> is replaced with the file path to the parent directory (aka folder) where you want to store the Enoch Bot repository on your computer. You can choose whichever directory you want, just remember where the repository is!

You should be prompted to login to your GitHub account. Login normally with your username and password or personal access token.

Get listed as a contributor

Ping the lead developer in the #developers channel of the Enoch Developers Discord server asking them to add your name and discord username and discriminator (the 4 numbers after your username) to the Enoch Bot documentation under:

  1. Contributing section of the GitBook

  2. The README.md file of the GitHub repo (it's not synced with the GitBook's Welcome page)

If you would prefer not to be listed as a contributor on these platforms, feel free to skip this step. Just be aware that since the GitHub repo is private, if you want to get public "credit" for being on the developer team this is basically the only way to do it.

Additionally, if you would rather only put some of your information and not others (e.g. you're fine with displaying your Discord username but not your real name), please tell the lead developer when pinging them.

Join the C4T GitBook team

  1. Click on the invite link pinned to the #developers channel in the Enoch Bot Developers Discord server.

  2. Login with your C4T Google Workspace account.

  3. Ping the lead developer to get added to the Enoch Bot Developer GitBook team. This will give you permissions to view and edit this documentation.

What is GitBook?

GitBook is a convenient software documentation web application. You're actually on the Enoch Bot GitBook right now!

Programming Environment Setup

Install an IDE

If you have not already, install a coding IDE (Integrated Development Environment). This is a desktop application that will allow you to write code and can feature nifty tools like linting, version control (e.g. Git integration), etc.

Check out C4T's IDE guide if you aren't sure which one to install (there are many)! We recommend VS Code.

Install Python 3

Follow the instructions on this guide to install Python 3 (if you have not already).

Install dependencies

The following instructions assume that you are on a Unix computer (e.g. MacOS or Linux) and using bash. If you are on a Windows computer, the instructions may vary slightly. If you need help, message the #developers channel on the Enoch Bot Developers server!

What's a dependency?

A dependency is a library/module/package of code that someone else wrote that we need for the bot to function properly. Hence, the bot depends on this code.

  1. Open your computer's terminal.

  2. cd into the Enoch Bot repository directory. For example, if you cloned the repo under Desktop/code/, you should run cd Desktop/code/enoch-bot.

  3. Run the following command to install all required dependencies:

You may need to use pip3 instead of pip if you have Python 2 and Python 3 installed on your computer, such as older versions of MacOS which come preinstalled with Python 2.

pip install -r requirements.txt

Secrets

Bot tokens

Use your IDE to create a file called .env in the root project directory and then ask another developer to send you the contents of the .env file (the bot tokens). You should copy and paste the contents into your own file.

Note that these tokens CANNOT, under ANY CIRCUMSTANCES, be made public, pushed to GitHub, uploaded to the cloud, etc.

The bot tokens in the .env file allow someone to run code on the bot, which is why the tokens are considered sensitive, secret information.

DO NOT push the bot tokens to GitHub FOR ANY REASON.

DO NOT put the bot tokens anywhere in the project files except in the .env file.

The .env file is ignored by Git and is local to your computer.

Credentials

Use your IDE to create a file called credentials.json in the ./data directory (. represents root project directory) and then ask another developer to send you the contents of the credentials.json file. Copy and paste the contents into your own credentials.json file.

Again, DO NOT MAKE THE CONTENTS OF THIS FILE PUBLIC and DO NOT PUSH TO GITHUB for any reason.

Running the bot

Once you have set up your programming environment, it's time to run the dev bot! The dev bot is a separate bot account (Discord username: @Enoch Dev) that we use to develop the code for Enoch so that we can develop while the actual instance of Enoch (Discord username: @Enoch) is running at the same time.

From the terminal:

  1. cd into the Enoch Bot repository directory. For example, if you cloned the repo under Desktop/code/, you should run cd Desktop/code/enoch-bot.

  2. Run the following command:

python3 launcher.py

For Windows and Git Bash:

If you are using a Windows machine or Git Bash, the terminal command above may not work.

  1. cd into the Enoch Bot repository directory. For example, if you cloned the repo under Desktop/code/, you should run cd Desktop/code/enoch-bot.

  2. Run the following command:

py -m launcher

From your IDE:

  1. Open a new terminal within your IDE. Integrated terminals typically cd directly into your project's root directory, so no need to cd anywhere!

  2. Run the following command:

python3 launcher.py

Depending on the version of the bot (you should have the most updated one since cloning the repo automatically downloads the most recent code), you will be presented with different yes or no prompts and printed messages that inform you the status of the bot startup. As of v3.0.0:

  • It doesn't matter whether you enter "Y" or "N" when it asks what verification mode you want to run the bot in. You can choose whichever for the purposes of running the bot for the first time. (For more info on what verification mode means, please see the Utility page.)

  • Enter y when it asks if you are running the dev bot

  • Wait for it to say bot ready! (takes like 10 seconds). Once it does this, the bot is ready to receive commands from the Enoch Bot Developers Discord server. Try entering some Enoch commands into the #commands channel. (For inspiration, take a look at the Commands Reference section.)

Type Ctrl + C (note that on MacOS it is indeed Ctrl, not Cmd that you want to press) to stop running the bot once you're done testing.

Remember: All testing/feature development must be done on the dev bot since the actual bot needs to be running continuously. You can use the same procedure above to start the bot each time you are developing.

SSH and AWS

The actual instance of Enoch Bot is run ("hosted") on a virtual machine 24/7, specifically an AWS EC2 instance. It is not necessary to understand AWS to write code for Enoch, but it is necessary to be able to login to this virtual machine to start/stop/update the code the actual Enoch Bot is running on.

Logging in with SSH

We login to the virtual machine through SSH. To login with SSH, follow the steps below.

  1. Request the developer.pem file from the lead developer by DMing them on Discord.

  2. Save the developer.pem file in a secure location on your local computer.

  3. If you are using a MacOS or Linux computer, you also need to run the following command in your terminal, replacing <path> with the file path to the developer.pem file: chmod 400 <path>

    • This command basically restricts read access for this file to only your user account.

  4. To login as the developer user, run the following command in your terminal, replacing <path> with the file path to the developer.pem file:

ssh -i <path> developer@ec2-18-144-168-152.us-west-1.compute.amazonaws.com

You should see something like this:

DO NOT share the developer.pem file with anyone outside of the Enoch developer team.

Exiting the EC2 instance

Run exit to log out of the virtual machine.

Follow the steps below to create an alias in your .bash_profile so that you don't have to enter the really long SSH command every time.

  1. Open the terminal.

  2. Run cd ~ to go to your home directory.

  3. If you don't already have a .bash_profile, run touch .bash_profile to create one.

  4. To edit your .bash_profile in TextEdit (built-in text editing application on Macs), run open -a TextEdit.app ~/.bash_profile.

  5. Add the following line to the file: alias enoch='ssh -i developer@ec2-18-144-168-152.us-west-1.compute.amazonaws.com'

  6. Save and quit TextEdit.

  7. Quit and re-open your terminal for the new .bash_profile to take effect.

  8. From now on, run the enoch alias every time you want to SSH into the EC2 instance. (Note: You can also call this alias whatever you want, it doesn't have to be "enoch".)

Get to know our workflow

Congratulations! You've finished the setup instructions. There's one last thing you need to do before you can really start coding: Read the Development Process page to familiarize yourself with how we work as a team.

Questions? Need help?

Feel free to message the #developers channel of the Enoch Bot Developers Discord server whenever!

Last updated