105 lines
2.5 KiB
Markdown
105 lines
2.5 KiB
Markdown
# Update Scripts Guide
|
|
|
|
Simple scripts to update your OC Bot installation with the latest code and fixes from GitHub.
|
|
|
|
## What Was Fixed Recently
|
|
|
|
### 1. **database.py** - SQL Syntax Errors
|
|
- Added backticks around reserved SQL keywords (`trigger`, `characters`)
|
|
- Fixed all database queries to work with MariaDB 10.5+
|
|
- Maintains cached trigger lookups for performance
|
|
|
|
### 2. **cogs/help.py** - Command Conflict Fix
|
|
- Fixed conflict with discord.py's built-in help command
|
|
- Help command now works as `,help` without errors
|
|
- Support for `,help <topic>` still works
|
|
|
|
### 3. **requirements.txt** - Python 3.13 Support
|
|
- Updated discord.py to >=2.5.0 for Python 3.13 compatibility
|
|
- Fixed `audioop` module error
|
|
- All dependencies now verified working
|
|
|
|
## Usage
|
|
|
|
### Linux / macOS
|
|
|
|
```bash
|
|
bash update.sh
|
|
```
|
|
|
|
The script will:
|
|
- ✅ Check for Git repository
|
|
- ✅ Fetch latest changes from GitHub
|
|
- ✅ Pull code updates
|
|
- ✅ Create/activate virtual environment
|
|
- ✅ Upgrade pip
|
|
- ✅ Install/update all dependencies
|
|
- ✅ Show warnings if database changes needed
|
|
|
|
### Windows
|
|
|
|
```bash
|
|
update.bat
|
|
```
|
|
|
|
Same process as Linux, but Windows-compatible.
|
|
|
|
## Features
|
|
|
|
- **Smart Detection**: Only updates dependencies if requirements.txt changed
|
|
- **Change Tracking**: Shows which files were modified
|
|
- **Safety Checks**: Warns about database changes
|
|
- **Error Handling**: Reports any failures immediately
|
|
- **Restart Guidance**: Tells you when to restart the bot
|
|
|
|
## If You Get Database Errors
|
|
|
|
After updating, if you see SQL errors, recreate the database:
|
|
|
|
```sql
|
|
DROP DATABASE rp_bot;
|
|
CREATE DATABASE rp_bot;
|
|
```
|
|
|
|
The bot will automatically recreate tables with the correct schema.
|
|
|
|
## Manual Update Steps
|
|
|
|
If the scripts don't work, do this manually:
|
|
|
|
```bash
|
|
# 1. Pull latest code
|
|
git pull origin main
|
|
|
|
# 2. Activate virtual environment
|
|
source venv/bin/activate # Linux/Mac
|
|
# or
|
|
venv\Scripts\activate.bat # Windows
|
|
|
|
# 3. Install dependencies
|
|
pip install --upgrade -r requirements.txt
|
|
|
|
# 4. Restart bot
|
|
python3 bot.py
|
|
```
|
|
|
|
## Recent Changes Summary
|
|
|
|
| File | Change | Impact |
|
|
|------|--------|--------|
|
|
| database.py | Fixed SQL syntax for reserved keywords | Database operations now work on MariaDB |
|
|
| cogs/help.py | Removed command conflict | Help command now loads without errors |
|
|
| requirements.txt | Updated discord.py to 2.5.0+ | Python 3.13 compatibility |
|
|
|
|
## Support
|
|
|
|
If updates fail:
|
|
1. Check Git is installed: `git --version`
|
|
2. Check Python version: `python3 --version` (need 3.11+)
|
|
3. Check MySQL/MariaDB is running
|
|
4. Try manual update steps above
|
|
|
|
---
|
|
|
|
**Coded by Ball Studios 🎨**
|