How to Make a Discord Bot with AI: 8 Starter Prompts
You can make a working Discord bot without writing the code yourself: describe what it should do in plain English, and an AI coding assistant writes it. People call this vibe coding. The hard part is the description. A vague request gets you code that crashes, leaks your token or floods a channel. Below are 8 copy-paste starter prompts for common Discord bots, simplest first, each one tested the way we explain next.
What "tested" means here (beta). On October 17, 2026 we gave each prompt, word for word, to an AI coding assistant and checked the Python code it wrote: it installs in a fresh environment, passes compile and lint checks, and starts up cleanly until the moment it needs a real bot token. We also checked each bot's logic offline: slash commands build correctly, the link filter catches our sample scam messages, and the alert bots handle live Steam and Epic data without reposting. None of these bots has been run in a live Discord server yet. AI assistants don't give the same answer twice, so your code will differ from ours: test it in a private server first.
Where a first version of a prompt led to bad code, we rewrote the prompt and tested again. That's why some prompts spell out details like "the first time a feed loads, only remember its videos".
Before you start: the setup basics
Every prompt below makes a bot that logs in with a token. Getting one takes about 5 minutes:
- Go to discord.com/developers/applications, click New Application and give it a name.
- Open Bot. Under Privileged Gateway Intents, switch on only the intents listed under your prompt. Most of these bots need none.
- Click Reset Token and copy the token into a file called
.envnext to the bot:DISCORD_TOKEN=your-token. - Invite the bot from the Installation page with the scopes and permissions listed under your prompt.
Never paste your token into an AI chat, a screenshot or a public repo. The token is your bot's password, and the assistant doesn't need it to write the code. If you paste an error message back to the assistant, check it doesn't contain the token. If a token ever leaks, click Reset Token: the old one stops working at once. Every prompt here asks for the token to be read from .env, and if you use git, add .env to .gitignore.
To run what the assistant gives you, install Python, open a terminal in the bot's folder and run:
python -m venv .venv
.venv\Scripts\activate # Windows (on Mac/Linux: source .venv/bin/activate)
pip install -r requirements.txt
python bot.py
Our guide to hosting a Discord bot on your PC for free covers the invite link, keeping the bot online and when 24/7 hosting is worth paying for.
How to use these prompts
- Paste the whole prompt, including the "Rules for the code" paragraph at the end. That paragraph keeps the token out of the code and keeps intents to a minimum.
- Change the details in plain English before you send it: other times, other channel names, extra options.
- Build one bot per chat. Once it runs, ask for one change at a time.
- When something breaks, paste the error message (without the token) and ask the assistant to explain the cause before it fixes it.
- Read what it says it needs in the Developer Portal. If it asks for Administrator or for intents your bot doesn't need, ask why.
1. A /rules slash command
One slash command that shows your server rules from a text file. Anyone can run it; by default only they see the answer. The easiest first bot: no privileged intents, no database.
Build a Discord bot with one slash command, /rules, that replies with my server rules as an embed. Keep the rules in a rules.txt file next to bot.py, one rule per line, and number them in the embed. Add an optional "public" option (true/false, default false): when false, only the person who asked sees the reply. Sync the slash commands to my server on startup, using a GUILD_ID from .env, so they appear straight away.
Rules for the code: use Python 3.10+ and discord.py 2.4 or newer. Read the bot token from a DISCORD_TOKEN environment variable loaded from a .env file with python-dotenv, and never write a token in the code. Turn on only the gateway intents this bot needs. Give me bot.py, requirements.txt, a .env.example and a short list of the Developer Portal settings and bot permissions to switch on.- Developer Portal
- No privileged intents. Invite scopes
botandapplications.commands; permissions Send Messages and Embed Links.
Tips
- Put your server ID in
GUILD_ID(turn on Developer Mode in Discord, then right-click the server icon → Copy Server ID). Commands synced to one server appear at once. - Edit
rules.txtany time; the bot reads it fresh on every/rules.
2. Welcome messages and an auto-role
Greets each new member in a channel you choose, points them at your rules channel and gives them a starter role, such as @Member.
Build a Discord bot that welcomes new members. When someone joins, post a message in the channel set by WELCOME_CHANNEL_ID in .env that mentions them and links the rules channel (RULES_CHANNEL_ID), then give them the role set by AUTO_ROLE_ID. Skip other bots. If adding the role fails because of missing permissions or role order, print a clear warning instead of crashing.
Rules for the code: use Python 3.10+ and discord.py 2.4 or newer. Read the bot token from a DISCORD_TOKEN environment variable loaded from a .env file with python-dotenv, and never write a token in the code. Turn on only the gateway intents this bot needs. Give me bot.py, requirements.txt, a .env.example and a short list of the Developer Portal settings and bot permissions to switch on.- Developer Portal
- Switch on Server Members Intent. Permissions: Send Messages and Manage Roles.
Tips
- Drag the bot's role above the role it hands out in Server Settings → Roles. Below it, Discord refuses with a missing-permissions error; the prompt asks for a clear warning instead of a crash.
- Discord's own Onboarding (Server Settings → Onboarding) can also give roles from questions. Use the bot when you want your own welcome text.
3. Reaction roles
Posts one message with an emoji per role. React to get the role, remove the reaction to lose it. Keeps working after a restart because the message ID is saved.
Build a reaction-roles bot. Store emoji-to-role-ID pairs in roles.json, for example {"🎮": 123, "🎧": 456}. Add an admin-only /reactionroles slash command that posts a message listing the roles, adds each emoji as a reaction, and saves that message's ID in roles.json. When a member adds one of those reactions to that message, give them the role; when they remove it, take the role away. Use raw reaction events so it keeps working after a restart, and ignore the bot's own reactions. Sync the slash commands to GUILD_ID from .env on startup.
Rules for the code: use Python 3.10+ and discord.py 2.4 or newer. Read the bot token from a DISCORD_TOKEN environment variable loaded from a .env file with python-dotenv, and never write a token in the code. Turn on only the gateway intents this bot needs. Give me bot.py, requirements.txt, a .env.example and a short list of the Developer Portal settings and bot permissions to switch on.- Developer Portal
- Switch on Server Members Intent. Permissions: Manage Roles, Add Reactions, Read Message History.
Tips
- Find a role's ID with Developer Mode on: Server Settings → Roles → right-click the role → Copy Role ID.
- For a custom server emoji, the key in
roles.jsonlooks like<:name:123456789>. Ask the assistant to explain this in its setup list. - Same role-order rule as prompt 2: the bot's role must sit above every role it gives out.
4. A giveaway with an Enter button
/giveaway posts a prize with an Enter button, takes one entry per member and picks random winners when time runs out.
Build a giveaway bot. Add a /giveaway slash command with options prize (text), minutes (1 to 10080) and winners (1 to 10), limited to members with Manage Server. It posts an embed with the prize and end time and an "Enter" button; each member can enter once and gets a private confirmation. When time is up, pick random winners from the entries, announce them in the same channel, and disable the button. Keeping running giveaways in memory is fine, but say in a comment that a restart cancels them. Sync the slash commands to GUILD_ID from .env on startup.
Rules for the code: use Python 3.10+ and discord.py 2.4 or newer. Read the bot token from a DISCORD_TOKEN environment variable loaded from a .env file with python-dotenv, and never write a token in the code. Turn on only the gateway intents this bot needs. Give me bot.py, requirements.txt, a .env.example and a short list of the Developer Portal settings and bot permissions to switch on.- Developer Portal
- No privileged intents. Scopes
botandapplications.commands; permissions Send Messages, Embed Links and Read Message History (for the reply that names the winners).
Tips
- Giveaways live in memory, so restarting the bot cancels any that are still running. That's fine on a PC you leave on; for week-long giveaways, ask the assistant to save them to a file.
- Just want a quick vote? Discord has built-in polls in the message box, no bot needed.
5. YouTube upload alerts
Checks your YouTube channels every 10 minutes and posts each new video once. New channels and restarts never flood the channel with old videos.
Build a Discord bot that posts new YouTube uploads. Read YouTube channel IDs (they start with UC) from youtube_channels.txt, one per line. Every 10 minutes, fetch each channel's RSS feed at https://www.youtube.com/feeds/videos.xml?channel_id=ID and post the link of every video it hasn't posted before to the channel set by ANNOUNCE_CHANNEL_ID in .env. Save posted video IDs per YouTube channel in posted.json so a restart doesn't repost anything. The first time a channel's feed loads, only remember its current videos without posting them, so adding a channel never floods Discord. Use aiohttp. YouTube's feed sometimes returns 404 or 500 for a few hours: log it, skip that channel and try again next time, without stopping the others.
Rules for the code: use Python 3.10+ and discord.py 2.4 or newer. Read the bot token from a DISCORD_TOKEN environment variable loaded from a .env file with python-dotenv, and never write a token in the code. Turn on only the gateway intents this bot needs. Give me bot.py, requirements.txt, a .env.example and a short list of the Developer Portal settings and bot permissions to switch on.- Developer Portal
- No privileged intents. Permissions: Send Messages and Embed Links (so the video preview shows).
Tips
- Our YouTube notifications guide shows how to find a channel ID that starts with UC.
- During our test YouTube's feed returned 404 for every channel, a known YouTube-side problem that comes and goes for hours. That's why the prompt asks the bot to skip and retry instead of giving up.
6. Steam patch notes poster
Posts each new official announcement for your Steam games as a tidy embed with the title, link, date and a short preview.
Build a Discord bot that posts Steam patch notes. Read Steam App IDs from steam_games.txt, one per line. Every 30 minutes, call https://api.steampowered.com/ISteamNews/GetNewsForApp/v2/?appid=ID&count=5&feeds=steam_community_announcements for each game and post each new item to the channel set by PATCH_CHANNEL_ID in .env as an embed with the title, link, date and the first 300 characters of the text with BBCode and HTML tags removed. Remember posted item IDs (gid) per game in posted.json. The first time a game's news loads, only remember its current items without posting them, so adding a game never floods Discord. Use aiohttp, and don't let one failed request stop the others.
Rules for the code: use Python 3.10+ and discord.py 2.4 or newer. Read the bot token from a DISCORD_TOKEN environment variable loaded from a .env file with python-dotenv, and never write a token in the code. Turn on only the gateway intents this bot needs. Give me bot.py, requirements.txt, a .env.example and a short list of the Developer Portal settings and bot permissions to switch on.- Developer Portal
- No privileged intents. Permissions: Send Messages and Embed Links.
Tips
- The App ID is the number in a game's Steam store address, such as 440 in
store.steampowered.com/app/440. - Big games post event news too, not only patches. Our Steam patch notes guide covers filtering.
7. Free Epic games alerts
Checks the Epic Games Store every 3 hours and posts each game that's free to keep right now, once, with the end date and cover image.
Build a Discord bot that posts free Epic Games Store games. Every 3 hours, fetch https://store-site-backend-static.ak.epicgames.com/freeGamesPromotions?locale=en-US&country=US and find games that are free to keep right now: an active promotional offer with discountPercentage 0 and a current price (price.totalPrice.discountPrice) of 0. Post each new one to FREE_GAMES_CHANNEL_ID from .env as an embed with the title, the end date of the offer, the store link (https://store.epicgames.com/p/ plus the pageSlug from offerMappings or catalogNs.mappings, falling back to productSlug) and the wide cover image if there is one. Remember posted games by id plus offer end date in posted.json so the same giveaway is posted only once, and handle missing fields without crashing, because this endpoint is undocumented.
Rules for the code: use Python 3.10+ and discord.py 2.4 or newer. Read the bot token from a DISCORD_TOKEN environment variable loaded from a .env file with python-dotenv, and never write a token in the code. Turn on only the gateway intents this bot needs. Give me bot.py, requirements.txt, a .env.example and a short list of the Developer Portal settings and bot permissions to switch on.- Developer Portal
- No privileged intents. Permissions: Send Messages and Embed Links.
Tips
- The Epic address in this prompt is the one Epic's own store uses. It isn't documented, so it can change; the prompt asks for code that won't crash on missing fields.
- Steam freebies are trickier: our free game alerts guide explains why. You can also check our live list of free Epic and Steam games.
8. Scam-link auto-mod
Deletes invites to other servers, masked links and links to domains you block, logs each one safely for your moderators and times out repeat offenders.
Build a moderation bot that deletes scam links. Delete a message, new or edited, if it contains a Discord invite to another server, a masked link written like [text](https://...), or a link to a domain listed in blocked_domains.txt (one per line, subdomains included). Don't touch messages from bots, from members with the Manage Messages permission, or from members with a role in TRUSTED_ROLE_IDS (comma-separated in .env). After deleting, post a note in MOD_LOG_CHANNEL_ID with who, which channel and the message text in a code block with "http" changed to "hxxp" so nothing is clickable. If the same member is caught 3 times within 10 minutes, time them out for 10 minutes. Allow invites to my own server: read its invite codes from ALLOWED_INVITES in .env.
Rules for the code: use Python 3.10+ and discord.py 2.4 or newer. Read the bot token from a DISCORD_TOKEN environment variable loaded from a .env file with python-dotenv, and never write a token in the code. Turn on only the gateway intents this bot needs. Give me bot.py, requirements.txt, a .env.example and a short list of the Developer Portal settings and bot permissions to switch on.- Developer Portal
- Switch on Message Content Intent. Permissions: View Channels, Manage Messages, Moderate Members, plus Send Messages in your mod-log channel.
Tips
- Set up Discord's free AutoMod first; our scam links guide walks through it. A bot like this one covers what AutoMod can't, such as allowing only your own invite.
- Test from a normal account: anyone with Manage Messages is skipped on purpose, so your own admin test messages won't be deleted.
- The bot only sees edits to messages it saw arrive while it was running.
When the code doesn't start
| Error | What it usually means |
|---|---|
LoginFailure: Improper token | The token in .env is wrong or old. Reset it and paste it again, without quotes or spaces. |
PrivilegedIntentsRequired | The code asks for an intent you haven't switched on in the Developer Portal's Bot page. |
| Slash commands don't appear | The bot was invited without the applications.commands scope, or GUILD_ID is wrong. Commands synced to one server show up at once; global ones can take a while. |
403 Forbidden (Missing Permissions) | The bot lacks a permission in that channel, or its role sits below the role it's trying to give or time out. |
ModuleNotFoundError | Run pip install -r requirements.txt inside the same environment you start the bot from. |
When to just use a ready-made bot
Vibe coding is a great way to get exactly the small bot you want, and to learn how bots work. It gets harder once a bot has to run for months: Discord and the sites it reads change, a missed edge case floods a channel, and you're the one who has to debug it.
If you'd rather skip that part, our bots are finished versions of several prompts above, tested on real data, as source code you own and run yourself: the Discord Mod Bot ($15, prompts 2 and 8, live-tested on a real Discord server), the Stream Alert Bot ($12, prompt 5 plus Twitch), the Patch Tracker ($12, prompt 6) and the Free Games Radar (free, prompt 7 plus Steam). The Gaming Community Kit ($25) puts moderation, welcome messages, free games, Steam deals and patch notes in one bot, and the bundle has all 10 of our bots ($29 launch price). For a rules command, reaction roles or giveaways, the prompts above are the faster route.
Sources
- Discord Developer Docs: Building your first Discord Bot
- Discord Developer Docs: Gateway intents (privileged intents)
- discord.py documentation: Intents primer
- discord.py documentation: Interactions API (slash commands, buttons)
- Discord: Role management 101 (role order)
- Steamworks Documentation: ISteamNews (GetNewsForApp)