A bot promoting sustainability in the garment and fashion industry through education, tracking, and actionable insights.
Note | Canonical home for GSBot is this repo: |
GSBot helps users make informed decisions about clothing by providing:
Sustainability scores for garments and materials
Environmental impact analysis (water, carbon, energy)
Sustainable brand discovery and comparison
Personalized care instructions to extend garment life
Gamification to encourage sustainable habits
Discord Platform
|
v
+------------------+
| Bot Layer | poise 0.6 / serenity 0.12, prefix commands
| (command mods) | (one module per former cog)
+--------+---------+
|
v
+------------------+
| domain.rs | PURE scoring kernel — the SPARK seam
| (Idris2ABI wiht Zig ffi) | (formally-verifiable, substitutable)
+--------+---------+
|
v
+------------------+
| Service Layer | query/service logic over sqlx
+--------+---------+
|
v
+------------------+
| Data Layer | sqlx 0.8, SQLite, sqlx::migrate!
+--------+---------+
|
v
+------------------+
| SQLite | (SQLite only — no Postgres)
+------------------+This bot is implemented in Rust (framework: poise/serenity; persistence:
sqlx/SQLite). It was ported from a now-deleted Python prototype with behaviour
preserved. The src/domain.rs scoring kernel is pure and total and exposes a
stable C ABI so a formally-verified SPARK/Ada module can be linked in its
place with no caller changes — the architecture’s verification seam.
| Command | Description |
|---|---|
| Get sustainability score with full environmental impact breakdown |
| Find more sustainable options in the same category |
| Material-specific care tips to extend garment life |
| Random sustainability tips for conscious consumption |
| Command | Description |
|---|---|
| Environmental scores: water, carbon, chemicals, energy, biodegradability |
| Side-by-side material comparison with winner per category |
| Search materials and garments by name or description |
| Command | Description |
|---|---|
| Top 10 sustainable brands by overall rating |
| Detailed profile: ratings, certifications, transparency, Good On You score |
| Command | Description |
|---|---|
| Your rank, level, points, query count, preferences |
| Top 10 sustainability champions |
| Configure materials, budget ($-), priority (environmental/social/animal_welfare) |
5 environmental scores (0-100): water usage, carbon footprint, biodegradability, chemical usage, energy consumption
Production metrics: water L/kg, CO2 kg/kg, energy MJ/kg
Properties: biodegradable, recycling potential, durability
Types: natural, synthetic, semi-synthetic, recycled, organic
Category (shirt, pants, dress, etc.)
Material composition (many-to-many relationship)
Lifespan and typical wear count
Care instructions and washing frequency
Calculated sustainability score with lifespan multiplier
3 rating dimensions: environmental, labor, animal welfare
5 certification flags: B Corp, Fair Trade, Organic, Recycled Materials, Carbon Neutral
Transparency score
Good On You rating integration
gsbot/
+-- src/
| +-- main.rs # gsbot binary entry point
| +-- bot.rs # poise/serenity wiring, intents, errors
| +-- lib.rs # library root (Data, Context, Error)
| +-- config.rs # env config + defaults
| +-- db.rs # SQLite pool + sqlx::migrate!
| +-- domain.rs # PURE scoring kernel — the SPARK seam
| +-- models.rs # row structs
| +-- services.rs # query/service layer
| +-- sustainability.rs # analyzer helpers
| +-- cache.rs # in-process cache
| +-- fixtures.rs # sample-data loader
| +-- logging.rs # tracing init
| +-- commands/
| | +-- mod.rs # command registry, colours, admin gate
| | +-- sustainability.rs # sustainability, alternatives, care, tips
| | +-- materials.rs # impact, compare, search
| | +-- brands.rs # brands
| | +-- user_commands.rs # profile, leaderboard, setpreference
| | +-- admin.rs # loaddata, stats, announce
| +-- bin/
| +-- load_fixtures.rs # gsbot-load-fixtures
| +-- export_data.rs # gsbot-export-data
| +-- backup_db.rs # gsbot-backup-db
+-- migrations/
| +-- 0001_init.sql # schema (applied via sqlx::migrate!)
+-- docs/
| +-- API.md # Full command reference
| +-- ARCHITECTURE.md # System design
| +-- DEPLOYMENT.md # Deployment guide
+-- ROADMAP.adoc # Development roadmap
+-- CLAUDE.md # AI assistant instructions
+-- docker-compose.yml
+-- Containerfile
+-- Cargo.toml
+-- Justfile # build/test/lint recipesA Rust toolchain (stable;
cargo)Optionally
justfor the convenience recipesDiscord Bot Token (from Discord Developer Portal)
# Clone repository
git clone https://github.com/hyperpolymath/gsbot.git
cd gsbot
# Configure environment
cp .env.example .env
# Edit .env with your DISCORD_TOKEN# Build
just build # or: cargo build# Load sample data (optional) — also runs migrations
just load-data # or: cargo run --bin gsbot-load-fixtures# Run bot — migrations are applied automatically at startup
just run # or: cargo run --bin gsbotEnvironment variables (.env):
| Variable | Description | Default |
|---|---|---|
| SQLite connection string (SQLite only) |
|
| Enable query caching |
|
| Cache time-to-live (seconds) |
|
| Logging verbosity |
|
# Run all tests
just test# or: cargo test --all-targets# Lint (clippy, warnings as errors)
just lint # or: cargo clippy --all-targets -- -D warnings# Format
just format # or: cargo fmt --allAPI Reference - Complete command documentation
Architecture - System design and patterns
Deployment - Production deployment guide
Roadmap - Development roadmap and future features
See CONTRIBUTING.md for development guidelines.
Key areas:
Data curation (verified material/brand datasets)
Test coverage expansion
Documentation improvements
Localization support
MPL-2.0
This ensures any modifications or derivative works remain open source, protecting the sustainability mission of the project.