docs: Update README and add Linux setup script
Improve documentation and add a setup script for easy deployment on Linux systems. - Update README.md with instructions for the new multi-voice slash commands and the oices/ directory structure. - Add a comprehensive 'Linux Server Deployment' section to the README, detailing both a quick setup via a new script and a manual systemd service setup. - Create setup_linux.sh to automate dependency checking, virtual environment creation, and service installation on Linux. - Revise comments in .env.example for clarity and to reflect the latest configuration options.
This commit is contained in:
113
README.md
113
README.md
@@ -8,6 +8,9 @@ A Discord bot that reads messages aloud using [Pocket TTS](https://github.com/ky
|
||||
- 📝 **Auto-read Messages**: Automatically reads all messages from a configured text channel
|
||||
- 🔊 **Voice Channel Streaming**: Streams generated audio to the voice channel where the message author is
|
||||
- 📋 **Message Queue**: Messages are queued and spoken in order
|
||||
- 🔄 **Per-User Voice Selection**: Each user can choose their own TTS voice via `/voice` commands
|
||||
- 💾 **Voice Persistence**: User voice preferences are saved and restored on restart
|
||||
- 🔄 **Hot-reload Voices**: Add new voices without restarting the bot using `/voice refresh`
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -75,12 +78,15 @@ A Discord bot that reads messages aloud using [Pocket TTS](https://github.com/ky
|
||||
```env
|
||||
DISCORD_TOKEN=your_bot_token_here
|
||||
TEXT_CHANNEL_ID=123456789012345678
|
||||
VOICE_WAV_PATH=./voice.wav
|
||||
VOICES_DIR=./voices
|
||||
DEFAULT_VOICE=estinien
|
||||
```
|
||||
|
||||
5. **Add a voice reference file**:
|
||||
- Place a WAV file named `voice.wav` in the project directory
|
||||
- The file should contain 3-10 seconds of clear speech
|
||||
5. **Add voice reference files**:
|
||||
- Create a `voices/` directory: `mkdir voices`
|
||||
- Place `.wav` files in the `voices/` directory
|
||||
- Each file should contain 3-10 seconds of clear speech
|
||||
- File names become voice names (e.g., `MasterChief.wav` → `/voice set masterchief`)
|
||||
- Higher quality audio = better voice cloning results
|
||||
|
||||
## Usage
|
||||
@@ -96,6 +102,12 @@ A Discord bot that reads messages aloud using [Pocket TTS](https://github.com/ky
|
||||
- The bot will join your voice channel and read your message aloud
|
||||
- Messages are queued if the bot is already speaking
|
||||
|
||||
3. **Voice Commands** (Slash Commands):
|
||||
- `/voice list` - Shows all available voices
|
||||
- `/voice set <name>` - Change your personal TTS voice
|
||||
- `/voice current` - Shows your current voice
|
||||
- `/voice refresh` - Re-scan for new voice files (no restart needed)
|
||||
|
||||
## How It Works
|
||||
|
||||
```
|
||||
@@ -106,8 +118,8 @@ A Discord bot that reads messages aloud using [Pocket TTS](https://github.com/ky
|
||||
▲
|
||||
│
|
||||
┌─────┴─────┐
|
||||
│ voice.wav │
|
||||
│ (speaker) │
|
||||
│ voices/ │
|
||||
│ per-user │
|
||||
└───────────┘
|
||||
```
|
||||
|
||||
@@ -133,6 +145,95 @@ A Discord bot that reads messages aloud using [Pocket TTS](https://github.com/ky
|
||||
- Ensure the reference audio is clear with minimal background noise
|
||||
- Try a longer reference clip (5-10 seconds)
|
||||
|
||||
## Linux Server Deployment
|
||||
|
||||
To run the bot as a service on a Linux server:
|
||||
|
||||
### Quick Setup (Recommended)
|
||||
|
||||
```bash
|
||||
# Make the setup script executable
|
||||
chmod +x setup_linux.sh
|
||||
|
||||
# Run the setup script
|
||||
./setup_linux.sh
|
||||
```
|
||||
|
||||
The script will:
|
||||
- Check system dependencies (Python 3.10+, FFmpeg, pip)
|
||||
- Create a virtual environment and install dependencies
|
||||
- Create `.env` template if needed
|
||||
- Optionally install and configure the systemd service
|
||||
|
||||
### Manual Setup
|
||||
|
||||
1. **Install system dependencies**:
|
||||
```bash
|
||||
# Ubuntu/Debian
|
||||
sudo apt update
|
||||
sudo apt install python3 python3-pip python3-venv ffmpeg
|
||||
|
||||
# Fedora
|
||||
sudo dnf install python3 python3-pip ffmpeg
|
||||
|
||||
# Arch
|
||||
sudo pacman -S python python-pip ffmpeg
|
||||
```
|
||||
|
||||
2. **Set up the project**:
|
||||
```bash
|
||||
cd /path/to/PocketTTSBot
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
3. **Configure the service**:
|
||||
|
||||
Edit `pockettts.service` and replace:
|
||||
- `YOUR_USERNAME` with your Linux username
|
||||
- Update paths if your bot is not in `/home/YOUR_USERNAME/PocketTTSBot`
|
||||
|
||||
4. **Install the service**:
|
||||
```bash
|
||||
sudo cp pockettts.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable pockettts # Start on boot
|
||||
sudo systemctl start pockettts # Start now
|
||||
```
|
||||
|
||||
### Service Management
|
||||
|
||||
```bash
|
||||
# Check status
|
||||
sudo systemctl status pockettts
|
||||
|
||||
# View logs (live)
|
||||
journalctl -u pockettts -f
|
||||
|
||||
# View recent logs
|
||||
journalctl -u pockettts --since "1 hour ago"
|
||||
|
||||
# Restart after changes
|
||||
sudo systemctl restart pockettts
|
||||
|
||||
# Stop the bot
|
||||
sudo systemctl stop pockettts
|
||||
|
||||
# Disable auto-start
|
||||
sudo systemctl disable pockettts
|
||||
```
|
||||
|
||||
### Updating the Bot
|
||||
|
||||
```bash
|
||||
cd /path/to/PocketTTSBot
|
||||
git pull # If using git
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
sudo systemctl restart pockettts
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT License
|
||||
|
||||
Reference in New Issue
Block a user