This is a comprehensive Discord bot designed to enhance server moderation, manage user roles, and provide utility features.
The bot includes the following key functionalities:
- Scam Message Detection: Utilizes a machine learning model to identify and delete messages containing scam attempts.
- Suspicious Link Blocking: Automatically detects and removes messages with suspicious links.
- User Timeout: Temporarily mutes users who send scam messages or suspicious links.
- Webhook Notifications: Sends alerts to a designated webhook channel for detected scam activities.
- General Spam Detection: Monitors message frequency to prevent rapid-fire spam.
- Duplicate Message Detection: Identifies and acts upon repeated messages (copy-paste spam).
- Spotify Spam Prevention: Detects and handles spam related to Spotify links, RPC, and embeds.
- Configurable Thresholds: Administrators can set custom limits for various spam types using slash commands (
/set_spam_threshold,/set_duplicate_threshold,/set_spotify_threshold). - Automated Punishment: Deletes spam messages and applies timeouts to spammers.
- Webhook Logging: Logs all detected spam incidents to a webhook channel.
- Invite Link Blocking: Automatically deletes messages containing Discord invite links to prevent unauthorized advertising.
- General Discord Advertising Prevention: Blocks messages that attempt to advertise other Discord servers.
- Edit Monitoring: Catches and deletes invite/advertising links even if they are added via message edits.
- New Member Pings: Pings newly joined members in specified channels after a short delay, welcoming them to the server.
- Mute/Unmute Commands: Allows moderators to timeout and remove timeouts from users (
/mute,/unmute). - Ban Request System: Provides a form-based system (
/form-ban) for moderators to request user bans, which can then be approved or denied by senior moderators via interactive buttons. - Direct Ban Command: Senior moderators can directly ban users (
/ban). - Moderator Management: Commands to add and remove moderator roles (
/moder-add,/moder-remove). - Reprimand System: Implements a warning system for moderators (
/vig-add,/vig-remove). Accumulating three reprimands automatically removes the moderator role. - Comprehensive Logging: All moderation actions are logged to dedicated channels.
- Error Handling: Robust error handling for permissions, user not found, and command cooldowns.
- SQLite Database: Uses an SQLite database to persist moderator reprimand counts.
- Role Verification: Assigns a special "verified" role to users who meet specific criteria (e.g., having "discord.gg/pon" in their custom status or "ᵐˢᶜ" in their global name).
- Periodic Re-verification: Regularly checks if verified users still meet the criteria and removes the role if they don't.
- Interactive Verification: Provides a user-friendly verification process with language selection and a "Check" button.
- Dynamic Channel Creation: Users automatically get a private voice channel when they join a designated "creator channel".
- Automatic Deletion: Private channels are automatically deleted when they become empty.
- Control Panel: Owners of private voice channels can manage their rooms using an interactive panel with options for:
- User Limit: Set the maximum number of participants.
- Kick User: Remove specific users from the channel.
- Visibility: Make the channel visible or hidden to others.
- Lock/Unlock: Restrict or allow entry to the channel.
- Access Control: Grant, revoke, or reset individual user permissions for the channel.
- Multi-language Support: The control panel supports both Russian and English.
- Python 3.13+
uv(a fast Python package installer and resolver)- Docker and Docker Compose (optional, for containerized deployment)
-
Clone the repository:
git clone https://github.com/xdearboy/mscbots-main.git cd mscbots-main/MSCHelper -
Install
uv: If you don't haveuvinstalled, you can install it viapip:pip install uv
-
Install dependencies:
uv sync
-
Ensure Docker and Docker Compose are installed.
-
Navigate to the project root:
cd mscbots-main/MSCHelper -
Build and run the Docker containers:
docker-compose up --build
This will build the Docker image and start the bot.
The bot requires a Discord bot token to run. You need to directly replace the placeholder token in main.py with your actual bot token.
Open main.py and change the line:
token = "token"to:
token = "YOUR_ACTUAL_BOT_TOKEN_HERE"Warning: Hardcoding your bot token directly in the code is generally not recommended for security reasons. For production environments, consider using environment variables or a secure configuration management system.
After replacing the token in main.py and installing dependencies:
uv run main.pyAfter replacing the token in main.py and building the containers:
docker-compose upTo run in detached mode (in the background):
docker-compose up -dThe bot primarily uses slash commands (e.g., /mute, /set_spam_threshold). You can find a list of available commands and their descriptions by typing / in your Discord server where the bot is active.