Welcome to the HFT Intern repo, a discord.py project for the HFT Intern Discord bot.
This codebase is designed to be run on https://fly.io in production, but can be run locally with Node.js for development purposes.
To run the application locally, you must have the following installed. It is recommended to use a package manager (like Homebrew on Mac OS X) to install each of the following:
- Node.js (18.X, - should include NPM)
- macOS:
brew install node@18
- macOS:
- pre-commit
- macOS:
brew install pre-commit
- macOS:
- Clone this repository locally with
git clone https://github.com/HaloFunTime/hft-intern.git - Create a local
.envby running the commandcp .env.example .env(and then adding actual values to the variables in the.envfile as needed) - For ease of use, make all
dev--prefixed shell scripts directly executable by issuing the following shell command:find dev-*.sh | xargs chmod +x
- Run your local application for the first time by running the script
./dev-start.sh - Confirm that the Discord Bot represented by your
BOT_TOKENshows as "online" when viewed through Discord - Kill your local application by either using CTRL+C in the shell in which it's running, or by running the script
./dev-stop.sh
Docker is configured to build one container - it will be running the Discord.py script and will be called hftintern in the logs. Setup specifics can be viewed in the docker-compose.yml file.
- Make changes to JavaScript files as needed
- Run your local application with
./dev-start.sh - Stop your dev application with
./dev-stop.sh(or CTRL+C) when you're done - Bundle your changes into git commits on a branch not named
main, and push your branch to the origin repository - Open a pull request from your branch targeting the
mainbranch
Variables and function declarations in Python code are to be named using the snake_case convention.
Use dev-start.sh and dev-stop.sh to start and stop the application locally.
dev-format.sh: Auto-formats all files in the codebasedev-start.sh: Runs the application using Node.js (saves server process ID tointern.pid)dev-stop.sh: Stops the running application (sends SIGINT to the process ID inintern.pid)
Several quality-of-life features are baked in via this repository's pre-commit config, including elimination of trailing whitespace, EOF auto-add, YAML formatting, autoformatting with prettier, and JavaScript linting with eslint.
Most development scripts exist to simplify the dev flow for newer developers; for those contributors who are more experienced, feel free to manually execute commands within Docker containers and break the "rules" as appropriate. It is our explicit goal that this project be very approachable for new developers, so please default to simplicity when possible.
