jakeweary / riamu.v3

Third iteration of my multi-purpose Discord bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Riamu v3 – autism unleashed

Third iteration of my Discord bot, this time with an unhealthy level of overengineering.

Instructions

Configuration

Rename .env.example to .env and fill it with actual values.

Running in prod

scripts/get-assets

docker compose up -d # launch
docker compose logs -f # check logs
docker compose down # shutdown

Development

Preparing dev environment

sudo apt update
sudo apt install -y \
  python3 python3-pip ffmpeg sqlite3 curl git build-essential pkg-config clang \
  python3-dev llvm-dev libclang-dev libssl-dev libpango1.0-dev libcairo2-dev librsvg2-dev

curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
rustup toolchain install nightly

python3 -m pip install --user pipenv
pipenv install --dev

scripts/get-assets
scripts/get-deps

Building / Running

pipenv run cargo run # build and run in debug mode
pipenv run cargo run --release # build and run in release mode

pipenv run cargo build # build in debug mode
pipenv run target/debug/riamu # run the debug build w/o cargo

pipenv run cargo build --release # build in release mode
pipenv run target/release/riamu # run the release build w/o cargo

Testing

pipenv run cargo test --workspace # rust
pipenv run pytest -v -n auto --dist loadscope python # python

Linting with clippy

cargo clippy --workspace # just lint
cargo clippy --workspace --fix --allow-dirty --allow-staged --broken-code # lint & fix

Misc.

# acquire prod database over ssh
ssh foo@bar.baz 'docker cp riamu.v3:/app/data - | gzip' | tar -xzv --strip-components=1

# query local database
sqlite3 -box -cmd '.load deps/sqlean' db.sqlite

# query dockerized database
docker run --volumes-from riamu.v3 --rm -it alpine \
  sh -c 'apk add sqlite && sqlite3 -box /app/data/db.sqlite'

Roadmap

Alpha

  • Python interop
  • A proc macro for slash commands
  • Decent enough error handling with unique error ids

Beta

  • Subcommands support
  • Respect attachment size limits
  • File storage system for large files
  • Core commands basic functionality
    • /download – yt-dlp wrapper
    • /deezer – deezer downloading
    • /tiktok – tiktok downloading

Release

  • More commands
  • Rate limits, permissions
  • Improved error handling
    • All common cases handled gracefully
    • Using ephemeral messages
    • Using anyhow::Context or similar

Post-release

  • Context menus, auto-complete, etc.
  • Some way to support Deezer/Spotify playlists
  • gallery-dl

About

Third iteration of my multi-purpose Discord bot


Languages

Language:Rust 95.3%Language:Python 3.1%Language:Shell 0.9%Language:Dockerfile 0.5%Language:HTML 0.1%Language:Perl 0.1%