How to add server stats channels on discord.js

Solution for How to add server stats channels on discord.js
is Given Below:

I have a basic code for a discord bot that is only used for 1 server. The end result that I want is so that the bot displays the amount of total members, human users, bots, channels, roles, categories and emojis as a list of voice channels at the top of the server. I have made the channels and used their IDs in the following code.

//All Members
module.exports = client => {
    const channelId = '871913848020545546'

    const updateMembers = guild => {
        const channel = guild.channels.cache.get(channelId)
        channel.setName(`All Members: ${guild.memberCount.toLocaleString()}`)
    }

    client.on('guildMemberAdd', (member) => updateMembers(member.guild))
    client.on('guildMemberRemove', (member) => updateMembers(member.guild))

    const guild = client.guilds.cache.get('868192571766239262')
    updateMembers(guild)
}

//Members
module.exports = client => {
    const channelId = '871916605569892373'

    const updateMembers = guild => {
        const channel = guild.channels.cache.get(channelId)
        channel.setName(`Members: ${guild.members.cache.filter(member => !member.user.bot).size}`)
    }

    client.on('guildMemberAdd', (member) => updateMembers(member.guild))
    client.on('guildMemberRemove', (member) => updateMembers(member.guild))

    const guild = client.guilds.cache.get('868192571766239262')
    updateMembers(guild)
}

//Bots
module.exports = client => {
    const channelId = '871917535589728297'

    const updateMembers = guild => {
        const channel = guild.channels.cache.get(channelId)
        channel.setName(`Bots: ${guild.members.cache.filter(member => member.user.bot).size}`)
    }

    client.on('guildMemberAdd', (member) => updateMembers(member.guild))
    client.on('guildMemberRemove', (member) => updateMembers(member.guild))

    const guild = client.guilds.cache.get('868192571766239262')
    updateMembers(guild)
}

//Channels
module.exports = client => {
    const channelId = '871928838412705846'

    const updateChannels = guild => {
        const channel = guild.channels.cache.get(channelId)
        channel.setName(`Channels: ${guild.channels.cache.size}`)
    }

    client.on('guildChannelAdd', (channel) => updateChannels(channel.guild))
    client.on('guildChannelRemove', (channel) => updateChannels(channel.guild))

    const guild = client.guilds.cache.get('868192571766239262')
    updateChannels(guild)
    }

//Roles
module.exports = client => {
    const channelId = '871928838412705846'

    const updateRoles = guild => {
        const channel = guild.channels.cache.get(channelId)
        channel.setName(`Roles: ${guild.roles.cache.size}`)
    }

    client.on('guildRoleAdd', (role) => updateRoles(role.guild))
    client.on('guildRoleRemove', (role) => updateRoles(role.guild))

    const guild = client.guilds.cache.get('868192571766239262')
    updateRoles(guild)
    }

//Categories
module.exports = client => {
    const channelId = '871928838412705846'

    const updateCategories = guild => {
        const channel = guild.channels.cache.get(channelId)
        channel.setName(`Categories: ${guild.categories.cache.size}`)
    }

    client.on('guildCategoryAdd', (category) => updateCategories(category.guild))
    client.on('guildCategoryRemove', (category) => updateCategories(category.guild))

    const guild = client.guilds.cache.get('868192571766239262')
    updateCategories(guild)
    }

//Emojis
module.exports = client => {
    const channelId = '871928838412705846'

    const updateEmojis = guild => {
        const channel = guild.channels.cache.get(channelId)
        channel.setName(`Channels: ${guild.emojis.cache.size}`)
    }

    client.on('guildEmojiAdd', (emoji) => updateEmojis(emoji.guild))
    client.on('guildEmojiRemove', (emoji) => updateEmojis(emoji.guild))

    const guild = client.guilds.cache.get('868192571766239262')
    updateEmojis(guild)
    }

The All Members section doesn’t update automatically, the Members and Bots sections work, the Channels section returns the wrong amount of channels, and the Roles, Categories and Emojis sections return nothing.

Please advise