89 lines
2.1 KiB
Bash
89 lines
2.1 KiB
Bash
#!/bin/bash
|
|
# OC Bot - Installation Script
|
|
# Usage: bash install.sh
|
|
# Coded by Ball Studios 🎨
|
|
|
|
set -e
|
|
|
|
echo "========================================="
|
|
echo " OC Bot - Installation Script"
|
|
echo " Coded by Ball Studios 🎨"
|
|
echo "========================================="
|
|
echo ""
|
|
|
|
# Check if Python is installed
|
|
if ! command -v python3 &> /dev/null; then
|
|
echo "❌ Python 3 is not installed!"
|
|
echo "Please install Python 3.11+ from https://www.python.org"
|
|
exit 1
|
|
fi
|
|
|
|
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2)
|
|
echo "✅ Python $PYTHON_VERSION found"
|
|
echo ""
|
|
|
|
# Check if git is installed
|
|
if ! command -v git &> /dev/null; then
|
|
echo "❌ Git is not installed!"
|
|
echo "Please install Git from https://git-scm.com"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ Git found"
|
|
echo ""
|
|
|
|
# Create virtual environment if it doesn't exist
|
|
if [ ! -d "venv" ]; then
|
|
echo "📦 Creating virtual environment..."
|
|
python3 -m venv venv
|
|
echo "✅ Virtual environment created"
|
|
else
|
|
echo "✅ Virtual environment already exists"
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Activate virtual environment
|
|
echo "🔧 Activating virtual environment..."
|
|
source venv/bin/activate
|
|
echo "✅ Virtual environment activated"
|
|
echo ""
|
|
|
|
# Upgrade pip
|
|
echo "📦 Upgrading pip..."
|
|
pip install --upgrade pip
|
|
echo "✅ Pip upgraded"
|
|
echo ""
|
|
|
|
# Install requirements
|
|
echo "📦 Installing dependencies..."
|
|
pip install -r requirements.txt
|
|
echo "✅ Dependencies installed"
|
|
echo ""
|
|
|
|
# Setup .env file
|
|
if [ ! -f ".env" ]; then
|
|
echo "📝 Creating .env file..."
|
|
cp .env.example .env
|
|
echo "⚠️ .env file created. Please edit it with your settings:"
|
|
echo " - DISCORD_TOKEN"
|
|
echo " - DB_HOST"
|
|
echo " - DB_USER"
|
|
echo " - DB_PASSWORD"
|
|
echo " - DB_NAME"
|
|
echo ""
|
|
else
|
|
echo "✅ .env file already exists"
|
|
fi
|
|
|
|
echo ""
|
|
echo "========================================="
|
|
echo " ✅ Installation Complete!"
|
|
echo "========================================="
|
|
echo ""
|
|
echo "📝 Next steps:"
|
|
echo "1. Edit .env with your Discord token and database credentials"
|
|
echo "2. Create the database: mysql -u root -p -e 'CREATE DATABASE rp_bot;'"
|
|
echo "3. Run the bot: python3 bot.py"
|
|
echo ""
|