Skip to content

Latest commit

Β 

History

History
97 lines (78 loc) Β· 2.18 KB

File metadata and controls

97 lines (78 loc) Β· 2.18 KB

Discord Music Bot

A Discord bot for playing music from YouTube with slash commands.

Features

  • 🎡 Play music from YouTube (search or URL)
  • πŸ“‹ Queue management (add, remove, clear)
  • ⏯️ Playback controls (play, pause, resume, skip)
  • πŸ‘€ View user profile pictures
  • πŸ“ Latency check

Project Structure

simple-discord-bot-python/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ bot.py              # Bot initialization
β”‚   β”œβ”€β”€ cogs/
β”‚   β”‚   β”œβ”€β”€ music.py        # Music commands
β”‚   β”‚   └── general.py      # Utility commands
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   └── youtube.py      # YouTube audio service
β”‚   └── utils/
β”‚       └── helpers.py      # Helper functions
β”œβ”€β”€ config/
β”‚   └── settings.py         # Configuration
β”œβ”€β”€ main.py                 # Entry point
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ Dockerfile
└── .env.example

Slash Commands

Command Description
/play <search> Play music from YouTube
/stop Pause the current music
/resume Resume paused music
/skip Skip to the next song
/join Join your voice channel
/disconnect Leave the voice channel
/queue Show the music queue
/clear Clear the queue
/nowplaying Show current song
/removequeue <index> Remove song from queue
/ping Check bot latency
/profile <user> View profile picture

Setup

  1. Clone the repository

    git clone https://github.com/yourusername/simple-discord-bot-python.git
    cd simple-discord-bot-python
  2. Create virtual environment

    python -m venv venv
    source venv/bin/activate  # Linux/macOS
    venv\Scripts\activate     # Windows
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment

    cp .env.example .env
    # Edit .env and add your Discord token
  5. Run the bot

    python main.py

Docker

docker build -t discord-bot .
docker run -d --env-file .env discord-bot

Requirements

  • Python 3.11+
  • FFmpeg (for audio playback)
  • Discord Bot Token

License

MIT