Contributing to NIKOMAIL

Your one guide to preparing for local development, and how to contribute to the project.

đź“‹ Prerequisites

  1. A Discord Application with the Message Content privileged intent enabled.
  2. A Code Editor of your choice, we recommend Visual Studio Code.
  3. An installation of the Rust Toolchain. 🦀
  4. An installation of Docker—If you aren’t using Docker Desktop, make sure Docker Compose is installed.
  5. An installation of the SQLx CLI using this command:
  • cargo install sqlx-cli --no-default-features --features native-tls,postgres

⚙️ Setting Environment Variables

Since we’re a little silly, you’ll need to create a new file .cargo/config.toml with these contents:

[env]
# you should leave this one unchanged, unless you know what you're doing
DATABASE_URL = "postgresql://nikomail:nikomail@localhost/nikomail"
# grab your app id from General Information > Application Id
DISCORD_APP_ID = "INSERT_ID_HERE"
# grab your bot token from Bot > Token
DISCORD_BOT_TOKEN = "INSERT_TOKEN_HERE"

# this makes simd-json more awesome or something :3
[build]
rustflags = ["-C", "target-cpu=native"]

đź’ż Starting the database

If you’re using Docker Compose v2 (most likely if using Docker Desktop)

Run this command: docker compose up

Otherwise…

Run this command: docker-compose up


You’ll need to run either of these commands every time before starting NIKOMAIL.

‼️ If it’s your first time starting up the database, it’s important you run this command to setup the database:
sqlx database setup

đź’Ś Starting NIKOMAIL

Before starting NIKOMAIL (and whenever you modify command metadata), you’ll need to run this to push all commands to Discord: cargo run -- --update-commands

Simple as running cargo run to start the program in development mode—time for you to start messing around!

If you want the program to restart whenever you make code changes, consider installing cargo-watch and using cargo watch -x run instead!

🤔 Contribution Checklist

pretend there’s a list of things here to think about before contributing

❤️ Ready to open a Pull Request?

If you’ve taken a good look at your hard work, and decided it’s time to contribute to the NIKOMAIL project, make sure you meet this criteria:

  1. cargo check or cargo clippy has been run (with good outcome).
  2. cargo sqlx prepare has been run (also with good outcome).