2.9 KiB
2.9 KiB
Docker Guide for Cat Bot
This guide will help you run the Discord cat bot using Docker, which provides an isolated and consistent environment for the bot to run.
Prerequisites
- Docker installed on your system
- Docker Compose installed on your system
- A valid Discord bot token in your
.env
file
Setup
- Make sure your
.env
file is properly configured with your Discord bot token and other settings:
DISCORD_TOKEN=your_discord_bot_token
# Message response chance (0-100)
MESSAGE_RESPONSE_CHANCE=10
# Voice channel settings
MIN_VOICE_JOIN_INTERVAL=300
MAX_VOICE_JOIN_INTERVAL=1800
MIN_VOICE_STAY_DURATION=60
MAX_VOICE_STAY_DURATION=300
MIN_VOICE_MEOW_INTERVAL=5
MAX_VOICE_MEOW_INTERVAL=30
# Cat personalization
CAT_PRONOUN=their
- Add your cat sound files to the
src/audio
directory (create it if it doesn't exist):- meow1.mp3
- meow2.mp3
- meow3.mp3
- purr.mp3
- hiss.mp3
- yowl.mp3
Running the Bot
Easy Method
Use the included helper script:
# Make it executable
chmod +x run-docker.sh
# Run it
./run-docker.sh
This script will set the correct user permissions, build, and run the container showing logs.
Manual Method
From the project root directory:
# Export your user ID and group ID
export UID=$(id -u)
export GID=$(id -g)
# Start the container
docker-compose up -d
# View logs
docker-compose logs -f
Stopping the Bot
To stop the bot:
docker-compose down
Updating the Bot
If you make changes to the bot code:
- Stop the bot:
docker-compose down
- Rebuild the image:
docker-compose build
- Start the bot again:
docker-compose up -d
Troubleshooting
Audio File Issues
If the bot isn't playing sounds in voice channels:
- Check that your audio files exist in the
src/audio
directory - Verify they're in MP3 format and match the expected filenames
- Look at the container logs to see if the files are being detected:
docker-compose logs | grep "audio"
Bot Token Issues
If the bot can't connect to Discord:
- Make sure your
.env
file is properly mounted in the container - Check that your token is valid and privileged intents are enabled
- Verify logs for any connection errors:
docker-compose logs
File Permission Issues
If you encounter file permission problems:
- Use the
run-docker.sh
script which sets proper user IDs - Or manually set the user ID when running:
export UID=$(id -u) GID=$(id -g) docker-compose up -d
Container Not Starting
If the container fails to start or continuously restarts:
- Check the logs:
docker-compose logs
- Verify your container has network access to reach Discord's servers
- Make sure you have ffmpeg installed in the container:
docker-compose exec cat-bot apk info | grep ffmpeg