Discord Bot Command not showing as command

I’m trying to make a bot that shows a command such as “/help” but the /help isn’t working at all, and not showing.

I’ve tried giving the bot different permissions and re-inviting the bot many times. I changed around some stuff but idk what the issue could be.

I’m not sure what to do as nothing works, i don’t know if it’s my bot or not. My node verison is correct

// Import required modules
const { Client, GatewayIntentBits, EmbedBuilder, PermissionsBitField, Permissions } = require('discord.js');
const { ButtonBuilder, ButtonStyle, ComponentType, ActionRowBuilder } = require('discord.js');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageActionRow, MessageButton } = require('discord.js');

// Create a new Discord client
const client = new Client({
  intents: [
    GatewayIntentBits.Guilds, // Enable intents for guilds
    GatewayIntentBits.GuildMessages, // Enable intents for guild messages
    GatewayIntentBits.MessageContent, // Enable intents for message content
    GatewayIntentBits.GuildMessageReactions, // Enable intents for guild message reactions
  ],
});

// Set the bot token
const token = "Bot Token"

// When the client is ready, log the bot's username to the console
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}`);
});


// Define the help command
const helpCommand = new SlashCommandBuilder()
    .setName('help')
    .setDescription('Get help with various issues.');

// Handle interactionCreate event
client.on('interactionCreate', async (interaction) => {
    if (!interaction.isCommand() || interaction.commandName !== 'help') return;

    // Check if the command was used in a guild channel
    if (interaction.channel) {
        // Check if the command was used in the expected channel
        if (interaction.channelId !== 'Channel ID') {
            await interaction.reply({ content: 'This command is not available in this channel.', ephemeral: true });
            return;
        }
    }

    // Create the buttons as raw JSON components
    const buttonsRow1 = [
        {
            type: 2, // Button type
            style: 3, // Button style (SUCCESS)
            label: 'Ban Info',
            custom_id: 'ban-button'
        },
        {
            type: 2,
            style: 3, // Button style (SUCCESS)
            label: 'Tools Status',
            custom_id: 'first-button'
        },
        {
            type: 2,
            style: 1, // Button style (PRIMARY)
            label: 'Program Not Running',
            custom_id: 'second-button'
        },
        {
            type: 2,
            style: 1, // Button style (PRIMARY)
            label: 'Failed Error',
            custom_id: 'third-button'
        }
    ];

    const buttonsRow2 = [
        {
            type: 2,
            style: 1, // Button style (PRIMARY)
            label: 'Cracked',
            custom_id: 'fourth-button'
        },
        {
            type: 2,
            style: 1, // Button style (PRIMARY)
            label: 'DLC Cars',
            custom_id: 'fifth-button'
        },
        {
            type: 2,
            style: 1, // Button style (PRIMARY)
            label: 'Credits',
            custom_id: 'sixth-button'
        },
        {
            type: 2,
            style: 1, // Button style (PRIMARY)
            label: 'Add XP',
            custom_id: 'seventh-button'
        }
    ];

    const buttonsRow3 = [
        {
            type: 2,
            style: 1, // Button style (PRIMARY)
            label: 'Add Wheel-spins',
            custom_id: 'eighth-button'
        },
        {
            type: 2,
            style: 1, // Button style (PRIMARY)
            label: 'Disable AC Error',
            custom_id: 'ninth-button'
        },
        {
            type: 2,
            style: 1, // Button style (PRIMARY)
            label: 'AIO V2 Virus?',
            custom_id: 'tenth-button'
        },
        {
            type: 2,
            style: 2, // Button style (SECONDARY)
            label: 'Exit',
            custom_id: 'exit-button'
        }
    ];

    // Send a reply with buttons
    await interaction.reply({
        content: 'Help Command RecognizednIf you're having an issue or want a solution, click on one of the buttons to get an answer for your question.',
        components: [
            {
                type: 1, // Action row type
                components: buttonsRow1
            },
            {
                type: 1,
                components: buttonsRow2
            },
            {
                type: 1,
                components: buttonsRow3
            }
        ],
        ephemeral: true
    });

    // Handle button clicks
    const collector = interaction.channel?.createMessageComponentCollector({ time: 60000 });

    collector?.on('collect', async (buttonInteraction) => {
        if (buttonInteraction.customId === 'ban-button') {
            await buttonInteraction.update({ content: 'Ban Info button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'first-button') {
            await buttonInteraction.update({ content: 'Tools Status button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'second-button') {
            await buttonInteraction.update({ content: 'Program Not Running button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'third-button') {
            await buttonInteraction.update({ content: 'Failed Error button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'fourth-button') {
            await buttonInteraction.update({ content: 'Cracked button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'fifth-button') {
            await buttonInteraction.update({ content: 'DLC Cars button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'sixth-button') {
            await buttonInteraction.update({ content: 'Credits button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'seventh-button') {
            await buttonInteraction.update({ content: 'Add XP button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'eighth-button') {
            await buttonInteraction.update({ content: 'Add Wheel-spins button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'ninth-button') {
            await buttonInteraction.update({ content: 'Disable AC Error button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'tenth-button') {
            await buttonInteraction.update({ content: 'AIO V2 Virus? button clicked', ephemeral: true });
        } else if (buttonInteraction.customId === 'exit-button') {
            await buttonInteraction.update({ content: 'Exiting...', ephemeral: true });
            collector.stop(); // Stop the collector
            client.application.commands.create(helpCommand);
        }
    });

    // Handle the end of the collector
    collector?.on('end', () => {
        interaction.editReply({ content: 'You ran out of time, try again.', components: [] })
            .then(() => {
                interaction.deleteReply();
            })
            .catch(console.error);
    });
});

client.login(token)

New contributor

Hahahaha You trash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật