This guide walks you through installing and setting up Bot Shock on your server.
Before you begin, make sure you have:
- Python 3.10 or higher (Python 3.11 to 3.13 recommended)
- A Discord bot account with the necessary permissions
- An OpenShock or PiShock account with API access
- A Linux, Windows, or macOS computer or server
sudo apt update
sudo apt install python3.11 python3.11-pip python3.11-venvbrew install python@3.11Download Python from python.org and run the installer. Make sure to check "Add Python to PATH" during installation.
If you have git installed:
git clone https://github.com/TastelessVoid/Bot-Shock
cd BotShockAlternatively, download the ZIP file from GitHub, extract it, and navigate to the folder.
Using a virtual environment keeps the bot's dependencies separate from your system Python. This is recommended but not required.
python3 -m venv venvActivate the virtual environment:
On Linux or macOS:
source venv/bin/activateOn Windows:
venv\Scripts\activateInstall the bot in development mode, which makes updating easier:
pip install -e .Or install it normally:
pip install .This installs Bot Shock along with all its dependencies, including disnake for Discord, aiohttp for API communication, python-dotenv for configuration, cryptography for securing API tokens, and aiosqlite for the database.
Bot Shock encrypts your OpenShock and PiShock API tokens before storing them in the database. Generate an encryption key with:
botshock-keygenSave the output somewhere secure. You will need it in the next step.
Create a file named .env in the project directory:
touch .envOpen it in a text editor and add the following:
# Required
DISCORD_TOKEN=your_discord_bot_token_here
ENCRYPTION_KEY=your_generated_encryption_key_here
# Optional (uncomment to customize)
# DATABASE_PATH=botshock.db
# DATABASE_POOL_SIZE=5
# LOG_LEVEL=INFO
# LOG_DIR=logs
# API_BASE_URL=https://api.openshock.app
# API_TIMEOUT=10
# API_MAX_CONNECTIONS=100
# API_REQUESTS_PER_MINUTE=60- Go to the Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "Bot" section in the left sidebar
- Click "Reset Token" and copy the token
- Paste it into your
.envfile
Your bot needs these Discord permissions to work properly:
- Send Messages
- Embed Links
- Read Message History
- Use Slash Commands
- Attach Files
The permission integer for these is 2147600384.
Use this URL template, replacing YOUR_CLIENT_ID with your bot's client ID from the Developer Portal:
https://discord.com/api/oauth2/authorize?client_id=YOUR_CLIENT_ID&permissions=2147600384&scope=bot%20applications.commands
botshockYou should see log messages indicating the bot is starting up and connecting to Discord.
In your Discord server, run the command:
/openshock setup
or
/pishock setup
If a registration form appears asking for your credentials, the bot is working correctly.
Make sure your .env file is in the same directory where you run the bot. Check for typos and ensure there are no extra spaces around the equals sign.
Run botshock-keygen to generate a key and add it to your .env file.
Make sure you invited the bot with the correct permissions, including the applications.commands scope. Discord may take a few minutes to register slash commands after the bot first connects.
Make sure you installed the package with pip install -e . and that your virtual environment is activated.
Check that the bot has write permissions in its directory. If the database file exists, make sure it is not locked by another process.
If you installed in development mode:
git pullThen restart the bot. If dependencies have changed, run:
pip install --upgrade -e .Create a file at /etc/systemd/system/botshock.service:
[Unit]
Description=Bot Shock Discord Bot
After=network.target
[Service]
Type=simple
User=your_username
WorkingDirectory=/path/to/BotShock
Environment="PATH=/path/to/BotShock/venv/bin"
ExecStart=/path/to/BotShock/venv/bin/botshock
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetThen enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable botshock
sudo systemctl start botshock
sudo systemctl status botshockscreen -S botshock
cd /path/to/BotShock
source venv/bin/activate
botshockPress Ctrl+A then D to detach from the session. Reattach later with screen -r botshock.
- Read the Configuration Guide for all available settings
- See the Command Reference to learn what the bot can do
- Follow the User Guide to set up your first account