A complete Discord bot with numerous features, developed in Python using discord.py.
- Features
- Installation
- How to Launch
- Configuration
- Project Structure
- Slash Commands
- Error Handling
- Notes
- Warnings
- Bug Reporting
/setlang [language]โ Change the bot's language (Englishenor Frenchfr) for the current server.- Complete Coverage โ All commands, system logs, and error responses are fully localized.
- Server-Specific Support โ Each server can have its own independent language setting.
- Persisted Preference โ Settings are saved in
bot/lang/config.jsonand persist across restarts.
/helpsโ Displays all available commands/pingโ Shows the bot's latency in ms/versionโ Displays the bot's version/report [message]โ Report a bug or send feedback/stopโ Stops the bot (owner only)/syncRe-sync slash commands (owner only)/clearslashโ Remove all slash commands (owner only)/slashinfoโ Display slash command diagnostics (owner only)
/clear [amount]โ Delete messages (max 70)/warn [@user] [reason] [count]โ Warn a user/resetwarn [@user]โ Reset user warnings/warnboardโ Show warnings leaderboard/kick [@user] [reason]โ Kick a user/ban [@user or ID] [reason]โ Ban a user/unban [ID]โ Unban a user/cleanraidsimple [name]โ Delete a channel by name/cleanraidmultiple [date] [time]โ Delete channels by date/giverole [@user] [@role]โ Give a role (owner only)/removerole [@user] [@role]โ Remove a role (owner only)/mp [@user or ID] [message]โ Send a private message/spam [count] [#channel or mention] [message]โ Spam messages (admin only)/banword [word]โ Add a banned word/unbanword [word]โ Remove a banned word/listbannedwordsโ Display all banned words
Per-Server System:
- Warns, banned words, and language are server-specific โ Each server has its own independent list of banned words, warns, and language preference.
- No cross-server data โ Settings from one server do not affect others.
Automatic Features:
- Banned word detection โ Automatically detects and deletes messages containing banned words (per server)
- Automatic warn โ Users receive a warn via DM when using a banned word (reason: "banned word used: [word]")
- Automatic sanctions โ 5 warns โ 10 min timeout ยท 10 warns โ 10 min timeout ยท 15 warns โ kick ยท 20 warns โ ban
- Role protection โ Protected roles are temporarily removed during sanctions and restored after timeout
- Sanctions are server-specific โ Warns are tracked separately for each server
/gpt [question]โ Ask GPT a question/dalle [prompt]โ Generate an image using DALLยทE/repeat [#channel or @user] [message]โ Repeat a message/8ball [question]โ Ask the magic 8-ball/hilaireโ Hilaire game/deldmsโ Delete all bot DMs (admin only)/tts [language] [volume] [text]โ Make the bot speak (e.g./tts en 3.0 Hello)
The bot automatically joins the user's voice channel and stays connected for other audio features.
Automatically converts social-media links for cleaner Discord embeds:
- Instagram โ
eeinstagram.com - Twitter/X โ
fxtwitter.com - Reddit โ
vxreddit.com(expands short links likeredd.it)
Original messages are deleted and replaced with the optimized link.
/slistโ List available sounds/splay [number]โ Play a sound (auto joins VC)/leaveโ Leave VC/sstopโ Stop sound/svolume [0-200]โ Set soundboard volume/srandomโ Play random sounds every 1โ5 min/srandomskipโ Skip current random sound/srandomstopโ Stop random playback/vkick [@user]โ Kick a user from VC (admin only)
Supported formats : MP3 / MP4 / M4A / OGG / OPUS / WAV / FLAC / AAC
New Interactive UI with Buttons:
- โฎ๏ธ Previous | โฏ๏ธ Play/Pause | โญ๏ธ Skip | ๐ Loop
- โช -15s | โฉ +15s | ๐ Queue | โน๏ธ Stop
Playback Commands:
/mplay [URL]โ Play a video or audio from any supported site (YouTube, TikTok, X, etc.)/msearch [query]โ Search and play with interactive menu/mskipโ Skip the current track/mstopโ Stop playback and clear queue/mpauseโ Pause the current track/mresumeโ Resume playback/leaveโ Disconnect from voice channel
Queue Management:
/mqueueโ Display the queue/mclearqueueโ Clear the queue/maddqueue [URL]โ Add song to queue without playing/mremovequeue [position]โ Remove song from queue
Advanced Controls:
-
/mloopโ Toggle loop mode -
/mpreviousโ Play the previous track -
/mseek [minutes] [seconds]โ Seek to specific time -
/mvolume [0-200]โ Set music volume (real-time, no restart) -
Dynamic Progress Bar โ "Now Playing" embed includes a visual progress bar
-
Universal Local Playback (โฎ๏ธ) โ The bot now automatically downloads all audio sources locally before playing. This ensures 100% stability, no buffering, and perfect seek/skip utility for every supported platform (YouTube, TikTok, SoundCloud, etc.).
-
Persistent UI โ The player message is only replaced when a new track starts. It stays visible even if the song ends or the queue is empty.
-
Universal Seek Support โ Skip buttons (+15s / -15s) now work perfectly for all platforms.
-
Session-Based Cleanup โ Temporary audio files are preserved during your session for stability and cleared only when you leave or stop.
-
Universal Exit Listener โ One-click cleanup even if the bot is kicked or timed out.
Supported platforms: see full list (YouTube, TikTok, X, Facebook, SoundCloud, Twitch, Vimeo, etc.)
Powered by yt-dlp.
/level [@user]โ View level/resetlevelโ Reset all levels (admin only)/levelsettingsโ Toggle leveling/levelboardโ Show leaderboard
Automatic Features:
- Automatic XP โ Each message = +1 XP (when leveling is enabled)
- Level up formula โ Level up when XP โฅ (level + 1)ยฒ
- Level up notification โ Automatic congratulation message when a user levels up
Zero configuration required! The bot is portable.
- Prerequisites: Have Python 3.8+ installed.
- Launch the bot:
- Double-click on
run.bat(Windows). - Or run
./run.sh(Linux/Mac).
- Double-click on
โจ Magic: On first launch, the bot will automatically:
- Install all Python dependencies (
discord.py,yt-dlp,openai, etc.) - Download FFmpeg (for audio/soundboard)
- Download Node.js (for AudioPlayer with yt-dlp)
All tools are installed in bot/bin/ and will not affect your system.
The bot automatically installs these packages from bot/core/requirements.txt
Required: You need a Discord bot token to run the bot.
- Go to Discord Developer Portal
- Create a new application or select an existing one
- Go to the Bot section
- Click Reset Token and copy your token
- Enable these Privileged Gateway Intents:
- โ Presence Intent
- โ Server Members Intent
- โ Message Content Intent
Current configuration: The bot reads the token from a file path specified in bot/core/main.py (line 31).
Default path:
'token_file': "C:/Users/Danie/Mon Drive/Autres/Bot Python Discord/token.txt"To configure:
- Edit
bot/core/main.pyline 31 with your desired path, OR - Create a
token.txtfile at the path specified inmain.py - Put your Discord token inside (just the token, nothing else)
Example token.txt:
MTIzNDU2Nzg5MDEyMzQ1Njc4.GhIjKl.MnOpQrStUvWxYz1234567890AbCdEfGhIjKlMnOp
.gitignore)
For better portability, you can use a .env file in the project root:
.env file:
DISCORD_TOKEN=your_token_here
GPT_TOKEN=your_gpt_token_hereNote: To use
.env, you need to modifybot/core/main.pyto load from environment variables instead of files.
The project includes convenient scripts in the root directory that automatically check for dependencies (Python, Node.js, FFmpeg).
Double-click on run.bat in the root folder, or run in terminal:
run.batMake the script executable and run it:
chmod +x run.sh
./run.shA comprehensive tool is available to reset the bot's data (warns, levels, logs, banned words) and clear cache to zero if needed.
Run:
python bot/tools/reset_bot.pyNote: This will perform a total cleanup of dynamic data and logs, but will preserve core configurations like update_logs.json.
Python-Discord-Bot/
โโโ run.bat # Launcher (Windows)
โโโ run.sh # Launcher (Linux/Mac)
โโโ bot/
โโโ bin/ # Portable tools (FFmpeg, Node.js) - Created automatically
โโโ core/ # Source Code
โ โโโ main.py # Entry point
โ โโโ run.py # Launcher logic & auto-installation
โ โโโ requirements.txt
โ โโโ services/ # Business logic (Audio, Leveling, Mod...)
โ โโโ slash_commands/ # Slash commands (/)
โ โโโ auto_commands/ # Auto commands & Error handling
โโโ json/ # Data (config, warns, levels...)
โโโ lang/ # Localization (fr.json, en.json)
โโโ img/ # Images / Assets
โโโ Sounds/ # Audio files for Soundboard
โโโ logs/ # Log files
โโโ tools/ # Admin scripts (reset_bot.py, clean_lang.py)
All commands are available as slash commands and sync automatically on startup. Use :
/syncโ Force sync/clearslashโ Remove all slash commands/slashinfoโ Diagnostics
Global sync may take up to 1 hour to propagate.
Comprehensive error system with centralized error handling:
- Unknown command
- Missing permissions
- Invalid arguments
- Cooldown active
- Owner-only command
- Not usable in DM
- HTTP errors
- Resource not found
- Attribute errors
All errors are also logged to the console with full tracebacks.
- Keep all tokens private
- Ensure required permissions are granted (including Intent
Message Content) - Some commands are restricted to admins or owners
Use :
/report [message]
to send feedback or report a bug. A ticket is automatically sent to the developer via webhook.
Developed with โค๏ธ in Python by NEVAR