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
This bot allows users to purchase a **Discord role** using **Bitcoin Lightning payments** through LNbits.
Users request an invoice via a **slash command** (configurable), and the bot automatically assigns the role **once payment is confirmed**.
A full-stack Dockerized membership engine that lets users purchase Discord roles via Bitcoin Lightning (LNbits). It provides:
- 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
- ✅ Dynamic slashcommand name (configured via `command_name`)
- ✅ Generates a **Lightning invoice** via LNbits
- ✅ Listens on LNbits WebSocket for paid invoices
- ✅ Automatically assigns a **Discord role** on payment
- ✅ Posts confirmations directly in your designated channel
- 🔧 **One-click Docker Compose**: bot + web UI + database
- ✅ **Dynamic slash-commands** for each plan (no code changes needed)
- ⚡ **Lightning invoices** via LNbits REST API
- 🌐 **WebSocket listener** for incoming payments
- 👤 **Automatic role assignment** on payment
- ⏰ **Scheduled cleanup** of expired subscriptions
- 📊 **Persistent audit log** in Postgres (raw JSON, timestamps, statuses)
---
## 📋 Requirements
- **Ubuntu 24.04**
- **Python 3.10+**
- **A Discord Bot Token** (from the [Developer Portal](https://discord.com/developers/applications))
- **LNbits Wallet Invoice Key**
- **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
```
### 3. Create & Activate Virtual Environment
### 3. Copy & Edit .env
```bash
python3 -m venv venv
source venv/bin/activate
cp .env.example .env
nano .env
```
### 4. Install Dependencies
### 4. Buld & run
```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