patrick_jane_fan

lets do a verifcation embed panel. make a custom comamnd whenever I say /verifcation it sends the verification panel. Inthe .ev note should be there DOCK API and DISCORD API. And a code that would be banner url to paste my banner url there whne the verification panels sends. DO YOUR BEST. ADD EVERYTHING THAT FITS

Kodari AI
KodariOct 24 at 5:45 pm 1
VerificationPanelBot
A Discord bot featuring a custom /verification command that sends an embedded verification panel. Includes a configuration file with DOCK API and DISCORD API keys, plus a banner URL field for customizing the panel's visual header. The bot uses Discord.js to handle slash commands and embed rich embeds with verification instructions, user prompts, and action buttons for streamlined user verification workflows.
  1. Create the Discord bot entry point with /verifcation (plus /verification) and a button that assigns the configured verified role.

  2. Add .env settings for the Discord token/API, role ID, and optional verification banner URL.

  3. Add package metadata and setup notes.

Created the verification bot with /verifcation and /verification. Either command posts an embed panel with a Verify button; clicking it assigns the configured role and shows an ephemeral confirmation. The optional banner appears when you add a direct image URL.

Before starting, set DISCORD_TOKEN, VERIFICATION_ROLE_ID, and optionally VERIFICATION_BANNER_URL in .env. Invite the bot with the bot and applications.commands scopes, and give it Manage Roles. Move the bot’s role above the role it needs to assign. Then run npm install and npm start. No privileged Gateway intents are needed.

Kodari can make mistakes. Review important code before using.
Files
bot.js
package.json
Code
2 160
bot.js
require('dotenv').config();

const {
    ActionRowBuilder,
    ButtonBuilder,
    ButtonStyle,
    Client,
    EmbedBuilder,
    GatewayIntentBits,
    REST,
    Routes
} = require('discord.js');

const token = process.env.DISCORD_TOKEN;
const verificationRoleId = process.env.VERIFICATION_ROLE_ID;
const bannerUrl = process.env.VERIFICATION_BANNER_URL?.trim();
const verificationButtonId = 'verification-panel:verify';

if (!token || token === 'your_discord_bot_token_here') {
    throw new Error('Set DISCORD_TOKEN in the .env file before starting the bot.');
}

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

function createVerificationPanel() {
    const embed = new EmbedBuilder()
        .setColor(0x5865F2)
        .setTitle('Server Verification')
        .setDescription([
            'Welcome! Click the button below to verify your account and unlock the server.',
            '',
            'By verifying, you confirm that you agree to follow the server rules.'
        ].join('\n'))
        .setFooter({ text: 'If the button does not work, please contact a server moderator.' });

    if (bannerUrl) {
        try {
            new URL(bannerUrl);
            embed.setImage(bannerUrl);
        } catch {
            console.warn('VERIFICATION_BANNER_URL is not a valid URL; sending the panel without a banner.');
        }
    }

    const row = new ActionRowBuilder().addComponents(
        new ButtonBuilder()
            .setCustomId(verificationButtonId)
            .setLabel('Verify')
            .setStyle(ButtonStyle.Success)
            .setEmoji('✅')
    );

    return { embeds: [embed], components: [row] };
}

async function registerCommands() {
    const rest = new REST({ version: '10' }).setToken(token);
    await rest.put(Routes.applicationCommands(client.application.id), {
        body: [
            {
                name: 'verifcation',
                description: 'Send the server verification panel'
            },
            {
                name: 'verification',
                description: 'Send the server verification panel'
            }
        ]
    });
}

client.once('clientReady', async () => {
    try {
        await registerCommands();
        console.log(`Logged in as ${client.user.tag}`);
        console.log('KODARI_READY');
    } catch (error) {
        console.error('Failed to register slash commands:', error);
        process.exitCode = 1;
        await client.destroy();
    }
});

client.on('interactionCreate', async (interaction) => {
    try {
        if (interaction.isChatInputCommand()) {
            if (interaction.commandName !== 'verifcation' && interaction.commandName !== 'verification') return;
            if (!interaction.inGuild()) {
                await interaction.reply({ content: 'The verification panel can only be sent in a server.', ephemeral: true });
                return;
            }

            await interaction.channel.send(createVerificationPanel());
            await interaction.reply({ content: 'Verification panel sent.', ephemeral: true });
            return;
        }

        if (!interaction.isButton() || interaction.customId !== verificationButtonId) return;

        if (!interaction.inGuild()) {
            await interaction.reply({ content: 'Verification is only available in a server.', ephemeral: true });
            return;
        }

        if (!verificationRoleId || verificationRoleId === 'your_verified_role_id_here') {
            await interaction.reply({
                content: 'Verification is not configured yet. Ask a server administrator to set VERIFICATION_ROLE_ID.',
                ephemeral: true
            });
            return;
        }

        const member = await interaction.guild.members.fetch(interaction.user.id);
        if (member.roles.cache.has(verificationRoleId)) {
            await interaction.reply({ content: 'You are already verified. Welcome!', ephemeral: true });
            return;
        }

        await member.roles.add(verificationRoleId, 'Member completed the verification panel');
        await interaction.reply({ content: 'You are verified. Welcome to the server!', ephemeral: true });
    } catch (error) {
        console.error('Interaction failed:', error);
        if (interaction.isRepliable() && !interaction.replied && !interaction.deferred) {
            await interaction.reply({
                content: 'Something went wrong. Please try again or contact a server moderator.',
                ephemeral: true
            }).catch(console.error);
        } else if (interaction.isRepliable() && (interaction.replied || interaction.deferred)) {
            await interaction.followUp({
                content: 'Something went wrong. Please contact a server moderator.',
                ephemeral: true
            }).catch(console.error);
        }
    }
});

client.on('error', (error) => console.error('Discord client error:', error));
process.on('unhandledRejection', (error) => console.error('Unhandled promise rejection:', error));

client.login(token).catch((error) => {
    console.error('Failed to log in to Discord:', error);
    process.exitCode = 1;
});