Update README.md

This commit is contained in:
saulteafarmer 2025-05-14 15:38:46 +00:00
parent 10e51b3655
commit dd8abc227b

View File

@ -1,27 +1,32 @@
# Discord LNbits Bot # Discord LNbits Bot
This bot allows users to purchase a **Discord role** using **Bitcoin Lightning payments** through LNbits. A full-stack Dockerized membership engine that lets users purchase Discord roles via Bitcoin Lightning (LNbits). It provides:
Users request an invoice via a **slash command** (configurable), and the bot automatically assigns the role **once payment is confirmed**. - A Discord bot that dynamically registers slash-commands per membership “plan”
- A Flask web UI (port 3000) for configuring your Discord/LNbits credentials and creating/editing membership plans
- A Postgres backend to persist plans, subscriptions, and payment logs
- Automated expiry logic (calendar-month, rolling-days, fixed-date) with scheduled role revocation
--- ---
## 🚀 Features ## 🚀 Features
- ✅ Dynamic slashcommand name (configured via `command_name`) - 🔧 **One-click Docker Compose**: bot + web UI + database
- ✅ Generates a **Lightning invoice** via LNbits - ✅ **Dynamic slash-commands** for each plan (no code changes needed)
- ✅ Listens on LNbits WebSocket for paid invoices - ⚡ **Lightning invoices** via LNbits REST API
- ✅ Automatically assigns a **Discord role** on payment - 🌐 **WebSocket listener** for incoming payments
- ✅ Posts confirmations directly in your designated channel - 👤 **Automatic role assignment** on payment
- ⏰ **Scheduled cleanup** of expired subscriptions
- 📊 **Persistent audit log** in Postgres (raw JSON, timestamps, statuses)
--- ---
## 📋 Requirements ## 📋 Requirements
- **Ubuntu 24.04**
- **Python 3.10+**
- **A Discord Bot Token** (from the [Developer Portal](https://discord.com/developers/applications)) - **A Discord Bot Token** (from the [Developer Portal](https://discord.com/developers/applications))
- **LNbits Wallet Invoice Key** - **LNbits Wallet Invoice Key**
- **A running LNbits instance** (e.g., [Sats.Love](https://sats.love/)) - **A running LNbits instance** (e.g., [Sats.Love](https://sats.love/))
- **Docker Engine (v20+)**
- **Docker Compose (v1.29+ or the built-in docker compose)**
--- ---
@ -86,19 +91,25 @@ git clone https://code.rustysats.com/saulteafarmer/discord-lnbits-bot
cd discord-lnbits-bot cd discord-lnbits-bot
``` ```
### 3. Create & Activate Virtual Environment ### 3. Copy & Edit .env
```bash ```bash
python3 -m venv venv cp .env.example .env
source venv/bin/activate nano .env
``` ```
### 4. Install Dependencies ### 4. Buld & run
```bash ```bash
pip install -r requirements.txt docker-compose up -d --build
``` ```
### 5. Open the web UI
Visit: http://localhost:3000
- Configure your Discord Bot Token, Guild ID, LNbits URL, LNbits Invoice Key
- Define membership plans (command name, role ID, channel ID, price, expiry policy)
--- ---
## 3⃣ Find Your Discord Guild ID & Role ID ## 3⃣ Find Your Discord Guild ID & Role ID