3 saat önce
(En Son Düzenleme: 3 saat önce, Düzenleyen: Juniorboss.)
Hello everyone,
In this guide, I’ll show you how to create a modern Discord bot from scratch using the latest
version.
We’ll build:
What Will You Learn?
1. Requirements
You’ll need:
https://python.org
2. Creating a Discord Bot Application
Go to:
https://discord.com/developers/applications
Then:
3. Enable Required Intents
Inside the Bot section, enable:
4. Invite the Bot to Your Server
Open:
OAuth2 → URL Generator
Select:
Scopes
For beginners, you can use:
Invite the bot to your server.
5. Project Setup
Open terminal:
Create virtual environment:
Activate it:
Windows
Linux / Mac
6. Install Required Packages
Install
and
support:
Verify installation:
7. Creating Your First Discord Bot
Create a file called:
Paste this code:
8. Secure Your Token with .env
Create a file called:
Paste:
IMPORTANT:
Never upload this file to GitHub.
Create
:
9. Run the Bot
Start the bot:
If everything works correctly you should see:
Now test:
10. Embed Command Example
Modern Discord bots use embeds heavily.
Example:
11. Best Free Hosting Options (2026)
Platform
Free Plan
Difficulty
NotesRailway
Yes
Easy
Best beginner option
Render
Yes
Easy
Stable free hosting
Replit
Limited
Easy
Good for testing
VPS
No
Medium
Best performance
Self-hosted
Depends
Hard
Full control
12. Running Your Bot 24/7
Railway
Probably the easiest method in 2026.
Render
Good free alternative.
VPS
Best for serious projects.
Useful commands:
or use PM2:
13. Common Beginner Mistakes
Slash Commands Not Showing
Try:
Invalid Token Error
Your token is wrong or expired.
Reset it inside:
Developer Portal → Bot → Reset Token
Message Content Intent Error
Enable intents inside:
Developer Portal → Bot
Bot Offline
Check:
14. Recommended Folder Structure
As your bot grows:
This structure scales much better for larger bots.
15. AI Discord Bots in 2026
AI bots are huge right now.
Popular integrations:
16. Security Tips
Never leak:
17. Should You Use discord.py in 2026?
Yes.
is still:
18. Final Thoughts
Discord bot development is still growing fast in 2026.
If you’re starting now, focus on:
Next Tutorials?
I can also create guides for:
Good luck building your Discord bot 🚀
In this guide, I’ll show you how to create a modern Discord bot from scratch using the latest
Kod:
discord.py 2.7We’ll build:
- Slash command based bot
- Modern and stable structure
- Secure token system with
Kod:.env - Beginner friendly setup
- Ready for 2026 Discord API standards
What Will You Learn?
- Creating a Discord bot account
- Basic bot structure
- Slash commands (
,Kod:/ping
)Kod:/hello
- token securityKod:
.env
- Running your bot 24/7
- Basic embeds
- Common troubleshooting
- Hosting methods
1. Requirements
You’ll need:
- Python 3.10+ (recommended: Python 3.12)
- VS Code or any text editor
- A Discord account
https://python.org
2. Creating a Discord Bot Application
Go to:
https://discord.com/developers/applications
Then:
- Click New Application
- Give your bot a name
- Click Create
- Open the Bot tab
- Click Add Bot
- Confirm
- Click Reset Token
- Copy your token
- NEVER share this token publicly
3. Enable Required Intents
Inside the Bot section, enable:
- Presence Intent
- Server Members Intent
- Message Content Intent
4. Invite the Bot to Your Server
Open:
OAuth2 → URL Generator
Select:
Scopes
- Kod:
bot - Kod:
applications.commands
For beginners, you can use:
- Administrator
Invite the bot to your server.
5. Project Setup
Open terminal:
Kod:
mkdir my-discord-bot
cd my-discord-botCreate virtual environment:
Kod:
python -m venv venvActivate it:
Windows
Kod:
venv\Scripts\activateLinux / Mac
Kod:
source venv/bin/activate6. Install Required Packages
Install
Kod:
discord.pyKod:
.envKod:
pip install discord.py python-dotenvVerify installation:
Kod:
pip list7. Creating Your First Discord Bot
Create a file called:
Kod:
main.pyPaste this code:
Kod:
import discord
from discord import app_commands
import os
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
class MyBot(discord.Client):
def __init__(self):
super().__init__(intents=intents)
self.tree = app_commands.CommandTree(self)
async def setup_hook(self):
await self.tree.sync()
print("Slash commands synced!")
bot = MyBot()
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
await bot.change_presence(
activity=discord.Game("/help")
)
# Ping command
@bot.tree.command(
name="ping",
description="Shows bot latency"
)
async def ping(interaction: discord.Interaction):
latency = round(bot.latency * 1000)
await interaction.response.send_message(
f"🏓 Pong! `{latency}ms`"
)
# Hello command
@bot.tree.command(
name="hello",
description="Say hello to the bot"
)
async def hello(interaction: discord.Interaction):
await interaction.response.send_message(
f"Hello {interaction.user.mention}! 👋"
)
bot.run(TOKEN)8. Secure Your Token with .env
Create a file called:
Kod:
.envPaste:
Kod:
DISCORD_TOKEN=YOUR_BOT_TOKEN_HEREIMPORTANT:
Never upload this file to GitHub.
Create
Kod:
.gitignoreKod:
.env
venv/
__pycache__/9. Run the Bot
Start the bot:
Kod:
python main.pyIf everything works correctly you should see:
Kod:
Logged in as YourBotName
Slash commands synced!Now test:
- Kod:
/ping - Kod:
/hello
10. Embed Command Example
Modern Discord bots use embeds heavily.
Example:
Kod:
@bot.tree.command(
name="info",
description="Shows bot info"
)
async def info(interaction: discord.Interaction):
embed = discord.Embed(
title="🤖 My Discord Bot",
description="Modern discord.py bot for 2026",
color=0x00ff00
)
embed.add_field(
name="Latency",
value=f"{round(bot.latency*1000)}ms"
)
embed.set_footer(
text=f"Requested by {interaction.user}"
)
await interaction.response.send_message(
embed=embed
)11. Best Free Hosting Options (2026)
Platform
Free Plan
Difficulty
NotesRailway
Yes
Easy
Best beginner option
Render
Yes
Easy
Stable free hosting
Replit
Limited
Easy
Good for testing
VPS
No
Medium
Best performance
Self-hosted
Depends
Hard
Full control
12. Running Your Bot 24/7
Railway
Probably the easiest method in 2026.
Render
Good free alternative.
VPS
Best for serious projects.
Useful commands:
Kod:
screen -S discordbot
python main.pyor use PM2:
Kod:
npm install -g pm2
pm2 start main.py --interpreter python313. Common Beginner Mistakes
Slash Commands Not Showing
Try:
- reinviting the bot
- waiting 1-2 minutes
- syncing commands again
Invalid Token Error
Your token is wrong or expired.
Reset it inside:
Developer Portal → Bot → Reset Token
Message Content Intent Error
Enable intents inside:
Developer Portal → Bot
Bot Offline
Check:
- internet connection
- hosting status
- token validity
14. Recommended Folder Structure
As your bot grows:
Kod:
my-discord-bot/
│
├── commands/
├── events/
├── utils/
├── .env
├── main.py
└── requirements.txtThis structure scales much better for larger bots.
15. AI Discord Bots in 2026
AI bots are huge right now.
Popular integrations:
- OpenAI
- Anthropic
- Gemini
- Groq
- AI chat
- moderation
- ticket summaries
- auto replies
- server assistants
- ChatGPT Discord bot
- AI moderation bot
- AI support system
16. Security Tips
Never leak:
- bot token
- API keys
- database passwords
- use
Kod:.env - use permission checks
- limit admin commands
- validate user input
17. Should You Use discord.py in 2026?
Yes.
Kod:
discord.py- stable
- fast
- actively maintained
- beginner friendly
- moderation bots
- utility bots
- AI bots
- automation bots
18. Final Thoughts
Discord bot development is still growing fast in 2026.
If you’re starting now, focus on:
- Slash commands
- Clean structure
- Security
- Hosting
- Scalability
- music bots
- ticket systems
- leveling systems
- economy bots
- AI assistants
- moderation systems
Next Tutorials?
I can also create guides for:
- Music Bot (Lavalink)
- Ticket System
- Moderation Commands
- Leveling System
- Economy Bot
- AI ChatGPT Bot
- Dashboard Panel
- MongoDB Integration
- PostgreSQL Setup
Good luck building your Discord bot 🚀
Juniorboss
Admin
Derin Platform Yönetimi
Admin
Derin Platform Yönetimi

