How do i make a bot status that has memberCount on it?

Related searches

im new to discord.js. i made a simple discord verify bot but i want to make the bot status to watching # people verifying (the # is how many people in my server). I see some bots have it, but i don't know how to make it. Here is my current code for the bot status

if (Object.keys(this.config.presence).length !== 0) {
        this.user.setPresence({
            game: {
                name: this.config.presence.name,
                type: this.config.presence.type
            },
            status: "online"
        }).catch(console.error);
    }

At the first you need set interval command to update member.

You dont need use this.user for this operation. The previus answer method will display only cached users, so its wrong way, because on bot start, you will has no users in this collection.

If you need display members on your own server you can do like this:

  1. Get your guild BY ID
  2. Get property guild.memberCount
  3. Update it every 5 min
client.on('ready', () => {
        setInterval(() => {
          targetGuild = client.guilds.get('GUILD ID HERE')
          if(targetGuild) {
              client.user.setPresence({ game: { name: targetGuild.memberCount + ' people verifying!', type: 'WATCHING' }, status: 'online'  })
                    .then(console.log)
                    .catch(console.error);
          }
    }, 1000 * 60 * 5);

});

After bot start, this will update after 5 minutes.

For test you can change }, 1000 * 60 * 5) to }, 1000);

How do i make a bot status that has memberCount on it?, A bot that counts members, users, bots, roles, channels, on-/offline members and giving you a real one-time configuration process that you shouldn't have to� I have the bot statues working, but I don't know how to make it say how many members are in my server. So members and bots added together. (example: 56 members in the server! I want the number to be the member count of the server.

Welcome to StackOverflow!

client.users.size should return you all the users from all the guilds that the bot is into!

if (Object.keys(this.config.presence).length !== 0) {
    this.user.setPresence({
            game: {
                name: client.users.size + ' people verifying!',
                type: this.config.presence.type
            },
            status: "online"
        }).catch(console.error);
    }

You can also find this at discord.js documentation.

Member Count, Get code examples like "Bots member count discord js" instantly right from your You would have defined this at the top of your index.js/app.js. 5 how to get the square root in js � how to get the status of other urls in ajax� Member Count 79. Eris. A bot that counts members, users, bots, roles, channels, on-/offline members and YouTube statistics with voice channel names ― server stats.

its as simple as:

bot.user.setPresence({ activity: { name: `${bot.users.cache.size} members` , type: 'WATCHING'}, status: 'online' })

Bots member count discord js Code Example, I'm currently trying to make my bot display the member count after a certain command message.channel.send(`This server has ${guild. Well the easiest way to do it is to create a role. Whenever someone joins the server, one bot will automatically give it to them (you have to set this up manually). Then whenever you wanna see how many members there are, go check that role.

With the Discord.js v12 API

Instead of client.guilds.get('GUILD ID HERE')

you should use client.guilds.cache.get('GUILD ID HERE')

Code to display member count as a message : discordapp, Invite member Count bot - https://discordbots.org/bot/membercou And if you guys have any Duration: 2:24 Posted: Oct 19, 2018 Lemme know if you have any q's or if I got something wrong aha - I've only been using Javascript/Node.js for two days to make my own bot lmao EDIT: Changed "my code" to "television" in the examples. EDIT 2: Oop edited examples to make it less confusing.

Member Count Bot setup and tutorial ||Discord tutorial 2018 , The best way to get help with the using the bot is to go to the documentation. See the Intro section on the docs for help setting up the bot. You can also view the FAQ if you have any more questions. If you need further help, you can join the support server (#support).

Just make the command respond with a message. have the message include ${msg.guild.memberCount} And that will tell you how many members are in the server you are are issuing the command in.

Only one command is needed for the setup of this bot, m!setup. This command also reverts all the settings to the default values when you want to quickly reset them. Configurable. Want to turn a counter off? Want to change the name of a counter? Feel free to do so! All of the commands can be viewed from the help menu, with the command m!help.

Comments
  • Thx, it works but it only said watching 0 people verifying, is there something wrong with the code?
  • @Veinify are you sure there are more than zero people ?
  • client.users.size display only chached users, so at start this is zero collection