185 words
1 minute
Building Discord Bots - A Complete Guide
Building Discord Bots
Discord bots are one of my favorite things to build. Here’s how I do it!
Why Discord Bots?
- Great for gaming communities
- Automate repetitive tasks
- Fun to build and share
- Clients love them!
Python Approach (discord.py)
Setup
pip install discord.pyBasic Bot
import discordfrom discord.ext import commands
bot = commands.Bot(command_prefix='!', intents=discord.Intents.all())
@bot.eventasync def on_ready(): print(f'{bot.user} is online!')
@bot.command()async def ping(ctx): await ctx.send(f'Pong! {round(bot.latency * 1000)}ms')
@bot.command()async def hello(ctx): await ctx.send(f'Hey {ctx.author.mention}!')
bot.run('YOUR_TOKEN')JavaScript Approach (discord.js)
Setup
npm init -ynpm install discord.jsBasic Bot
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, ]});
client.on('ready', () => { console.log(`Logged in as ${client.user.tag}!`);});
client.on('messageCreate', message => { if (message.content === '!ping') { message.reply('Pong!'); }});
client.login('YOUR_TOKEN');Cool Features to Add
Slash Commands
client.on('interactionCreate', async interaction => { if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'ping') { await interaction.reply('Pong!'); }});Embeds
embed = discord.Embed( title="Welcome!", description="Thanks for joining our server!", color=discord.Color.blue())embed.set_footer(text="Made by LUKKID")await ctx.send(embed=embed)Bot Ideas
| Bot Type | Features |
|---|---|
| Moderation | Kick, ban, mute, warnings |
| Music | Play from YouTube, Spotify |
| Games | Trivia, mini-games |
| Utility | Reminders, polls, tickets |
| Economy | Currency, shop, gambling |
Hosting Options
- Railway - Easy, free tier
- Heroku - Classic choice
- VPS - Full control
- Raspberry Pi - Self-hosted fun!
Start simple, add features as you go!
Building Discord Bots - A Complete Guide
https://blog.lukkid.dev/posts/discord-bots-guide/