ð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
Open the Discord app.
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
If you do not already have one, create a GitHub account.
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:
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:
Contributing section of the GitBook
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
Click on the invite link pinned to the #developers channel in the Enoch Bot Developers Discord server.
Login with your C4T Google Workspace account.
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.
Open your computer's terminal.
cd
into the Enoch Bot repository directory. For example, if you cloned the repo underDesktop/code/
, you should runcd Desktop/code/enoch-bot
.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.
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:
cd
into the Enoch Bot repository directory. For example, if you cloned the repo underDesktop/code/
, you should runcd Desktop/code/enoch-bot
.Run the following command:
For Windows and Git Bash:
If you are using a Windows machine or Git Bash, the terminal command above may not work.
cd
into the Enoch Bot repository directory. For example, if you cloned the repo underDesktop/code/
, you should runcd Desktop/code/enoch-bot
.Run the following command:
From your IDE:
Open a new terminal within your IDE. Integrated terminals typically
cd
directly into your project's root directory, so no need tocd
anywhere!Run the following command:
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 botWait 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.
Request the
developer.pem
file from the lead developer by DMing them on Discord.Save the
developer.pem
file in a secure location on your local computer.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 thedeveloper.pem
file:chmod 400 <path>
This command basically restricts read access for this file to only your user account.
To login as the
developer
user, run the following command in your terminal, replacing<path>
with the file path to thedeveloper.pem
file:
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.
Recommended: Create an alias for the SSH command
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.
Open the terminal.
Run
cd ~
to go to your home directory.If you don't already have a
.bash_profile
, runtouch .bash_profile
to create one.To edit your
.bash_profile
in TextEdit (built-in text editing application on Macs), runopen -a TextEdit.app ~/.bash_profile
.Add the following line to the file:
alias enoch='ssh -i developer@ec2-18-144-168-152.us-west-1.compute.amazonaws.com'
Save and quit TextEdit.
Quit and re-open your terminal for the new
.bash_profile
to take effect.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