Page:
Installation
Clone
2
Installation
Eaven Kimura edited this page 2026-10-26 12:10:22 +00:00
Table of Contents
- Installation
- Prerequisites
- Discord Bot Setup
- 1. Create Discord Application
- 2. Configure Bot Settings
- 3. Set Bot Permissions
- 4. Invite Bot to Your Server
- 5. Get Your Guild ID
- 6. Create Server Role
- Traditional Installation
- 1. Clone the Repository
- 2. Install Required Dependencies
- 3. Create and Configure Your config.ini File
- 4. Run the Bot
- Docker Installation
- 1. Clone the Repository
- 2. Build the Docker Image
- 3. Create a Directory for Configuration
- 4. Create a config.ini File
- 5. Run the Container
- 6. Docker Compose (Recommended)
- Kubernetes Installation
- 1. Clone the Repository
- 2. Build and Push the Docker Image
- 3. Create a Kubernetes Namespace (Optional but Recommended)
- 4. Create a Kubernetes Secret with Your Configuration
- 5. Create a PersistentVolumeClaim for Logs and Embed Data
- 6. Create the Deployment
- 7. (Optional) Create a Service for Metrics/Health Checks
- 8. (Optional) Create a HorizontalPodAutoscaler
- 9. Verify the Deployment
- 10. For Production: Use Kustomize
- Verification
- Related Pages
Installation
Prerequisites
Before installing Pterodisbot, ensure you have:
- Python 3.8 or higher (for traditional installation)
- Docker (for containerized deployment)
- Kubernetes cluster (for K8s deployment)
- Discord bot token (from Discord Developer Portal)
- Discord server (guild) ID
- Pterodactyl/Pelican Panel with API access
- Pterodactyl Client API key (starts with
ptlc_orpacc_) - Pterodactyl Application API key (starts with
ptla_orpapp_)
Discord Bot Setup
Before installing the bot software, you need to create a Discord application and bot account.
1. Create Discord Application
- Navigate to the Discord Developer Portal
- Click the "New Application" button in the top-right corner
- Enter a name for your application (e.g., "Pterodactyl Bot")
- Accept the Terms of Service and click "Create"
2. Configure Bot Settings
- In the left sidebar, click on "Bot"
- Click "Add Bot" and confirm by clicking "Yes, do it!"
- Under the bot's username, you'll see a Token section:
- Click "Reset Token" and then "Copy" to get your bot token
- ⚠️ Keep this token secret! Never share it publicly or commit it to version control
- Scroll down to "Privileged Gateway Intents" and enable:
- ✅ Message Content Intent (required for the bot to read message content)
- Click "Save Changes" at the bottom
3. Set Bot Permissions
- In the left sidebar, click on "OAuth2" → "URL Generator"
- Under "Scopes", select:
- ✅
bot - ✅
applications.commands
- ✅
- Under "Bot Permissions", select:
- ✅ View Channels (allows bot to see channels)
- ✅ Send Messages (allows bot to post embeds)
- ✅ Embed Links (required for rich embeds)
- ✅ Attach Files (required for metrics graphs)
- ✅ Read Message History (allows bot to edit existing messages)
- ✅ Use Slash Commands (required for
/server_statuscommands)
4. Invite Bot to Your Server
- Copy the Generated URL at the bottom of the OAuth2 URL Generator page
- Paste this URL into your browser and press Enter
- Select the Discord server where you want to add the bot
- Click "Authorize" and complete the CAPTCHA if prompted
- The bot should now appear in your server (offline until you start the application)
5. Get Your Guild ID
- In Discord, enable Developer Mode:
- Click the ⚙️ gear icon (User Settings)
- Navigate to "Advanced" under "App Settings"
- Toggle on "Developer Mode"
- Right-click on your server icon in the left sidebar
- Click "Copy Server ID" at the bottom of the menu
- Save this ID - you'll need it for the bot configuration
6. Create Server Role
- In your Discord server, click the server name at the top to open the dropdown menu
- Select "Server Settings" → "Roles"
- Click "Create Role"
- Name the role exactly:
Game Server User - The role doesn't need any special permissions - it's only used for bot access control
- Click "Save Changes"
- Assign this role to any users who should be able to control game servers
Traditional Installation
1. Clone the Repository
git clone https://git.serendipity.systems/k.eaven/pterodisbot.git
cd pterodactyl-discord-bot
2. Install Required Dependencies
pip install -r requirements.txt
3. Create and Configure Your config.ini File
See the Configuration section for details.
4. Run the Bot
python main.py
Docker Installation
1. Clone the Repository
git clone https://git.serendipity.systems/k.eaven/pterodisbot.git
cd pterodactyl-discord-bot
2. Build the Docker Image
docker build -t pterodisbot .
3. Create a Directory for Configuration
mkdir -p bot-config
4. Create a config.ini File
Create a config.ini file in the bot-config directory with your settings (see Configuration).
5. Run the Container
docker run -d \
--name pterodisbot \
-v $(pwd)/bot-config:/app \
pterodisbot
6. Docker Compose (Recommended)
Create a docker-compose.yml file:
services:
pterodisbot:
build: .
environment:
# Remove brackets and spaces in environment variables
# Ideally, use .env file to assign values to these instead
- DISCORD_TOKEN={Your Discord bot token from Developer Portal}
- ALLOWED_GUILD_ID={Your Discord server ID from step 5 above}
- PANEL_URL={Your Pterodactyl panel URL with https://}
- CLIENT_API_KEY={Pterodactyl client API key starting with ptlc_}
- APPLICATION_API_KEY={Pterodactyl application API key starting with ptla_}
volumes:
- bot_logs:/app/logs
- bot_embed:/app/embed
restart: unless-stopped
volumes:
bot_logs:
bot_embed:
Then run:
docker-compose up -d
Kubernetes Installation
1. Clone the Repository
git clone https://git.serendipity.systems/k.eaven/pterodisbot.git
cd pterodactyl-discord-bot
2. Build and Push the Docker Image
docker build -t your-registry/pterodisbot:latest .
docker push your-registry/pterodisbot:latest
3. Create a Kubernetes Namespace (Optional but Recommended)
kubectl create namespace pterodisbot
4. Create a Kubernetes Secret with Your Configuration
kubectl create secret generic pterodisbot-config \
--from-literal=DISCORD_TOKEN='your-discord-bot-token' \
--from-literal=ALLOWED_GUILD_ID='your-discord-guild-id' \
--from-literal=PANEL_URL='https://your.pterodactyl.panel' \
--from-literal=CLIENT_API_KEY='ptlc_your-client-api-key' \
--from-literal=APPLICATION_API_KEY='ptla_your-application-api-key' \
-n pterodisbot
5. Create a PersistentVolumeClaim for Logs and Embed Data
# pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pterodisbot-data
namespace: pterodisbot
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
kubectl apply -f pvc.yaml
6. Create the Deployment
# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: pterodisbot
namespace: pterodisbot
labels:
app: pterodisbot
spec:
replicas: 1
selector:
matchLabels:
app: pterodisbot
template:
metadata:
labels:
app: pterodisbot
spec:
containers:
- name: pterodisbot
image: your-registry/pterodisbot:latest
imagePullPolicy: Always
envFrom:
- secretRef:
name: pterodisbot-config
volumeMounts:
- name: pterodisbot-data
mountPath: /app/logs
subPath: logs
- name: pterodisbot-data
mountPath: /app/embed
subPath: embed
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
exec:
command: ["python", "-c", "import sys; sys.exit(0)"]
initialDelaySeconds: 30
periodSeconds: 30
readinessProbe:
exec:
command: ["python", "-c", "import sys; sys.exit(0)"]
initialDelaySeconds: 10
periodSeconds: 10
volumes:
- name: pterodisbot-data
persistentVolumeClaim:
claimName: pterodisbot-data
kubectl apply -f deployment.yaml
7. (Optional) Create a Service for Metrics/Health Checks
# service.yaml
apiVersion: v1
kind: Service
metadata:
name: pterodisbot
namespace: pterodisbot
labels:
app: pterodisbot
spec:
selector:
app: pterodisbot
ports:
- name: http
port: 8080
targetPort: 8080
type: ClusterIP
kubectl apply -f service.yaml
8. (Optional) Create a HorizontalPodAutoscaler
# hpa.yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: pterodisbot
namespace: pterodisbot
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: pterodisbot
minReplicas: 1
maxReplicas: 3
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
kubectl apply -f hpa.yaml
9. Verify the Deployment
kubectl get pods -n pterodisbot
kubectl logs -n pterodisbot -l app=pterodisbot -f
10. For Production: Use Kustomize
Create a kustomization.yaml:
# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: pterodisbot
resources:
- pvc.yaml
- deployment.yaml
- service.yaml
- hpa.yaml
images:
- name: pterodisbot
newTag: latest
commonLabels:
app: pterodisbot
kubectl apply -k .
Verification
After installation, verify the bot is working:
- Check the bot appears online in your Discord server
- Use
/server_statuscommand to create your first status embed - Verify buttons work (Start/Stop/Restart/Show Address)
- Check logs for any errors:
# Traditional tail -f logs/pterodisbot.log # Docker docker logs -f pterodisbot # Kubernetes kubectl logs -n pterodisbot -l app=pterodisbot -f
Related Pages
- Architecture - System design
- Configuration - Config options
- Usage - Commands and workflows
- Features - Feature details
- Contributing - Development guidelines