Skip to main content

How to Create Separators and Containers on Your Python Discord Bot

1. Log In to Your Panel


2. Select the ‘Files’ Tab

Cybrancee Panel in the files page, "Files" tab on the sidebar is highlighted

3. Create Your Main Bot’s File

Create a new file called index.py then paste the following code.

Pterodactyl Panel, Create File dialog. Enter File Name (index.py)

What this code does:

  • It creates a Discord bot that uses separators and embeds to organize information beautifully.
  • The bot responds to the following commands:
    • !profile – Displays the user’s profile in a structured embed with custom separators and detailed fields.
    • !server – Shows server information formatted with separators for clarity.
    • !help – Sends a help menu embed, categorizing all available commands into sections.
  • Custom separators are defined in a dictionary to improve message layout and readability.
  • The code demonstrates different ways to structure messages using embeds and text formatting for a polished, visually organized look.
import discord
from discord.ext import commands

# Calling our requirements
# We use commands.Bot for prefix-based commands like !profile
intents = discord.Intents.default()
intents.message_content = True  # Required to read !commands
bot = commands.Bot(command_prefix='!', intents=intents)

# Create custom separators
separators = {
    'header': '═' * 40,
    'section': '─' * 40,
    'thick': '█' * 40,
    'thin': '─' * 40,
    'dots': '•' * 40
}

@bot.event
async def on_ready():
    print(f' {bot.user.name} is online with beautiful formatting!')

# Command: !profile - Shows user info in a container
@bot.command()
async def profile(ctx):
    # Create an embed container (beautiful info box)
    profile_embed = discord.Embed(
        title=" USER PROFILE",
        description=f"Information for {ctx.author.name}",
        color=0x0099FF # Blue border
    )
    
    profile_embed.set_thumbnail(url=ctx.author.display_avatar.url)
    
    # Adding fields with separators
    # \u200b is an invisible character used to create empty space
    profile_embed.add_field(name=separators['dots'], value='\u200b', inline=False)
    profile_embed.add_field(name=" User ID", value=ctx.author.id, inline=True)
    profile_embed.add_field(name=" Account Age", value="2 years", inline=True)
    profile_embed.add_field(name=" Server Join", value="30 days ago", inline=True)
    
    profile_embed.add_field(name=separators['thin'], value='\u200b', inline=False)
    profile_embed.add_field(name=" Level", value="**25**", inline=True)
    profile_embed.add_field(name=" Experience", value="**1,250/2,000**", inline=True)
    profile_embed.add_field(name=" Rank", value="**#15**", inline=True)
    
    profile_embed.add_field(name=separators['thin'], value='\u200b', inline=False)
    profile_embed.add_field(name=" Achievements", value="• Helper\n• Active Member\n• Event Winner", inline=False)
    
    profile_embed.set_footer(text="Profile last updated today")
    profile_embed.timestamp = ctx.message.created_at

    await ctx.send(embed=profile_embed)

# Command: !server - Shows server info with separators
@bot.command()
async def server(ctx):
    server_info = (
        f"{separators['thick']}\n"
        f"**SERVER INFORMATION**\n"
        f"{separators['header']}\n"
        f"** Name:** {ctx.guild.name}\n"
        f"** ID:** {ctx.guild.id}\n"
        f"** Members:** {ctx.guild.member_count}\n"
        f"** Created:** {ctx.guild.created_at.strftime('%a %b %d %Y')}\n"
        f"{separators['section']}\n"
        f"** Channels:** {len(ctx.guild.channels)}\n"
        f"** Roles:** {len(ctx.guild.roles)}\n"
        f"** Owner:** {ctx.guild.owner}\n"
        f"{separators['thick']}"
    )
    
    await ctx.send(server_info)

# Command: !help - Shows help with organized sections
@bot.command()
async def help_menu(ctx):
    help_embed = discord.Embed(
        title=" BOT HELP MENU",
        description="Here are all available commands:",
        color=0x00FF00 # Green border
    )
    
    help_embed.add_field(
        name=" INFORMATION COMMANDS", 
        value="```!profile - View your profile\n!server - View server info\n!help - Show this menu```",
        inline=False
    )
    help_embed.add_field(
        name=" FUN COMMANDS", 
        value="```!ping - Check bot latency\n!menu - Interactive dropdown\n!buttons - Clickable buttons```",
        inline=False
    )
    help_embed.add_field(
        name=" UTILITY COMMANDS", 
        value="```!settings - Bot settings\n!stats - View statistics\n!info - Bot information```",
        inline=False
    )
    
    help_embed.set_footer(text="Use commands to interact with the bot!")
    
    await ctx.send(embed=help_embed)

# Log in to Discord
bot.run('YOUR_BOT_TOKEN_HERE')

Separators & Containers Example:

Discord Bot Example of Separators 1
Discord Bot Example of Separators 2

Discord Bot Hosting

Starts at $1.49

External link icon

Was this article helpful?
Please Share Your Feedback
How Can We Improve This Article?
Table of Contents