Discord Bot Setup Assistant
Project description
Discord Bot Helper 🤖
A modern Python library for building Discord bots with slash commands and automatic configuration.
Features ✨
- ⚙️ Automatic configuration wizard (
dbh-init) - 🔄 Slash command synchronization
- 🧩 Built-in cog loader
- 📝 Smart logging system
- 🔒 Permission handling
- 📦 Auto-dependency installation
Installation 💻
pip install git+https://github.com/KeiraOMG0/discord-bot-helper.git
Quick Start 🚀 Initialize Configuration:
dbh-init
Follow prompts to set up your bot token and preferences
Create bot.py:
from discord_bot_helper import DiscordBotHelper
import discord
bot = DiscordBotHelper()
@bot.tree.command(name="ping", description="Check bot latency")
async def ping(interaction: discord.Interaction):
await interaction.response.send_message(f"Pong! {round(bot.latency*1000)}ms")
if __name__ == "__main__":
bot.run_bot()
Run Your Bot:
python bot.py
Command Types 📜
Slash Commands (Recommended)
from discord import app_commands
@bot.tree.command(name="hello", description="Greet a user")
@app_commands.describe(user="User to greet")
async def hello(interaction: discord.Interaction, user: discord.User):
await interaction.response.send_message(f"Hello {user.mention}!")
Prefix Commands (Legacy)
@bot.command()
async def ping(ctx):
await ctx.send(f"Pong! {round(bot.latency*1000)}ms")
Cog System 🧩 Create cogs/moderation.py:
import discord
from discord import app_commands
from discord.ext import commands
class Moderation(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@app_commands.command(name="clear", description="Clear messages")
@app_commands.checks.has_permissions(manage_messages=True)
async def clear(self, interaction: discord.Interaction, amount: int):
await interaction.response.defer(ephemeral=True)
deleted = await interaction.channel.purge(limit=amount)
await interaction.followup.send(f"Cleared {len(deleted)} messages", ephemeral=True)
async def setup(bot: commands.Bot):
await bot.add_cog(Moderation(bot))
Cogs automatically load when:
Placed in cogs/ directory
use_cogs enabled in config
File follows *.py naming
Permissions 🔒 Slash Command Permissions
@app_commands.checks.has_permissions(manage_messages=True)
@app_commands.checks.is_owner()
Prefix Command Permissions
@commands.has_permissions(kick_members=True)
@commands.is_owner()
Configuration ⚙️
Your config.json or .env file will contain:
{
"token": "YOUR_BOT_TOKEN",
"prefix": "!",
"sync_commands": true,
"use_cogs": true
}
Example Bot 🌟
from discord_bot_helper import DiscordBotHelper
import discord
class MyBot(DiscordBotHelper):
async def setup_hook(self):
await self.load_cogs()
await self.tree.sync()
bot = MyBot()
@bot.tree.command(name="server", description="Show server info")
async def server(interaction: discord.Interaction):
embed = discord.Embed(title=interaction.guild.name)
embed.add_field(name="Members", value=interaction.guild.member_count)
await interaction.response.send_message(embed=embed)
if __name__ == "__main__":
bot.run_bot()
Troubleshooting ⚠️ Common Issues:
Missing Permissions: Ensure bot has correct permissions in server
Command Sync Issues: Use await bot.tree.sync() after cog loading
Token Errors: Verify token in config.json/.env
Intents Issues: Enable required intents in Discord Developer Portal
Contributing 🤝 Fork the repository
Open Pull Request
License 📄 MIT License - See LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file discord_bot_helper-1.0.0.tar.gz.
File metadata
- Download URL: discord_bot_helper-1.0.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14aceebc31674b00cc7300f88ddca345dabefd28103590c85c71c5fc40216666
|
|
| MD5 |
33d137df3f0eb7f16db5a2fe1eafbc3c
|
|
| BLAKE2b-256 |
6eb586cceb0ec0f63304e086fc555905bcf555e18aa3049343a5b9ea9ee408bd
|
File details
Details for the file discord_bot_helper-1.0.0-py3-none-any.whl.
File metadata
- Download URL: discord_bot_helper-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f2ad3309ea2c8c9f87f871cd21a7ec7c6263c1f45e2797c56fcea432118fb0f
|
|
| MD5 |
9fdf7755479d6b066ae4805a79d6a2b3
|
|
| BLAKE2b-256 |
73417e1b0ca124bd773920150db76a9e9f6b71df871d3a1cb2dd553911448022
|