Here’s a basic README.md file for your Discord bot that includes setup instructions, features, and usage details.
This is a Python-based Discord bot that includes music playback features, moderation commands, and custom role management. The bot uses discord.py for interaction with Discord and yt-dlp for downloading and playing audio from YouTube.
- 🎵 Music Player:
- Play songs from YouTube using voice commands.
- Supports queue management, volume control, and stop functionality.
- 🔒 Moderation Commands:
- Lock and unlock roles (e.g., remove/add roles from multiple members).
- Channel clear functionality to remove messages.
- Scheduled message deletion in specified channels.
- 📷 Image Posting:
- Post images with context to a designated channel.
- 🧹 Message Cleanup:
- Clear messages from command or specified channels.
- 🔊 Voice Channel Support:
- Play audio in voice channels directly from YouTube.
- Python 3.8+
- FFmpeg: Required for playing audio in voice channels.
- yt-dlp: Required for YouTube audio extraction.
- discord.py: For interacting with Discord's API.
git clone https://github.com/yourusername/discord-bot.git
cd discord-botpip install -r requirements.txt-
Download FFmpeg from Gyan.dev.
- Download the latest "ffmpeg-release-full.7z" from the Release Builds section.
-
Extract the archive using 7-Zip.
-
Add the
ffmpeg/binfolder to your system's PATH environment variable. -
Verify the installation by running:
ffmpeg -version
Create a .env file or replace the TOKEN, POST_CHANNEL_ID, COMMAND_CHANNEL_ID, QP_ROLE_NAME, and other channel/role settings directly in the main.py script.
DISCORD_TOKEN=your-discord-bot-token
POST_CHANNEL_ID=' '
COMMAND_CHANNEL_ID=' '
EXTRA_CLEAR_CHANNEL_ID=' '
QP_ROLE_NAME= ROLE_NAME
MOD_ROLES=["ROLE 1", "ROLE N"]
BOT_LOGS_CHANNEL_ID=' 'After setting up your bot token and channel IDs, you can start the bot by running:
python main.py!sing <song_name>: Search for a song on YouTube and play it in your current voice channel.!queue: Display the current song queue.!skip: Skip the currently playing song.!stop: Stop playing music and clear the queue.!volume <1-100>: Adjust the playback volume.
!post: Upload and post an image with context to a designated channel.!lockch: Remove the specified role (e.g., QP role) from all members in the server.!unlockch: Add the specified role (e.g., QP role) to all members in the server.!clear: Clear recent messages from the command channel or the specified channel.!stdelete <time>: Schedule a message deletion in command and post channels after a specified time.
-
Post Command:
!postPrompts the user to upload an image and then asks for context to post both in a designated channel.
-
Play Music:
!sing despacitoPlays "Despacito" from YouTube in your current voice channel.
- Modify the bot token and channel IDs to fit your server setup.
- Customize the role names and channel permissions as needed.
This project is licensed under the MIT License.