Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Discord Bot Template

Docker Python discord.py

A production-ready Discord bot with slash commands, colored logging, and Docker development workflow.

✨ Features

  • πŸš€ Modern Slash Commands - Discord's latest command system
  • 🎨 Colored Logging - Beautiful console output with file rotation
  • 🐳 Docker Development - Edit locally, run in container
  • πŸ“Š Environment Configs - Development/production/minimal modes
  • πŸ”§ Auto Setup - Smart initialization and file copying

πŸš€ Quick Start

Prerequisites

Setup

git clone https://github.com/skriptzip/discordbot.git
cd discordbot

# Configure environment
cp .env.example .env
# Edit .env with your DISCORD_TOKEN

# Start bot
docker-compose up -d

# View logs
docker-compose logs -f

πŸ“ Structure

discordbot/
β”œβ”€β”€ bot/
β”‚   β”œβ”€β”€ bot.py                  # Main bot file
β”‚   β”œβ”€β”€ example_commands.py     # Example slash commands
β”‚   β”œβ”€β”€ bot_logging/            # Colored logging system
β”‚   └── requirements.txt        # Dependencies
β”œβ”€β”€ data/                       # Persistent data (volume mapped)
β”‚   └── logs/                   # Log files
β”œβ”€β”€ docker-compose.yml          # Development environment
└── Dockerfile                  # Container build

🎯 Available Commands

Command Description
/ping Check bot latency
/status Show bot statistics
/hello Friendly greeting
/serverinfo Server information
/userinfo [user] User information
/logtest Demonstrate colored logging (admin only)

πŸ”§ Development

Adding Commands

Edit bot/bot.py or create new files:

@app_commands.command(name="hello", description="Say hello")
async def hello_slash(interaction: discord.Interaction):
    await interaction.response.send_message("Hello!")

bot.tree.add_command(hello_slash)

Environment Variables

DISCORD_TOKEN=your_token_here
LOG_ENVIRONMENT=production  # development/production/minimal
FORCE_COLOR=1              # Enable colored logs

Managing Dependencies

  1. Edit bot/requirements.txt
  2. Rebuild: docker-compose up --build -d

ℹ️ Logging

The bot features a comprehensive colored logging system:

  • πŸ” DEBUG (cyan) - Detailed debugging info
  • ℹ️ INFO (green) - General information
  • ⚠️ WARNING (yellow) - Important notices
  • ❌ ERROR (red) - Error conditions
  • 🚨 CRITICAL (bright red) - Critical failures

Viewing Logs

# Container logs (colored)
docker-compose logs -f

# File logs
tail -f ./data/logs/bot.log
tail -f ./data/logs/discord.log

About

🟣 A production-ready Discord bot template with slash commands, colored logging, and Docker development workflow.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

Used by

Contributors

Languages