Skip to content

dragonejt/hakase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

116 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hakase-discord

godoc integration delivery codecov go report card

hakase is a collection of helpful utilities for class chatrooms, including an assignment due date reminder, study session scheduler, and more. It is currently under development. This repository holds the Discord Bot, built with Go.

Local Development

Building and Running

Local development with hakase-discord is relatively simple. The only command you have to run is:

go run hakase-discord.go

You do have to have some environment variables in place. hakase does not directly read from a .env file, but you can configure environment variables or reference a .env file through IDE launch options. Otherwise, you can set environment variables locally.

ENV="development"
DISCORD_BOT_TOKEN="from Discord Dev Portal"
BACKEND_URL="from Backend API"
BACKEND_AUTH_TOKEN="from Backend API"
ANTHROPIC_BASE_URL="from Anthropic-compatible LLM API"
ANTHROPIC_AUTH_TOKEN="from Anthropic-compatible LLM API"
ANTHROPIC_MODEL="from Anthropic-compatible LLM API"

Testing

For testing, the following command should be run, with the above environment variables in place:

go test ./...

This uses Go's built-in test runner which will discover and test all _test.go files. The integrate.yml GitHub Actions workflow will run these tests with code coverage (-coverpkg=./... -coverprofile=coverage.txt).

If you are using VS Code, the VS Code Go extension will enable automatic test discovery and running in the Testing sidebar.

Linting and Formatting

Go and the VS Code Go Extension automatically performs linting and formatting on save. The integrate.yml GitHub Actions workflow will check for linting errors and formatting mistakes with golangci-lint.

Deployment

For deployment, hakase is built into a Docker image with Heroku Cloud Native Buildpacks, and then deployed into a container via Palantir Compute Modules.

On the deployed docker container, the same environment variables should be set, with ENV now being production.

Continuous Delivery

hakase has a continuous delivery GitHub Actions workflow, deliver.yml. The steps taken are summarized:

  1. Build a Docker image with the Heroku Cloud Native Buildpacks
  2. Publish the docker image to Palantir Artifacts.
  3. Select the latest docker image to run in the Palantir Compute Module
  4. A new Sentry release is created for monitoring with the Sentry Release GitHub Action.

About

Helpful Utilities for Class Chatrooms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages