How to Create Separators and Containers on Your NodeJS 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.js then paste the following code.

Cybrancee Panel, Create File dialog. Enter File Name (index.js)

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 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.
const { Client, GatewayIntentBits, EmbedBuilder } = require('discord.js');

const client = new Client({
    intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent]
});

// Create custom separators
const separators = {
    header: '═'.repeat(40),
    section: '─'.repeat(40),
    thick: '█'.repeat(40),
    thin: '─'.repeat(40),
    dots: '•'.repeat(40)
};

client.once('ready', () => {
    console.log(`🎨 ${client.user.tag} is online with beautiful formatting!`);
});

client.on('messageCreate', async (message) => {
    if (message.author.bot) return;

    // Command: !profile - Shows user info in a container
    if (message.content === '!profile') {
        
        // Create an embed container (beautiful info box)
        const profileEmbed = new EmbedBuilder()
            .setColor(0x0099FF) // Blue border
            .setTitle('👤 USER PROFILE')
            .setDescription(`Information for ${message.author.username}`)
            .setThumbnail(message.author.displayAvatarURL())
            .addFields(
                { name: `${separators.dots}`, value: '\u200b' }, // Separator
                { name: '🆔 User ID', value: message.author.id, inline: true },
                { name: '🎮 Account Age', value: '2 years', inline: true },
                { name: '📅 Server Join', value: '30 days ago', inline: true },
                { name: `${separators.thin}`, value: '\u200b' }, // Separator
                { name: '🏆 Level', value: '**25**', inline: true },
                { name: '⭐ Experience', value: '**1,250/2,000**', inline: true },
                { name: '📊 Rank', value: '**#15**', inline: true },
                { name: `${separators.thin}`, value: '\u200b' }, // Separator
                { name: '🎯 Achievements', value: '• Helper\n• Active Member\n• Event Winner' }
            )
            .setFooter({ text: 'Profile last updated today' })
            .setTimestamp();

        await message.reply({ embeds: [profileEmbed] });
    }

    // Command: !server - Shows server info with separators
    if (message.content === '!server') {
        
        const serverInfo = `
${separators.thick}
🏠 **SERVER INFORMATION**
${separators.header}
**📛 Name:** ${message.guild.name}
**🆔 ID:** ${message.guild.id}
**👥 Members:** ${message.guild.memberCount}
**📅 Created:** ${message.guild.createdAt.toDateString()}
${separators.section}
**🔊 Channels:** ${message.guild.channels.cache.size}
**🎭 Roles:** ${message.guild.roles.cache.size}
**👑 Owner:** ${message.guild.owner?.user.username || 'Unknown'}
${separators.thick}
        `;

        await message.reply(serverInfo);
    }

    // Command: !help - Shows help with organized sections
    if (message.content === '!help') {
        
        const helpEmbed = new EmbedBuilder()
            .setColor(0x00FF00) // Green border
            .setTitle('🆘 BOT HELP MENU')
            .setDescription('Here are all available commands:')
            .addFields(
                { 
                    name: '📊 INFORMATION COMMANDS', 
                    value: '```!profile - View your profile\n!server - View server info\n!help - Show this menu```' 
                },
                { 
                    name: '🎮 FUN COMMANDS', 
                    value: '```!ping - Check bot latency\n!menu - Interactive dropdown\n!buttons - Clickable buttons```' 
                },
                { 
                    name: '⚙️ UTILITY COMMANDS', 
                    value: '```!settings - Bot settings\n!stats - View statistics\n!info - Bot information```' 
                }
            )
            .setFooter({ text: 'Use commands to interact with the bot!' });

        await message.reply({ embeds: [helpEmbed] });
    }
});

// Log in to Discord
client.login('YOUR_BOT_TOKEN_HERE');

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