A modular and efficient Discord bot built with Python and discord.py. Designed for seamless server management and user engagement, it features a modular architecture that provides various administrative tools, automated moderation, content notifications, and entertainment modules with a focus on Formula 1.
- Automated Moderation: Actively monitors messages to detect and mitigate spam, including excessive links, mentions, and formatting abuse. Includes designated promotion channel rules (restricting posts to YouTube links only) and restricts
@everyone/@herementions to admin roles. - YouTube Notifications: Monitors specified YouTube channels and alerts your Discord server of new video uploads.
- Kick Live Notifications: Polls specified Kick channels and alerts your Discord server when a streamer goes live.
- Creator Milestones: Announces follower/subscriber milestones for tracked YouTube and Kick channels.
- Formula 1 Integration: Delivers real-time F1 driver and constructor standings, upcoming race schedules with track layouts, and historical race data.
- Experience & Leveling: Tracks user engagement through a local SQLite database, awarding XP and managing level progression.
- Warning & Timeout System: Allows moderators to issue warnings and automatically applies timeouts upon reaching thresholds (e.g., 3rd or 5th warning).
- Remote Messaging: Empowers bot administrators to proxy messages to specific channels or reply to direct messages securely.
- Python 3.8 or higher
- Dependencies listed in
requirements.txt - A valid Discord Bot Token
-
Clone the Repository
git clone https://github.com/Adarsh-Aravind/DiscordBot-F1.git cd DiscordBot-F1 -
Install Dependencies It is recommended to use a virtual environment.
pip install -r requirements.txt
-
Environment Configuration Create a
.envfile in the root directory to store your sensitive credentials:DISCORD_TOKEN=your_bot_token_here # YouTube upload alerts: Discord channel IDs to post in YT_CHANNEL_1=discord_channel_id YT_CHANNEL_2=discord_channel_id YT_CHANNEL_3=discord_channel_id # Kick live alerts: Discord channel ID to post "went live" notifications in KICK_CHANNEL_1=discord_channel_id
The Kick channel(s) to monitor are configured in the
CHANNELSmap incogs/kick.py(default:abitbeast). -
Bot Ownership Configuration Update the
OWNER_IDSset inmain.pywith the Personal Discord User IDs of the bot administrators to permit administrative commands. -
Running the Bot
python main.py
Note: An SQLite database will be automatically generated upon the initial run to handle leveling and YouTube notification history.
The default command prefix is #.
#reply <user_id> <message>: Sends a direct message to a user.#say <channel_id> <message>: Relays a message to a specific channel.#setpresence <type> <text>: Updates the bot's rich presence status.#levelreset [user]: Resets XP and level data for a specific user, or truncates the database if left blank.#warn <member> <reason>: Warns a member and applies auto-timeouts on specific thresholds.#warnings <member>: Lists a member's warnings.#clearwarns <member>: Clears all warnings for a member.#delwarn <id>: Deletes a specific warning.
#help: Displays a list of available commands.#status: Shows current server statistics and health metrics.#ping: Evaluates the bot API response latency.#rank: Displays the user's localized XP and level progression.
#f1: Displays a snapshot of the current season standings and next race.#f1next: Provides schedule and track information for the upcoming race.#f1last: Retrieves results for the most recently completed race.#f1c {circuit}: Queries details and history for a specific circuit.#f1con: Outputs constructor standings.#f1dri: Outputs driver standings.
This bot utilizes discord.ext.commands.Cog to compartmentalize functionality:
general: Basic bot operations and status checks.messaging: Administrative proxy messaging.leveling: Local database-driven user experience tracking.antispam: Message monitoring and automated moderation.youtube: Automated YouTube upload feeds.kick: Kick live-stream "went live" notifications.milestones: YouTube and Kick subscriber/follower milestone announcements.f1: Real-time and historical Formula 1 data retrieval.warnings: Moderator warning and automatic timeout system.
This project is provided as-is without any warranties. Please adhere to Discord's Developer Terms of Service when operating your bot instances.