bot not answering

i created command !membercount and when I enter the command, the bot does not display the membercount
Theres no error
code:
const { Client, GatewayIntentBits, ActivityType } = require("discord.js");

const prefix = "!";

const client = new Client({
    allowedMentions: {
        parse: ["users", "roles"],
        repliedUser: true,
    },
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildPresences,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildMessageReactions,
    ],
});


client.on("message", message => {
    if (!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    //

    const messageArray = message.content.split("");
    const argument = messageArray.slice(1)
    const cmd = messageArray[0];

    //

if (cmd === `${prefix}membercount`){
    message.channel.send(`**membercount:** ${message.guild.memberCount}`)
}


})
Was this page helpful?